NEW
Font size
WorksheetsQuiz on Variables
Total questions: 25
Worksheet time: 13mins
What is a variable?
A) A special character in coding
B) A place to store information in a program
C) A type of animal in a game
D) A method of deleting data
What type of data can a variable store?
A) Only numbers
B) Only text
C) Numbers, text, or True/False values
D) Only images
Which of these is an example of a variable in a game?
A) The colour of the background
B) The game’s music
C) The player’s score
D) The game’s graphics
Which of the following is a valid variable name?
A) 1stPlayer
B) player name
C) playerScore
D) player-name
In Python, how would you declare a variable to store a player’s name?
A) set playerName = "Alice"
B) playerName: "Alice"
C) playerName = "Alice"
D) name.player = "Alice"
What does the code age = input("Enter your age: ") do?
A) Displays your age on the screen
B) Stores the user’s input as the variable age
C) Changes the user’s age
D) Deletes the user’s age
Which of these can change throughout a program?
A) A constant
B) A variable
C) A command
D) A function
What type of variable is isRaining = False?
A) Number
B) Text
C) Boolean
D) Decimal
If score = 15 changes to score = 25, what happens to the value of score?
It remains at 15
It updates to 25
It doubles to 50
It resets to 0
Which of the following is NOT a type of variable?
Boolean
Text
Number
Image
True or False: A variable name can contain spaces.
True
False
Which of the following is a Boolean value?
"Yes"
100
True
3.14
What happens if you forget to declare a variable before using it?
The program runs smoothly
The program might not work correctly
The program automatically creates the variable
It turns the variable into a constant
What is the purpose of using variables in a game?
To change the colour of the game
To store player data like score and lives
To delete levels from the game
To reset the game every time
Which of the following can a variable NOT store?
Numbers
Sentences
Sound effects
True/False values
A variable can store both numbers and text.
True
False
In coding, once a variable is set, it can never change.
True
False
The name of a variable can start with a number.
True
False
Boolean variables can only store True or False values.
True
False
You can add a text variable to a number variable without any issues.
True
False
Variables are used to remember information in programs like games and apps.
True
False
The command name = "Alice" stores the word "Alice" in a variable called name.
True
False
You must always declare a variable before you use it in coding.
True
False
The variable playerScore is different from PlayerScore.
True
False
Variables are only used in games and nowhere else.
True
False
