Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Turtle Graphics in Python

Total questions: 36

Worksheet time: 1hrs 23mins

Name
Class
Date
1.

What is the purpose of the 'window.tracer(0)' command in the turtle graphics code?

a)

To enable auto update of the screen

b)

To disable auto update of the screen

c)

To set the background color

d)

To create a new turtle object

2.

Explain how the 'update_score' function works in the turtle game.

4 lines
3.

What does the 'sprite.setheading(90)' command do?

a)

Moves the sprite to the right

b)

Moves the sprite to the left

c)

Moves the sprite upwards

d)

Moves the sprite downwards

4.

What is the initial value of the score variable?

4 lines
5.

How does the game determine if the sprite has collided with the food?

4 lines
6.

What is the range of coordinates for the food in the turtle game?

a)

-250 to 250

b)

-220 to 220

c)

-200 to 200

d)

-300 to 300

7.

What happens when the sprite touches the wall?

4 lines
8.

What is the purpose of the 'window.ontimer(update_sprite, 1000 // FPS)' command?

a)

To update the score

b)

To call the update_sprite function at a set interval

c)

To listen for keyboard input

d)

To create a new food object

9.

Describe the role of the 'tails' array in the game.

4 lines
10.

What does the 'score_sprite.hideturtle()' command do?

a)

Shows the score on the screen

b)

Hides the score display turtle

c)

Resets the score

d)

Changes the score color

11.

What is the function of the 'move_left' function?

4 lines
12.

How is the score updated when the sprite eats the food?

4 lines
13.

What does the 'food.goto(random_x, random_y)' command do?

a)

Moves the food to a random position

b)

Resets the food position

c)

Changes the food color

d)

Creates a new food object

14.

What is the purpose of the 'window.listen()' command?

a)

To start the game

b)

To listen for keyboard events

c)

To update the score

d)

To create the window

15.

What happens when the game is over?

4 lines
16.

What is the shape of the main sprite?

a)

Circle

b)

Square

c)

Triangle

d)

Rectangle

17.

How does the game update the screen?

4 lines
18.

What is the purpose of the 'score_sprite.goto(0, 220)' command?

4 lines
19.

What does the 'sprite.forward(5)' command do?

a)

Moves the sprite backward

b)

Moves the sprite forward by 5 units

c)

Rotates the sprite

d)

Stops the sprite

20.

What is the initial state of the 'game_over' flag?

4 lines
21.

What does the 'sprite.color('black')' command do?

4 lines
22.

What is the purpose of the 'food.speed(0)' command?

4 lines
23.

What happens when the sprite collides with the food?

4 lines
24.

What is the function of the 'update_food' method?

4 lines
25.

What does the 'window.update()' command do?

4 lines
26.

What is the purpose of the 'sprite.penup()' command?

4 lines
27.

What is the role of the 'score' variable in the game?

4 lines
28.

What does the 'food.shape('circle')' command do?

4 lines
29.

How does the game handle keyboard input?

4 lines
30.

What is the purpose of the 'score_sprite.clear()' command?

4 lines
31.

If we remove sprite.penup(), what will happen?

4 lines
32.

Change FPS from 30 to 5. What do you observe? How does the feeling of the game change?

4 lines
33.

What's the output of '1' + 1?

a)

2

b)

11

c)

'11'

d)

Unsupported

34.

What's the meaning of following statement? What's the allowed value of x and y?
if (x > 240 or x < -240 or y > 240 or y < -240):
game_over = True

4 lines
35.

What's the meaning of tails[0].goto( x, y ) statement?

4 lines
36.

If the game has no FPS control, what problem might appear?

4 lines