wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Codehs

Total questions: 49

Worksheet time: 27mins

Name
Class
Date
1.

How would I tell Tracy to move forward 100 pixels?

a)

forward 100

b)

move(100)

c)

Tracy, move forward 100 pixels

d)

forward(100)

2.

When using the circle() command, what value do we put inside the parentheses?

a)

The radius of the circle

b)

The center of the circle

c)

The diameter of the circle

d)

The width of the circle

3.

When Tracy is facing right, from what location does she start drawing her circle?

a)

The top of the circle

b)

The bottom of the circle

c)

The left side of the circle

d)

The middle of the circle

4.

Where does Tracy always start in the grid world?

a)

At the (0,0) coordinate in the bottom left hand corner of the canvas

b)

At the (-200,-200) coordinate in the bottom left hand corner of the canvas

c)

At the (0,0) coordinate in the middle of the canvas

d)

At the (-200,-200) coordinate in the middle of the canvas

5.

What are the dimensions of Tracy’s world?

a)

200 pixels x 200 pixels

b)

400 pixels x 200 pixels

c)

400 pixels x 400 pixels

d)

200 pixels x 400 pixels

6.

Which commands would move Tracy forward 100 pixels?

A. forward(100)

B. backward(-100)

C. forward(-100)

a)

A, B, and C

b)

A only

c)

B and C

d)

A and B

7.

How far does Tracy need to move from the starting position to reach the end of the right side of the canvas?

a)

50 pixels

b)

100 pixels

c)

200 pixels

d)

400 pixels

8.

If you want Tracy to move forward 100 pixels without making a line, what set of commands should you write?

a)

penup() forward(100)

b)

forward(100) penup()

c)

penup(100)

d)

forward(-100)

9.

Tracy always starts facing which direction?

a)

North

b)

South

c)

East

d)

West

10.

If Tracy is facing right, which of the following commands can be used to turn her to face up?

A. left(90)

B. turn(up)

C. right(270)

D. setposition(90)

a)

A only

b)

A and C

c)

A, B, and C

d)

A, B, C, and D

11.

If Tracy started facing right, which direction would she be facing after we ran the following code?

a)

Up

b)

Down

c)

Right

d)

Left

12.

Which of the following is NOT a reason for loops are useful when writing code?

a)

Loops help us write the same program with fewer lines of code

b)

Loops let us make shapes of multiple sizes

c)

Loops make it easier to alter code once it’s written

d)

Loops make our code easier to read

13.

The following loop draws 3 circles on the screen. If I wanted to alter this loop to draw 10 circles, how many lines would my code be?

a)

1 line

b)

3 lines

c)

10 lines

d)

30 kines

14.

If Tracy starts at the left edge of the canvas and moves forward 50 pixels, how many times will this code need to be repeated to have Tracy reach the right edge of the canvas?

a)

4 times

b)

8 times

c)

10 times

d)

50 times

15.

Which lines of the code below will be repeated 4 times?

a)

3 and 4

b)

2, 3, and 4

c)

3, 4, and 5

d)

3, 4, 5, and 6

16.

Why do certain words change color in Python?

a)

To show that they are recognized as keywords

b)

To tell you that these words cannot be used in Python code

c)

To show you that these words can be clicked

d)

To tell Python to skip these words when running the code

17.

If I use the command right(180), which way will Tracy turn?

a)

She will turn in a circle

b)

She will turn around

c)

She will turn to face up

d)

She will turn to face left

18.

The setposition() command moves Tracy to a coordinate and:

a)

turns her to face left

b)

does not turn her

c)

turns her to face up

d)

turns her to face down

19.

If you wanted Tracy to complete her command immediately, which speed value would you use?

a)

0

b)

1

c)

5

d)

10

20.

If you want three circles to be drawn next to each other (as seen in the image below), after drawing the first circle, how far would you need to move Tracy before drawing the next circle?

a)

100 pixels

b)

50 pixels

c)

The circle’s radius

d)

The circle’s diameter

21.

Comments are:

a)

Written for humans to read and understand

b)

Only needed when a program is over 50 lines

c)

Commands performed by the computer

d)

Always blue when Python recognizes them

22.

What symbol is used at the beginning of an in-line comment?

a)

"

b)

!

c)

#

d)

:

23.

What punctuation is needed to begin a multi-line comment?

a)

#

b)

"

c)

" " "

d)

*

24.

Which of the names below follow all naming rules?

a)

my_function

b)

Draw a Circle

c)

4_circles

d)

make_square

25.

If I am creating a function that is going to draw 2 squares, which of the following would be the best name option?

a)

Draw_Two_Squares

b)

draw_squares

c)

draw_shapes

d)

2_squares

26.

Which of the following is NOT a way functions make our code more readable?

a)

Function names can describe what the function is completing

b)

Functions break our code into smaller, separate parts

c)

Each function only contains one command

d)

