wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Programming with Karel the Dog 2

Total questions: 13

Worksheet time: 7mins

Name
Class
Date
1.

How many times should the start function be defined in a program?

a)

0

b)

1

c)

2

d)

How ever many you like

2.

How many times should you call the start function in a program?

a)

0

b)

1

c)

2

d)

However many times you like

3.

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

4.

What is top down design?

a)

Top down design is a way that you can create designs on a computer to put on a web page

b)

Top down design is a way of designing your program by starting with the biggest problem and breaking it down into smaller and smaller pieces that are easier to solve.

c)

Top down design is a way of designing your programs starting with the individual commands first

d)

Top down design is a way to use loops and classes to decompose the problem

5.

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

6.

What commands does SuperKarel know that regular Karel does not?

a)

turnLeft() and jump()

b)

turnRight() and jump()

c)

turnAround() and turnRight()

d)

turnAround() and jump()

7.

What is the best way for Karel to move 10 times?

a)

move();

move();

move();

move();

move();

move();

move();

move();

move();

move();

b)

for (var i = 0; i < 10; i++) {

move();

}

c)

move(10);

d)

move10();

8.

Why do we use if statements in JavaScript?

a)

To break out of some block of code

b)

To do something only if a condition is true

c)

To do something while a condition is true

d)

To repeat something for a fixed number of times

9.

Which general if statement definition is written correctly?

a)

for(condition) {

// code

}

b)

if(condition) {//code
} 

c)

if(var i = 0; i < count; i++) {

//code

}

d)

if false {

//code

}

10.

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

c)

To break out of some block of code

d)

To repeat something while a condition is true

11.

What does an if/else statement look like in JavaScript?

a)

if (condition) {

//code

}

b)

for (var i = 0; i < count; i++) {
    //code
}

c)

if (condition) {

//code

}

if (condition) {

//code

}

d)

if (condition) {

//code

} else {

//code

}

12.

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

13.

Which general while loop definition is written correctly?

a)

while (x is true) {

// code

}

b)

if (i<5) {

//code

}

c)

while (var i = 0; i < count; i++) {
    //code
}

d)

while (condition) {

//code

}