wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Introduction to Programming Review

Total questions: 15

Worksheet time: 15mins

Name
Class
Date
1.

Which of the following commands is a valid Karel command?

a)

move

b)

move;

c)

move();

d)

move()

2.

What makes the following command an invalid Karel command?

turnleft();

a)

It should end in a colon rather than a semicolon

b)

The l should be a capital L

c)

It should start with a capital T

d)

This command is correct

3.

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

a)
b)

c)

d)

4.

Why do we use functions in Karel programs?

a)

Break down our program into smaller parts

b)

Avoid repeating code

c)

Make our program more readable

d)

All of the options

5.

If Karel starts at Street 1 and Avenue 1, facing East, where will Karel be, and what direction will Karel be facing after running the following code? (Assume the world is 10x10 in size)

a)

Street 3, Avenue 1, Facing North

b)

Street 1, Avenue 4, Facing North

c)

Street 1, Avenue 3, Facing South

d)

Street 1, Avenue 3, Facing North

6.

What’s wrong with this code?

a)

The go function is called twice

b)

The go function has a syntax error

c)

The go function has been defined twice

d)

go is not a command that Karel understands

7.

How many total times will Karel move in this program?

(a)  

8.

What does the mystery function do?

a)

Karel moves until it is on a ball

b)

Karel moves once if there is no ball present

c)

Karel moves until it puts down a ball

d)

Karel checks if there is no ball on the current spot and then moves once

9.

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

10.

Why does a programmer indent their code?

a)

Helps show the structure of the code.

b)

Easier for other people to understand.

c)

A key part of good programming style!

d)

All of the options

11.

How can we teach Karel new commands?

a)

For loop

b)

While loop

c)

Define a new function

d)

The start function

12.

Super Karel starts at Street 1, Avenue 1, facing East in a 5x5 world. What will happen after this code runs?

a)

Karel ends on street 1, avenue 3

b)

Karel ends on street 2, avenue 3

c)

This code won’t run because of a syntax error

d)

Karel will crash into a wall

13.

What is the purpose of using a for loop in code?

a)

To do something if a condition is true

b)

To do something while a condition is true

c)

To repeat something a fixed number of times

d)

To make programs run faster

14.

Why do we use if/else statements in JavaScript?

a)

To repeat something for a fixed number of times

b)

To break out of some block of code

c)

To do something if a condition is true and do something else if the condition is false

d)

To repeat something while a condition is true

15.

Which kind of conditional statement would you use to code this:

If the front is clear, Karel should move. Otherwise, Karel should turn around.

a)

if

b)

if, if

c)

if/else