wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Variables

Total questions: 10

Worksheet time: 8mins

Name
Class
Date
1.

What are the rules for naming a variable in Python?

a)

Variables in Python can only contain letters, numbers, and underscores. They cannot start with a number and cannot be a Python keyword.

b)

Variables in Python can start with a number

c)

Variables in Python can contain any special characters

d)

Variables in Python can be named after Python keywords

2.

After run the following code, x = -------------

a)

12

b)

2

c)

14

d)

24

3.

If I want to store my height in a variable, which of the following would be a good variable name in best practice?

a)

abcdefg

b)

inches

c)

number

d)

height

4.

How do you declare a variable in Python?

a)

variable_name = value

b)

value = variable_name

c)

variable = value_name

d)

name = variable_value

5.

---------------------- is a reference to a location in memory where the data is stored.

a)

Variable

b)

python

c)

Vakue

d)

Operators

6.

After run the following code, x = -------------

a)

12

b)

15

c)

36

d)

1728

7.

After run the following code , the output will be -----------------

a)

test

b)

exam

c)

testexam

d)

z

8.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
9.
What is the output from the following code?print ("hello world")
a)
Hello World
b)
hello world
c)
print hello world
10.

If I want to store my name in a variable, which of the following would be a good variable name in best practice?

a)

name

b)

teacher

c)

mister

d)

abcdef