wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Y6 - Programming A - Variables in games

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.
1. Which of these are important features of a variable? Tick all that apply.
a)
Can be set
b)
Is a score
c)
Can be changed
d)
Has a clear name
2.
2. What data types can a variable hold?
a)
Numbers only
b)
Letters only
c)
Numbers or letters
d)
Pictures
3.
3. How many values can a variable hold at any one time?
a)
None
b)
One
c)
Two
d)
As many as you like
4.
4. When a variable is changed, what happens to the value?
a)
It is replaced by a new value
b)
It is joined by the new value
c)
It is added to the new value
5.
5. In a bat and ball game, which of these parts of the game would be stored using a variable? Tick all that apply.
a)
Points scored
b)
Movement of the sprite
c)
Lives lost
d)
Time left
e)
Appearance of the background
6.
6. If you were storing the score of a football match using a computer program, to display to the crowd during the game, which name would be the best choice for the variable that holds the score of the home team?
a)
Home score
b)
Home_score
c)
Football_match_home_team_score
d)
Score
7.
7. Where is the value of a variable usually set?
a)
At the beginning of a program
b)
Throughout the running of a program
c)
At the end of a program
d)
When triggered by an event
8.
8. Which of the following code snippets would create a timer that counts down from 60 seconds to 0?
a)
A
b)
B
c)
C
d)
D
9.
9. The code snippet below controls the movement of a ball in a game in the style of table tennis. The stage is also shown next to the code. The paddle is the green line, which can be moved left and right. When will the score change?
a)
When the ball moves
b)
When the ball touches the paddle
c)
When the green flag is clicked
d)
When the ball hits the edge
10.

10. What do you call a precise sequence of instructions, or set of rules, for performing a task?

a)

Algorithm

b)

Code

c)

Program Flow

d)

Variable