wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

CodeHS Python(Tracy) Quiz Review

Total questions: 16

Worksheet time: 8mins

Name
Class
Date
1.

When was the following for loop is complete, how many spaces will Tracy have moved?

a)

50 spaces

b)

60 spaces

c)

10 spaces

d)

5 spaces

2.

You need to use a function in your code, how many times can you CALL a function in your code?

a)

Only one time

b)

Not more than the number of commands the function holds

c)

It depends on the function.

d)

As many times as you want.

3.

In which of the following situations would it be best to make a function?

a)

You need to change Tracy's color

b)

You want Tracy to draw a blue line, and your program requires lots of blue lines.

c)

You need Tracy to move forward by 100

d)

You need Tracy to turn right and then turn left.

4.

Which of the following pieces of code will make Tracy do the following actions three times: go forward, change colors, and then turn around.

a)

b)

c)

for i in range(3): backward(30) color("blue")

left(180)

d)

forward(30) color("blue")

left(180)

forward(30) color("green")

left(180)

forward(30) color("orange")

left(180)

5.

Which of the following is NOT a command you can give to Tracy?

a)

color

b)

turn

c)

backward

d)

left

6.

Which of the statements below is true about indentation in Python?

a)

Indentation only matters in for loops. Then, everything must be indented one level.

b)

Indentation never matters in Python. You can align your code any way you like, but indentation makes your code easier to read.

c)

Indentation always matters in Python. Every statement must be aligned correctly.

d)

Indentation only matters in functions. Then, everything must be indented one level.

7.

Which of the following statements are true about for loops?

A. By default, the range function starts at 0
B. Using for i in range(4) will result in i taking the values 0, 1, 2, 3, 4
C. For loops let you repeat something any number of times
D. Statements in a for loop do not need to be indented
E. It is not possible to have the range values count 6, 12, 18, 24
F. It is not possible to have the range values count 1, 2, 4, 8, 16

a)

A, C, and F

b)


A, B, C, and F

c)


A, B, C, E, and F

d)

A and C

8.

Which of the following functions is defined correctly?

a)

b)

c)

d)

9.

Which of the following is NOT a purpose of functions?

a)

Functions allow programmers to use more descriptive names in programs.

b)

Functions help group statements together to make code more readable.

c)


Functions help programmers repeat commands a fixed number of times.

d)

Functions allow programmers to reuse code.

10.

What is the difference between defining and calling a function?

a)

Defining a function means you are teaching the computer a new word. Calling a function means you are commanding the computer to complete defined actions.

b)

There is no difference.

c)

Calling a function means you are teaching the computer a new word. Defining a function means you are commanding the computer to complete defined actions.

d)

Defining a function must be done each time you want to use the function. Calling a function can only happen once in your code.

11.

What does the number in the parentheses in a forward or backward command represent?

forward(30)

a)

How many degrees Tracy is supposed to turn

b)

How fast Tracy is supposed to move

c)

How many times Tracy should repeat the command

d)

How far Tracy is supposed to move

12.

What control structure would be best to use in the following code?

a)

A function

b)


A while loop

c)

A for loop

d)

An if/else statement

13.

Which of the following commands can be used to turn Tracy to face North if she is initially facing South?

a)

left(90)
right(90)

b)

right(180)

c)

right(90)
left(180)

d)

left(360)

14.

What shape will be drawn with the following command?
circle(50, 360, 3)

a)

A circle

b)

A hexagon

c)

A triangle

d)


A diamond

15.

How can we use variable to control the size of a circle?

a)

radius = circle(50)

b)

circle(radius)
radius = 50

c)

radius = 50
circle(50)

d)

radius = 50
circle(radius)

16.

What will be the radii of the circles drawn from the following code?

a)

10, 20, 30, 40, 50

b)

10, 15, 20, 25, 30, 35, 40, 45, 50, 55

c)

10, 55, 10

d)


10, 20, 30, 40, 50, 55