Search Header Logo

Uji coba algoritmika OSK Komputer

Authored by rizka yulia ningsih

Mathematics

1st - 3rd Grade

Used 17+ times

Uji coba algoritmika OSK Komputer
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

function fibonacci(N: longint): longint;

begin

if (N <= 1) then begin fibonacci := N;

end else begin

fibonacci := fibonacci(N-1) + fibonacci(N-2);

end;

end;


begin

writeln(fibonacci(10));

end.


Keluaran dari program diatas adalah?

35

45

55

65

2.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

function fak(x: longint): longint;

begin

if (x = 1) then begin

fak := 1

end else begin

fak := x * fak(x-1);

end;

end;


begin

writeln( fak(10));

end.


Keluaran dari program diatas adalah?

3628800

3728800

3828800

3928800

3.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

var x, y: longint;

procedure tukar(a, b: longint);

var temp: longint;

begin

temp := a; a := b; b := temp;

end;

begin

x := 1; y := 2; tukar(x, y);

writeln('x=', x, ' y=', y);

end.


keluaran program tersebut adalah

x=2 y=1

x=1 y=2

x=2 y=2

x=1 y=1

4.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

procedure mystery(a:integer; b:integer;);

var m:integer;

begin

if (a <> b)

begin

writeln(‘OSK2019’);

m := (a + b) / 2;

mystery(a, m);

mystery(m, b);

end;

end;


Berapa kali teks ‘OSK2019’ dicetak pada pemanggilan mystery(0,8) ?

4

5

6

program tidak pernah berhenti

5.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

function f(x: integer) : integer;

begin

if(x = 0) then f := 0

else f := 1 - f(x - 1);

end;


Ada berapa banyak nilai f(n) (1 <= n <= 2019) yang bernilai true?

1009

1010

2019

1

6.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

var n, count : integer;

begin

n:=1;

count := 0;

repeat n := (n * n + 5) mod 23;

count := count + 1;

until n = 0;

end.


Berapakah hasil akhir dari variabel count, jika n = 3?

4

5

6

7

7.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

var data: array[1..10] of integer = (8, 12, 16, 20, 12, 14, 16, 20, 20, 22);

function itik(a, b: integer):integer;

begin

if b = 0 then itik := a

else itik := itik(b,a mod b);

end;

function bebek(x: integer):integer;

begin

if x > 10 then bebek:=0

else bebek := itik(data[x], bebek(x * 2));

end;

begin

writeln(bebek(5));

end.


Apakah keluaran dari program di atas?

1

2

3

4

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?