Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Karel If Statement Quiz

Total questions: 5

Worksheet time: 3mins

Name
Class
Date
1.

An if statement allows Karel to:

a)

Repeat actions until a wall is reached

b)

Place a ball on every corner

c)

Choose to act only when a condition is true

d)

Count the number of steps Karel moves

2.

Which is a valid use of an if statement?

a)

if (frontIsClear()) { move(); }

b)

for if frontIsClear { move(); }

c)

while not blocked, move()

d)

if frontIsClear then move()

3.

Which of the following is the correct syntax for an if statement in Karel?

a)

if frontIsClear(): move()

b)

if frontIsClear() { move(); }

c)

if (frontIsClear()) move();

d)

if frontIsClear[] move()

4.

Which of these is the BEST description of an if statement?

a)

It repeats code a fixed number of times.

b)

It checks a condition and runs code only if the condition is true.

c)

It always runs the code at least once.

d)

It randomly decides whether to run the code.

5.

What will happen if the condition in an if statement is false?

a)

The program crashes.

b)

The code inside the if statement is skipped.

c)

The program loops infinitely.

d)

The condition changes to true automatically.