WorksheetsKarel If Statement Quiz
Total questions: 5
Worksheet time: 3mins
An if statement allows Karel to:
Repeat actions until a wall is reached
Place a ball on every corner
Choose to act only when a condition is true
Count the number of steps Karel moves
Which is a valid use of an if statement?
if (frontIsClear()) { move(); }
for if frontIsClear { move(); }
while not blocked, move()
if frontIsClear then move()
Which of the following is the correct syntax for an if statement in Karel?
if frontIsClear(): move()
if frontIsClear() { move(); }
if (frontIsClear()) move();
if frontIsClear[] move()
Which of these is the BEST description of an if statement?
It repeats code a fixed number of times.
It checks a condition and runs code only if the condition is true.
It always runs the code at least once.
It randomly decides whether to run the code.
What will happen if the condition in an if statement is false?
The program crashes.
The code inside the if statement is skipped.
The program loops infinitely.
The condition changes to true automatically.
