wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CodeHS Unit 1-6

Total questions: 12

Worksheet time: 6mins

Name
Class
Date
1.
What is a condition in Karel programming?
a)
What karel does during the program.
b)
A method that returns a true or false answer. Typically used within a control structure.
c)
The number of times a program loops.
d)
The place in code where the program stops running.
2.
How can we teach Karel new commands?
a)
Define a new method
b)
A for loop
c)
A while loop
d)
The run method
3.
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
4.
Which of these is a valid Karel command in Java?
a)
MOVE
b)
move();
c)
move()
d)
move;
5.
Which of these is a valid Karel command in Java?
a)
turnLeft();
b)
turnleft();
c)
turnLeft()
d)
TurnLeft
6.
What is the name of the method that gets called to start a Java Karel program?
a)
move()
b)
run()
c)
start()
d)
go()
7.
Which is the correct class signature for a Karel program named CleanupKarel?
a)
CleanupKarel extends Karel
b)
public CleanupKarel
c)
public class CleanupKarel < Karel
d)
public class CleanupKarel extends Karel
8.
What is a method in Karel?
a)
A method is the name for an entire Java program
b)
A method is something that lets you repeat a command a fixed number of times
c)
A method is a command that Karel can do. It has a name and a set of instructions.
d)
A method is the way that you leave a note for someone else who reads the code.
9.
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 of designing your programs starting with the individual commands first
c)
Top down design is a way that you can create designs on a computer to put on a web page
d)
Top down design is a way to use loops and classes to decompose the problem
10.
If Karel is not on a tennis ball, and all directions around are clear, what will happen when running this code?
a)
Karel will not do anything
b)
Karel will go into an infinite loop
c)
Karel will put down a tennis ball
d)
Karel will turn left once
11.
Say you want to write a program to have Karel put down 300 tennis balls. Which control structure would you use?
a)
A nested while loop
b)
A while loop
c)
A for loop
d)
An if statement
12.
Say you want to write a program to have Karel to pick up all of the tennis balls in a location, but you don’t know how many tennis balls there are. Which control structure would you use?
a)
An if/else statement
b)
A while loop
c)
A for loop
d)
An if statement