Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Karel Quiz

Total questions: 22

Worksheet time: 47mins

Name
Class
Date
1.

Which command is written correctly?

a)

Move

b)

move

c)

Move();

d)

move();

2.

Which command is written incorrectly?

a)

putBall();

b)

putball();

c)

turnLeft();

d)

takeBall();

3.

This code:

putBall();

move();

putBall();

put 2 balls in the same place and then move one place?

a)

True

b)

False

4.

What is a code comment?

a)

A way to teach Karel a new word

b)

A way to give notes to the reader to explain what your code is doing

c)

A message to your teacher in code

d)

A place to write whatever you want in your code

5.

Why do we use functions in programming?

a)

Break down our program into smaller parts

b)

Avoid repeating code

c)

Make our program more readable

d)

All of the above

6.

Define a Function

a)

means to teach the computer a new command and explain what it should do when receiving that command.

b)

an instruction you can give to Karel

c)

used to mark what code needs to perform in a certain block

d)

actually gives the command, so the computer will run the code for that function.

7.

Call a Function

a)

actually gives the command, so the computer will run the code for that function.

b)

an instruction you can give to Karel

c)

means to teach the computer a new command and explain what it should do when receiving that command.

d)

used to mark what code needs to perform in a certain block

8.

Top Down Design

a)

a method for breaking our program down into smaller parts.

b)

The way your code is written is the style. It covers the aspects of the code that goes beyond whether or not it just works.

c)

A message in your code that explains what is going on.

d)

This is the function that is called when you click run.

9.

How many times does Karel move with this loop?

a)

9

b)

0

c)

10

d)

1

10.

The code in the picture will move Karel in a square.

a)

True

b)

False

11.

Which code will put Karel in the position shown in second world?

a)

putBall(); putBall(); move(); move();

b)

move(); putBall(); move(); putBall();

c)

putBall(); move(); putBall(); move();

d)

move(); putBall(); putBall(); move();

12.

Which code below will put Karel in the position shown in picture?

a)

move(); Move(); turnLeft(); move();

b)

move; move(); turnLeft; move();

c)

move(); move(); TurnLeft(); Move();

d)

move(); move(); turnLeft(); move();

13.

Which code would correctly have Karel move to and pick up BOTH balls?

a)
b)
c)
d)
14.

Which code shows Karel getting to the ball and taking it?

a)
b)
c)
d)
15.

Which code correctly has Karel jump both Hurdles and reach the end of the 1st street to the right?

a)
b)
c)
d)
16.

What would be the resulting world if the following code ran in the starting world shown?

a)
b)
c)
d)
17.

Why do we use if/else statements in JavaScript?

a)

To repeat something for a fixed number of times

b)

To either do something if a condition is true or do something else if that condition is false

c)

To break out of some block of code

d)

To repeat something while a condition is true

18.

Why do we use while loops in JavaScript?

a)

To break out of some block of code

b)

To do something if a condition is true

c)

To repeat some code while a condition is true

d)

To repeat something for a fixed number of times

19.

You need to write a program that has Karel move 6 times and then put a ball.

Which control structure do you need to use?

a)

FOR loop

b)

WHILE loop

c)

IF statement

d)

IF/ELSE statement

e)

None of the above

20.

You need to write a program that has Karel take all the tennis balls where Karel is standing.

Karel should end up with no tennis balls on that spot.

Which control structure do you need to use?

a)

FOR loop

b)

WHILE loop

c)

IF statement

d)

IF/ELSE statement

e)

None of the above

21.

You need to write a program that has Karel move if the front is clear, but if it isn’t clear, Karel will do nothing.

Which control structure do you need to use?

a)

FOR loop

b)

WHILE loop

c)

IF statement

d)

IF/ELSE statement

e)

None of the above

22.

You need to write a program where Karel will take a ball if there is a ball present, otherwise Karel should put down a ball.

Which control structure do you need to use?

a)

FOR loop

b)

WHILE loop

c)

IF statement

d)

IF/ELSE statement

e)

None of the above