WorksheetsUnit 2 Knowledge Test Make Up
Total questions: 11
Worksheet time: 6mins
Which of the following is the correct way to define a turnRight function in Karel?
In this code, how many times is the dance function called and how many times is it defined?
Called 3 times, defined 3 times
Called 1 time, defined 1 time
Called 1 time, defined 3 times
Called 3 times, defined 1 time
What is wrong with this for loop?
I. The for loop uses commas instead of semicolons
II. It should say i++ instead of i + 1
I
II
I and II
The loop is correct.
What is the proper format for a multi-line comment in Karel?
{This is a comment}
// This is a comment
/* This is a comment
This is a comment
What condition should be used in this while loop to get Karel to pick up all the tennis balls on the current location?
noBallsPresent()
ballsPresent()
frontIsClear()
takeBall()
How can we teach Karel new commands?
For loop
While loop
The start function
Define a new function
How can we improve the following program?
Fix the indentation of this program
Use a while loop to repeat the move command
Break down this program into more functions
Use a for loop to repeat the move command
In the following code below from the Tower Builder example, what is the purpose of the For Loop?
To move and build a tower.
To put a ball and move then turn around around, go down and turn left.
To put a ball and move.
To put a ball and move three times.
In the following code, what would be a good Postcondition to write?
Karel ends one spot above a tennis ball facing East.
Karel is on the same position but on top of a ball.
Karel is on a spot with a tennis ball facing north
Karel is facing East.
How many total times will Karel move in this program?
1
5
6
7
Which of the following is not a valid condition to go in an if statement for Karel?
ballsPresent()
frontIsClear()
leftIsBlocked()
turnLeft()