Functions shorten our code by reusing code that has already been written

27.

What two things must be included in your function definition?

a)

A function name and commands to be performed

b)

Function variables and commands to be performed

c)

Commands to be performed and function arguments

d)

A function name and function variables

28.

Which is the proper way to call the function three_circles?

a)

def three_circles:

b)

three_circles():

c)

def three_circles():

d)

three_circles()

29.

How would I change Tracy’s trail to a yellow line with a thickness of 10 pixels?

a)

Color(Yellow) thickness(10)

b)

color(“yellow”) pensize(10)

c)

color yellow() pensize(10)

d)

color yellow(): pensize(10)

30.

What is true of Tracy’s color command?

a)

You can only use hex color codes

b)

There are 10 different colors that Tracy knows

c)

The color name must have underscores between words (ex: light_blue)

d)

The color name must be in quotation marks

31.

What is the correct way to draw a circle that is filled in?

a)

begin_fill() circle(20)

end_fill()

b)

circle(20) begin_fill() end_fill()

c)

circle(begin_fill, 20, end_fill)

d)

circle(20)

end_fill()

32.

What would be the output of the following command?

circle(50,360,5)

a)

b)

c)

d)

33.

What would be the output of the following command?

circle(50,180,3)

a)

b)

c)

d)

34.

Top Down Design makes it easier to solve a problem by:

a)

Breaking the problem down into smaller parts

b)

Starting your code from the first command

c)

Starting with the biggest function and then moving to smaller ones

d)

Making each function hold only one command

35.

Which of the following is NOT an example of using Top Down Design?

a)

Breaking a large code up into functions

b)

Writing code for one part of a function before tackling the whole thing

c)

Using descriptive names for variables

d)

Separating a large problems into smaller ones

36.

Variables allow us to:

a)

Name different parts of our programs

b)

Use english words to communicate with Tracy

c)

Store information to use in our programs

d)

Change the words Tracy recognizes

37.

Which program will have Tracy move forward 10, then turn left and move forward 20?

a)

distance = 10 forward(distance) left(90) distance = distance * 2 forward(distance)

b)

distance = 10 forward(distance) left(90) forward(distance)

c)

distance = 10 distance=

distance*2 forward(distance) left(90) forward(distance)

d)

distance = 10 forward(distance) left(90) forward(distance) distance = distance * 2

38.

Which of the following programs would produce this output?

a)

square_length = 20 for i in range(4): forward(square_length) left(90) square_length = square_length * 2

b)

square_length = 20 for i in range(4): for i in range(4): forward(square_length) left(90) square_length = square_length * 2

c)

square_length = 20 for i in range(4): forward(square_length) left(90) square_length = square_length * 2

d)

square_length = 20 for i in range(4): for i in range(4): forward(square_length) left(90) square_length = square_length * 2

39.

How would I collect a number from the user to use for the radius of a circle?

a)

int(input("What is the radius?: "))

b)

radius = int("What is the radius?: ")

c)

radius = int(input("What is the radius?: "))

d)

radius = int input("What is the radius?: ")

40.

What is the correct way to ask a user for a color and store the answer as a variable?

a)

color = input("Give a color: ")

b)

user_color = "Give a color: "

c)

input("Give a color: ")

d)

user_color = input("Give a color: ")

41.

The name color cannot be used for our variable because:

a)

Variable names cannot only be 1 word

b)

The word color is already used as a Tracy command

c)

The word color needs to be capitalized to be used as a variable name

d)

Variable names must include underscores

42.

Why are parameters useful?

a)

They allow us to tailor functions to be used in multiple situations

b)

They allow us to change the order of commands in a function

c)

They give us the ability to use variables in loops

d)

They allow the user to give input

43.

How many parameters can we use in each function?

a)

1

b)

2

c)

4

d)

As many as needed

44.

What is the best way to write a program that uses parameters to draw a square with sides that are 50 pixels long?

a)
b)
c)
d)
45.

What is the default starting value of i in a for loop?

a)

0

b)

1

c)

2

d)

10

46.

What will the values of i be at each iteration of the loop below?

a)

1, 2, 3

b)

0, 1, 2, 3

c)

0, 1, 2

d)

2, 3

47.

What will happen when the value of i reaches 5 in the loop below?

a)

Tracy will turn 5 degrees to the right

b)

Tracy will turn 5 degrees to the left

c)

Tracy will turn 90 degrees to the right

d)

Tracy will turn 90 degrees to the left

48.

What will the values of i be at each iteration of the loop below?

for i in range(2, 10, 2):

a)

0, 2, 4, 6, 8

b)

2, 3, 4, 5, 6, 7, 8, 9

c)

2, 4, 6, 8

d)

2, 4, 6, 8, 10

49.

What will be the output of the code below?

penup()

backward(150)

for i in range(10, 50 ,10):

forward(i * 2)

pendown()

circle(i)

penup()

a)

b)

c)

d)