Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

7th Grade Programing with Karel

Total questions: 26

Worksheet time: 16mins

Name
Class
Date
1.

Which of these is a valid Karel command?

a)

move;

b)

MOVE

c)

move();

d)

move()

2.

What is a street in a Karel world?

a)

A row

b)

A column

c)

A single point

d)

Karel's Position

3.

What is an avenue in a Karel world?

a)

A row

b)

A column

c)

A single point

d)

Karel's position

4.

If Karel starts at Street 1 and Avenue 3 facing East, what street and avenue will Karel be on after this code runs?

move();

move();

move();

turnLeft();

move();

a)

Street 1 and Avenue 3

b)

Street 4 and Avenue 4

c)

Street 2 and Avenue 6

d)

Street 6 and Avenue 2

5.

If Karel is facing North and the code

turnLeft();

turnLeft();

a)

North

b)

East

c)

South

d)

West

6.

How many times should Karel turn left in order to turn right?

a)

1

b)

2

c)

3

d)

4

7.

What can be used to teach Karel to turn right?

a)

Functions

b)

Varibles

c)

Dog Treats

d)

Karel can already turn right

8.

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

a)

0

b)

1

c)

2

d)

However many times you like

9.

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

a)

0

b)

1

c)

2

d)

however many times you like

10.

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

11.

What is top down design?

a)

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.

b)

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

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

12.

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

13.

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()

14.

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();

15.

Why do we use if statements in JavaScript?

a)

To break out of some block of code

b)

To do something while a condition is true

c)

To do something only if a condition is true

d)

To repeat something for a fixed number of times

16.

Which general if statement definition is written correctly?

a)

for(condition) {

// code

}

b)

if false {

//code

}

c)

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

//code

}

d)

if(condition) {

//code

}

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

c)

To repeat something while a condition is true

d)

To break out of some block of code

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 timesAnswered To repeat something for a fixed number of times

19.

What do we use control structures for in JavaScript?

a)

Control the flow of the program; how the commands execute.

b)

Start our JavaScript program

c)

Store information for later

d)

Teach Karel new commands

20.

Which of the below are examples of control structures?

(I) if

(II) if/else

(III) while

(IV) for

a)

I only

b)

I and II only

c)

III and I only

d)

I, II, III, and IV

21.

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)

If/Else statement

b)

While Loop

c)

For loop

d)

None of these

22.

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

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)

None of these

23.

You need to write a program that has Karel put down a tennis ball if the world has dimensions of 1x1.

Which control structure do you need to use?

a)

For Loop

b)

While Loop

c)

If Statement

d)

If/Else statement

e)

None of these

24.

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 these

25.

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 these

26.

Why should a programmer indent their code?

a)

Easier for other people to understand

b)

Helps show the structure of the code

c)

Indenting is a key part of good programming style

d)

All of the above