wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Quiz 2 - Python coding

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.
In python the ' STRING data type' can be defined as...?
a)
holds alphanumeric text
b)
hold whole numbers
c)
holds numbers with a decimal point
d)
holds either a true or false value
2.
In python the ' INTEGER data type' can be defined as...?
a)
holds alphanumeric data as text
b)
holds whole numbers
c)
holds numbers with a decimal point
d)
holds either ‘true’ or ‘false’
3.
In python the ' FLOAT data type' can be defined as...?
a)
holds alphanumerical data
b)

holds whole numbers

c)

holds a decimal point in a number

d)
hold either true or false
4.
What is the correct definition for a VARIABLE?
a)
a changeable value, such as a score in a computer game.
b)
a value that cannot be changed
5.
What data type would be used for storing someone's telephone numbers?
a)
Float (using a decimal point)
b)
Integer (just whole numbers)
c)
String (alphanumerical data)
6.
If we needed to store information such as a POSTCODE in PYTHON, what data type would we use?
a)
String (alphanumerical)
b)
Float (decimal point)
c)
Boolean (true or false)
7.

what is the code for a STRING in python?

a)

str

b)

stri

c)

string

8.
what is correct code for INTEGER in python?
a)
in
b)
ing
c)
int
9.
What best defines an IF statement in python?
a)
Is an embedded string with a variable
b)
An IF statement checks to see if a statement is true or false and then does one of two things depending on the result.
10.
I am 71 years old! What will the output be?: IF you are 70 or older, say “You are aged to perfection!” ELIF you are exactly 50, say “Wow, you are half a century old!” ELSE say “You are a spring chicken!”
a)
“You are aged to perfection!”
b)
"Wow, you are half a century old!"
c)
"You are a spring chicken!"
11.
I am 18 years old! What will the output be?: IF you are 70 or older, say “You are aged to perfection!” ELIF you are exactly 50, say “Wow, you are half a century old!” ELSE say “You are a spring chicken!”
a)
"You are aged to perfection"
b)
"Wow, you are half a century old!"
c)
"You are spring chicken!"
12.
Stores a piece of data, and gives it a specific name
a)
variable
b)
whitespace
c)
interpreter
d)
modulus
13.
Surrounds multi-line comments
a)
"""
b)
**
c)
#
d)
%
14.
A data type than can have one of two values: True or False
a)
boolean
b)
variable
c)
modulus
d)
interpreter
15.

What does this code do?

print("Hello world!")

a)

Displays 'Hello world!' in the shell window.

b)

Sends 'Hello world!' to the printer.

c)

Waits for the user to type in 'Hello world!'

d)

Displays 'hello, world.' in the shell window.

16.

What symbol do you type in to add a short comment?

a)

"""

b)

#

c)

@

d)

/

17.

True or False:

phone.number is a good name for a variable.

a)

True

b)

False

18.

What does this function do?

input()

a)

Opens the CD tray.

b)

Asks the user to type something in.

c)

Displays the word 'input'.

d)

Exits the program.

19.

What is a variable?

a)

A number such as 25.

b)

Plus, minus, multiply, divide or equals.

c)

An array of text.

d)

A storage location in the program which stores a value.

20.

Gjdk is not a good name for a variable, why?

a)

It starts with a capital letter.

b)

It does not contain any spaces.

c)

There are no vowels.

d)

It's meaningless.