WorksheetsTurtle Graphics in Python
Total questions: 36
Worksheet time: 1hrs 23mins
What is the purpose of the 'window.tracer(0)' command in the turtle graphics code?
To enable auto update of the screen
To disable auto update of the screen
To set the background color
To create a new turtle object
Explain how the 'update_score' function works in the turtle game.
What does the 'sprite.setheading(90)' command do?
Moves the sprite to the right
Moves the sprite to the left
Moves the sprite upwards
Moves the sprite downwards
What is the initial value of the score variable?
How does the game determine if the sprite has collided with the food?
What is the range of coordinates for the food in the turtle game?
-250 to 250
-220 to 220
-200 to 200
-300 to 300
What happens when the sprite touches the wall?
What is the purpose of the 'window.ontimer(update_sprite, 1000 // FPS)' command?
To update the score
To call the update_sprite function at a set interval
To listen for keyboard input
To create a new food object
Describe the role of the 'tails' array in the game.
What does the 'score_sprite.hideturtle()' command do?
Shows the score on the screen
Hides the score display turtle
Resets the score
Changes the score color
What is the function of the 'move_left' function?
How is the score updated when the sprite eats the food?
What does the 'food.goto(random_x, random_y)' command do?
Moves the food to a random position
Resets the food position
Changes the food color
Creates a new food object
What is the purpose of the 'window.listen()' command?
To start the game
To listen for keyboard events
To update the score
To create the window
What happens when the game is over?
What is the shape of the main sprite?
Circle
Square
Triangle
Rectangle
How does the game update the screen?
What is the purpose of the 'score_sprite.goto(0, 220)' command?
What does the 'sprite.forward(5)' command do?
Moves the sprite backward
Moves the sprite forward by 5 units
Rotates the sprite
Stops the sprite
What is the initial state of the 'game_over' flag?
What does the 'sprite.color('black')' command do?
What is the purpose of the 'food.speed(0)' command?
What happens when the sprite collides with the food?
What is the function of the 'update_food' method?
What does the 'window.update()' command do?
What is the purpose of the 'sprite.penup()' command?
What is the role of the 'score' variable in the game?
What does the 'food.shape('circle')' command do?
How does the game handle keyboard input?
What is the purpose of the 'score_sprite.clear()' command?
If we remove sprite.penup(), what will happen?
Change FPS from 30 to 5. What do you observe? How does the feeling of the game change?
What's the output of '1' + 1?
2
11
'11'
Unsupported
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
What's the meaning of tails[0].goto( x, y ) statement?
If the game has no FPS control, what problem might appear?
