wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

C++ Quiz Percabangan

Total questions: 5

Worksheet time: 3mins

Name
Class
Date
1.

What is the purpose of the 'if' statement in the code?

a)

To output text to the console

b)

To check if a number is even or odd

c)

To perform a loop

d)

To declare a variable

2.

What will be printed if the input number is 4?

a)

Angka 4 adalah angka negatif.

b)

Angka 4 adalah angka positif.

c)

Angka 4 adalah angka genap.

d)

Angka 4 adalah angka ganjil.

3.

What is the correct way to output the variable 'angka' in the cout statement?

a)

cout << 'angka';

b)

cout << angka;

c)

cout << 'Angka' << angka;

d)

cout << 'Angka ' + angka;

4.

What will happen if the input number is 3?

a)

It will print that the number is odd.

b)

It will cause a compilation error.

c)

It will not print anything.

d)

It will print that the number is even.

5.

What is missing in the else block of the code?

a)

A return statement

b)

A variable declaration

c)

An output statement

d)

A closing brace