wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PY4E chapter 2 quiz

Total questions: 20

Worksheet time: 13mins

Name
Class
Date
1.

What is True of Reserved words in Python? Select all that apply.

a)

You cannot use them as variable names

b)

There are hundreds of reserved words

c)

if, class, def, None, True are examples of reserved words

d)

If you try to use a reserved word as a variable name, you will get an error

e)

Reserved words live in hotels

2.
What is python named after
a)
The snake
b)
Television show called Monty Python
3.

Identify the "good" or acceptable variable names from those below. Select all that apply.

a)

hour_rate

b)

num apples

c)

times_2

d)

3rd_place

e)

#tag

4.

What extension must you add to the end of a python file when saving?

a)

.xlsx

b)

.pptx

c)

.docx

d)

.py

5.

Mneumonic names are (select all that apply)

a)

descriptive of the content of the variable

b)

easy to understand and remember

c)

used to soften the ground, and very noisy

d)

cause a sore throat and a cough

6.

What does the print function do in python?

a)

It's a variable.

b)

It can input data.

c)

It displays an output - like a string or integer

d)

It loops the code.

7.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
8.
Converts a number to a string
a)
str()
b)
int()
c)
parseInt()
d)
convert
9.
Python identifies blocks of code by
a)
BEGIN and END keywords
b)
{ and }
c)
aligning up the starts of lines (indentation)
d)
guessing
10.

This stores a piece of data, and gives it a specific name

a)

variable

b)

whitespace

c)

interpreter

d)

modulo

11.
a data type than can have one of two values: True or False
a)
boolean
b)
variable
c)
modulo
d)
interpreter
12.
The correct way to write a variable in Python?
a)
my_variable = 10
b)
my variable = 10
c)
my_variable is 10
d)
my_variable: 10
13.
Data type for a whole number
a)
String
b)
Integer
c)
Boolean
d)
Float
14.

Tick ALL options that are true of a variable

a)

every variable has a type or class

b)

It is like a box that holds something

c)

It cannot be changed

d)

Python variables use snake_case

e)

Python variables use camelCase

15.

Why do we put a string of text inside the brackets of an input?

a)

The input function can also be used as an output, but only one string at a time.

b)

The input function can also be used as an output, with several strings at a time.

c)

The string of text can be used to instruct the user as to what they must type in.

d)

The string of text is required, to act as a wrapper for the input the user types in; otherwise the data will be invalid string data and go nowhere.

16.

What is the class of the variable x?

x = input("Enter choice: ")

a)

float

b)

int

c)

str

d)

bool

17.

What is the result of the following code:

>>> x = 3

>>> y = 7

>>> y // x

a)

2.0

b)

2.33333333333

c)

2

18.

What is the result of the following code:

>>> x = 3

>>> y = 7

>>> y % x

a)

2.33333

b)

2

c)

1

d)

0.5

19.

What is the result of the following code:

>>> 3 + 2 ** 3 / 4 * 5

a)

13

b)

6.25

c)

0.75

d)

3.4

20.
What does the term 'debug' mean?
a)
Identify errors and fix them.
b)
Making a calculation
c)
A set of instructions
d)
Looking at code