wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Codehs - Python

Total questions: 25

Worksheet time: 18mins

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.

Tracy always starts facing which direction?

a)

Up

b)

Down

c)

Right

d)

Left

8.

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

D. setposition(90)

a)

A only

b)

A and C

c)

A, B, and C

d)

A, B, C, and D

9.

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

a)

Up

b)

Down

c)

Left

d)

Right

10.

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

11.

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

b)

8

c)

10

d)

50

12.

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

a)

She will turn in a full circle

b)

She will turn and face the opposite direction

c)

She will turn to face up

d)

She will turn to face down

13.

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

a)

0

b)

1

c)

5

d)

10

14.

Which of the statement are NOT true about comments:

a)

Written in English for humans to read and understand

b)

Helps other programmers understand your code

c)

Helps keep the programmer organized

d)

Only needed when a program is over 50 lines

15.

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

a)

"

b)

!

c)

#

d)

/

16.

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

a)

$

b)

"""

c)

*

d)

/

17.

Which of the names below follow all naming rules?

a)

my_function

b)

Draw a line

c)

4_circles

d)

make_squares

18.

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

19.

What 3 letters are used at the beginning when defining a function?

a)

fun

b)

def

c)

for

d)

sub

20.

Which is the proper way to call the function three_circles?

a)

def three_circles()

b)

three_circles()

c)

run three_circles()

d)

for three_circles()

21.

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)

22.

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)

23.

What would be the output of the following command?

circle(50,360,5)

a)
b)
c)
d)
24.

What would be the output of the following command?

circle(50,180,3)

a)
b)
c)
d)
25.

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