wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Quiz

Total questions: 50

Worksheet time: 25mins

Name
Class
Date
1.
What letter will be printed on the screen after running this code:
a)
e
b)
x
c)
t
d)
Nothing prints
2.
Surrounds multi-line comments
a)
"""
b)
**
c)
#
d)
%
3.
A line of text that Python won't try to run as code
a)
comment
b)
modulus
c)
variable
d)
boolean
4.
Symbol used for modulus
a)
%
b)
&
c)
#
d)
**
5.
A data type than can have one of two values: True or False
a)
boolean
b)
variable
c)
modulus
d)
interpreter
6.
Used to make comments
a)
#
b)
%
c)
**
d)
()
7.
The correct way to write a variable in Python?
a)
myVariable = 10
b)
my Variable = 10
c)
myVariable is 10
d)
myVariable: 10
8.
10= 100
Which of the following is used in Python to calculate ten squared?
a)
10 ** 2
b)
10 * 2
c)
10 % 2
d)
10 ** 10
9.
A data type consisting of numbers, letters and symbols.
a)
String
b)
Integer
c)
Float
d)
Boolean
10.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
11.
What will the output be from the following code?
print(3+4)
a)
3+4
b)
7
c)
SyntaxError
d)
print(3+4)
12.
What will the output be from the following code?
print("3+4")
a)
7
b)
3+4
c)
34
d)
SyntaxError
13.
What will the output be from the following code?
print("Hello" + "world!")
a)
Hello world!
b)
Helloworld!
c)
SyntaxError
d)
"Hello" "world!"
14.
What is the position of the name "Robert" in the following list:
a)
0
b)
1
c)
2
d)
3
15.
In the following code, "city" is an example of a what?
a)
List
b)
Loop
c)
Variable
d)
Array
16.
Each item in a list has an "address" or index. The first index in a Python list is what?
a)
0
b)
1
c)
a
d)
A
17.
What output will this code produce?
a)
['France', 'Wales', 'England']
France
b)
['France', 'Wales', 'England']
Wales
c)
France, Wales, England
Wales
d)
France  Wales  England
France
18.
What output will this code produce?
a)
['France', 'Wales', 'England']
Ireland
b)
['France', 'Ireland', 'England']
c)
['France', 'Ireland', 'Wales', 'England']
d)
['Ireland', 'Wales', 'England']
19.
What output will this code produce?
a)
Exeter
b)
4
c)
6
d)
city
20.
What output will this code produce?
a)
4
b)
2
c)
3
d)
5
21.
What output will this code produce?
a)
1
b)
3
c)
2
d)
4
22.
What output will this code produce?
a)
blue
b)
green
c)
red
d)
error
23.
What output will this code produce?
a)
['Bristol', 'Exeter', 'London', 'Manchester']
b)
['Manchester', 
'London',  'Exeter', 'Bristol']
c)
['Manchester', 
'Bristol', 'Exeter', 'London',  ]
d)
['London',  'Exeter', 'Bristol', 'Manchester']
24.

Why do we learn Python?

a)

It's a really big snake

b)

It's the name of a very funny comedy show

c)

It's simple and easy to learn

d)

It's so rare that no one else knows it

25.
print("12"*3)
What would this print?
a)
36
b)
121212
c)
24
d)
12*3
26.
What is python named after
a)
The snake
b)
Television show called Monty Python
27.

What is the name of the Windows environment in Python that lets you write your programs and then test them out?

a)

Shell

b)

Window

c)

IDLE

d)

CLI

28.
What does the print function do in python?
a)
It's a variable.
b)
It can input data.
c)
It displays something like a string or integer
d)
It loops the code.
29.
What will be the output?
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
30.
A location in memory used to store data that can be changed.
a)
Constant
b)
Value
c)
Variable
d)
Iteration
31.
The following variable contains some data. What is the data type that is being stored.
hobby = "football" 
a)
Integer
b)
Float
c)
String (Text)
32.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
33.
What will the output be from the following code?
print("3*4+5")
a)
SyntaxErrror
b)
17
c)
3*4+5
d)
12
34.
What will the following lines of code print?
a)
A
b)
B C
c)
A B C
d)
Nothing, it will return an error.
35.
Which statement will check to see if a is equal to b?
a)
if a == b
b)
if a = b:
c)
if a != b:
d)
if a == b:
36.
a)
5
4
3
2
1
b)
4
3
2
1
0
c)
5  4  3  2  1
d)
4  3  2  1  0
37.
What will the output be from the following code?
print("Hello world!\nHello world!")
a)
Hello world! Hello world!
b)
Hello world!
Hello world!
c)
SyntaxError
d)
Hello world!
38.

people = ["John", "Rob", "Bob"]

print (people[1])

what would this result be?

a)
John
b)
Rob
c)
Bob
39.
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
40.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
41.

Select all examples of iteration

a)

FOR loop

b)

WHILE loop

c)

START loop

d)

REPEAT loop

42.

What is the process of identifying and fixing errors in your code?

a)

Rebugging

b)

Syntax Solving

c)

Debugging

d)

Abstraction

43.

What can be used to create a line break in printed text?

a)

\N

b)

\\n

c)

/n

d)

\n

44.
What is the name of the programming language we are learning?
a)
Scratch
b)
Python
c)
Pie thin
d)
Scribble
45.
What would print (10 + 16) produce?
a)
20
b)
22
c)
24
d)
26
46.
What is python?
a)
a programming language 
b)
DTP software 
c)
Spreadsheet software
d)
Computer 
47.
What is syntax?
a)
Syntax is the word used to describe an error
b)
Syntax is the rules of the programming language
c)
It is used to read information
d)
It is used to output information 
48.

The code that loops must be ____________________________

a)

in parenthesis

b)

in brackets

c)

in a circle

d)

indented

49.

What is the output of the code below?

x = 5

if x == 0:

print("x is 0")

elif x > 1:

print("x is greater than 1")

elif x > 3:

print("x is greater than 3")

a)

x is 0

b)

x is greater than 1

c)

x is greater than 3

50.

What is called when a function is defined inside a class?

a)

Module

b)

Class

c)

Another Function

d)

Method