wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Codehs Concepts of Programming

Total questions: 15

Worksheet time: 11mins

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.

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 above

4.

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 above

5.

How can we teach Karel new commands?

a)

For loop

b)

While loop

c)

Define a new function

d)

The start function

6.

How many times is the start function called?

a)

0

b)

1

c)

2

d)

463

7.

How many times is the start function defined?

a)

0

b)

1

c)

2

d)

As many as is needed

8.
Karel
a)
what should be true after the function is called
b)
a dog who listens to your commands
c)
the commands contained within the brackets of a function
d)
the function that is called when you click RUN
9.
Top Down Design
a)
the function that is called when you click RUN
b)
a method for breaking our program down into smaller parts
c)
breaking your program into smaller parts
d)
a note about your code describing what it is doing so others can understand it
10.
Comment
a)
a dog who listens to your commands
b)
breaking your program into smaller parts
c)
a note about your code describing what it is doing so others can understand it
d)
allows you to repeat a section of code a fixed number of times
11.
If Statement
a)
function that returns a true/false answer
b)
lets you ask a question to the program and only run code if the answer is true
c)
control structure that lets us do either one section of code or another depending on a test
d)
allows you to repeat a section of code a fixed number of times
12.
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 above
13.

If Karel is facing South and the following code runs:

turnLeft();

turnLeft();

Which direction is Karel facing now?

a)

North

b)

South

c)

East

d)

West

14.
How many times should Karel turn left in order to turn right?
a)
1
b)
2
c)
3
d)
4
15.

A grid within which Karel lives:

a)
Define A Function
b)
Fencepost Problem
c)
World
d)
Karel