wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Quiz on Variables

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

What is a variable?

a)

A) A special character in coding

b)

B) A place to store information in a program

c)

C) A type of animal in a game

d)

D) A method of deleting data

2.

What type of data can a variable store?

a)

A) Only numbers

b)

B) Only text

c)

C) Numbers, text, or True/False values

d)

D) Only images

3.

Which of these is an example of a variable in a game?

a)

A) The colour of the background

b)

B) The game’s music

c)

C) The player’s score

d)

D) The game’s graphics

4.

Which of the following is a valid variable name?

a)

A) 1stPlayer

b)

B) player name

c)

C) playerScore

d)

D) player-name

5.

In Python, how would you declare a variable to store a player’s name?

a)

A) set playerName = "Alice"

b)

B) playerName: "Alice"

c)

C) playerName = "Alice"

d)

D) name.player = "Alice"

6.

What does the code age = input("Enter your age: ") do?

a)

A) Displays your age on the screen

b)

B) Stores the user’s input as the variable age

c)

C) Changes the user’s age

d)

D) Deletes the user’s age

7.

Which of these can change throughout a program?

a)

A) A constant

b)

B) A variable

c)

C) A command

d)

D) A function

8.

What type of variable is isRaining = False?

a)

A) Number

b)

B) Text

c)

C) Boolean

d)

D) Decimal

9.

If score = 15 changes to score = 25, what happens to the value of score?

a)

It remains at 15

b)

It updates to 25

c)

It doubles to 50

d)

It resets to 0

10.

Which of the following is NOT a type of variable?

a)

Boolean

b)

Text

c)

Number

d)

Image

11.

True or False: A variable name can contain spaces.

a)

True

b)

False

12.

Which of the following is a Boolean value?

a)

"Yes"

b)

100

c)

True

d)

3.14

13.

What happens if you forget to declare a variable before using it?

a)

The program runs smoothly

b)

The program might not work correctly

c)

The program automatically creates the variable

d)

It turns the variable into a constant

14.

What is the purpose of using variables in a game?

a)

To change the colour of the game

b)

To store player data like score and lives

c)

To delete levels from the game

d)

To reset the game every time

15.

Which of the following can a variable NOT store?

a)

Numbers

b)

Sentences

c)

Sound effects

d)

True/False values

16.

A variable can store both numbers and text.

a)

True

b)

False

17.

In coding, once a variable is set, it can never change.

a)

True

b)

False

18.

The name of a variable can start with a number.

a)

True

b)

False

19.

Boolean variables can only store True or False values.

a)

True

b)

False

20.

You can add a text variable to a number variable without any issues.

a)

True

b)

False

21.

Variables are used to remember information in programs like games and apps.

a)

True

b)

False

22.

The command name = "Alice" stores the word "Alice" in a variable called name.

a)

True

b)

False

23.

You must always declare a variable before you use it in coding.

a)

True

b)

False

24.

The variable playerScore is different from PlayerScore.

a)

True

b)

False

25.

Variables are only used in games and nowhere else.

a)

True

b)

False