Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Unit 2 Knowledge Test Make Up

Total questions: 11

Worksheet time: 6mins

Name
Class
Date
1.

Which of the following is the correct way to define a turnRight function in Karel?

a)

b)

c)

d)

2.

In this code, how many times is the dance function called and how many times is it defined?

a)

Called 3 times, defined 3 times

b)

Called 1 time, defined 1 time

c)

Called 1 time, defined 3 times

d)

Called 3 times, defined 1 time

3.

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

a)

I

b)

II

c)

I and II

d)

The loop is correct.

4.

What is the proper format for a multi-line comment in Karel?

a)

{This is a comment}

b)

// This is a comment

c)

/* This is a comment

d)

This is a comment

5.

What condition should be used in this while loop to get Karel to pick up all the tennis balls on the current location?

a)

noBallsPresent()

b)

ballsPresent()

c)

frontIsClear()

d)

takeBall()

6.

How can we teach Karel new commands?

a)


For loop

b)

While loop

c)

The start function

d)

Define a new function

7.

How can we improve the following program?

a)

Fix the indentation of this program

b)

Use a while loop to repeat the move command

c)

Break down this program into more functions

d)

Use a for loop to repeat the move command

8.

In the following code below from the Tower Builder example, what is the purpose of the For Loop?

a)

To move and build a tower.

b)

To put a ball and move then turn around around, go down and turn left.

c)

To put a ball and move.

d)

To put a ball and move three times.

9.

In the following code, what would be a good Postcondition to write?

a)

Karel ends one spot above a tennis ball facing East.

b)

Karel is on the same position but on top of a ball.

c)

Karel is on a spot with a tennis ball facing north

d)

Karel is facing East.

10.

How many total times will Karel move in this program?

a)

1

b)

5

c)

6

d)

7

11.

Which of the following is not a valid condition to go in an if statement for Karel?

a)

ballsPresent()

b)

frontIsClear()

c)

leftIsBlocked()

d)

turnLeft()