What command makes Karel move one step forward?
move
Which command turns Karel right?
turnRight();
What keyword starts a decision statement in Karel?
if
What does an else clause do?
Runs when the if condition is false.
What is the purpose of a for loop?
To repeat code a set number of times.
What command makes Karel place a ball on the corner?
putBall
Which command makes Karel turn around?
turnAround();
What happens if the condition in an if statement is false?
Nothing happens; Karel skips the code inside the if.
What happens with Karel with this code:
if (ballsPresent()) {
takeBall();
} else {
move();
}
If there is a ball → take it; else → move.
What happens to Karel in this code?
for (var i = 0; i < 5; i++) {
move();
}
Karel moves forward 5 steps.
What command makes Karel pick up a ball?
If Karel faces North and runs turnRight();, which way will Karel face?
East
True or False: An if statement can run both the true and false branch
false
What happens to Karel
if (frontIsClear()) {
move();
} else {
turnLeft();
}
if the front is clear. If yes, move. If not, turn left.
When does a for loop stop running?
When the loop has repeated the set number of times.
What command turns Karel left?
turnLeft
Write the code to make Karel move forward, turn right, and put a ball.
move();
turnRight();
putBall();
If Karel is standing on a corner with no balls, what happens if the code is:
if (ballsPresent()) {
}
Nothing happens — Karel skips the takeBall(); command because the condition is false.
Why would you use an if/else statement instead of just an if statement?
Because it lets you choose between two actions instead of just checking one.
What happens to Karel?
for (var i = 0; i < 3; i++) {
putBall();
move();
}
makes Karel put down 3 balls, one per corner.
Write the code to make Karel move forward 3 steps and put a ball.
move();
move();
move();
putBall();
What’s the difference between Karel and SuperKarel?
SuperKarel has extra commands like turnRight() and turnAround()
What happens to Karel in the following statement
if (frontIsBlocked()) {
turnLeft();
}
Karel will only turn left if there is a wall in front. If the way is clear, Karel does nothing.
Bonus Question:
Karel is on a corner. The code says:
if (ballsPresent()) {
If there is a ball → Karel will take the ball.
If there is no ball → Karel will move forward.
What is the difference between repeating with a for loop vs. writing the same command multiple times?
A for loop is shorter, easier to read, and reusable