wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Y8 Java (Karel the dog)

Total questions: 10

Worksheet time: 16mins

Name
Class
Date
1.

Which function will turn Karel around?

a)

function turnAround()

turnLeft();

turnLeft();

turnLeft();

}

b)

function turnAround(){

turnLeft();

turnLeft();

turnLeft();

}

c)

function turnAround(){

turnLeft();

turnLeft();

turnleft();

}

2.

How do we get a function to run in our program?

a)

We write it when we want to use it in a program

b)

We call it when we want to use it in a program

c)

We can set a time for it to run

d)

It runs automatically

3.

Which is the correct code?

a)

turnLeft();

putBall();

move():

putBall();

move();

b)

turnLeft();

putBall()

move()

putBall:

move();

c)

turnLeft();

putBall();

move():

putall:

move();

4.

Karel is stood at position (dot) 0,0. What position is the dot 2 places after Karel and 1 up?

a)

2,1

b)

1,2

c)

0,2

d)

2,0

5.

I want Karel to move, drop a ball and move once again. Which is the correct code?

a)

function dropball(){

move();

putball();

move();

}

b)

function dropball(){

putBall);

putBall();

move();

}

c)

function dropball(){

move();

putBall();

move();

}

6.

I need Karel to get to coordinate 0,3. Which code is correct?

a)

move();

turnLeft();

move();

move();

b)

turnLeft();

move();

move();

move();

c)

move();

turnLeft();

move();

turnLeft();

7.

What is the least number of times Karel needs to move forward (East) to complete this program? she starts at 0,0

a)

2

b)

3

c)

4

d)

5

8.

Why do we use functions in a program?

a)

Easier to find bugs/problems in a program

b)

The program reads functions at a faster pace

c)

Functions take less time to write

d)

Organises the program more efficiently

9.

Which is the correct program?

a)

move();

turnLeft();

putBall();

move();

b)

move();

putBall();

move(0;

turnLeft()

c)

move();

putBall();

move();

turnLeft();

10.

2 of the functions have bugs in them...which is correct

a)

function move(){

turnLeft();

turnLeft();

turnLeft();

}

b)

function move(){

turnLeft();

turnLeft();

turnLeft();

c)

function move(){

turnleft();

turnLeft();

turnLeft();

}