wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

python-2

Total questions: 23

Worksheet time: 23mins

Name
Class
Date
1.
The number or word we give to a variable
a)
Value
b)
Bug
c)
Information
d)
Text
2.

What is the Python built-in function used to display numbers and text on the screen?

a)

print

b)

input

c)

output

d)

command

3.
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
4.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
5.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
6.

If you want to create an empty list called colours in Python, which of the following is correct?

a)

colours = [ ]

b)

colours = ( )

c)

colours = { }

d)

colours = <>

7.
What letter will be printed on the screen after running this code:
a)
e
b)
x
c)
t
d)
Nothing prints
8.
What is the position of the name "Robert" in the following list:
a)
0
b)
1
c)
2
d)
3
9.
What does the APPEND procedure do in the following code:
a)
Adds Liverpool to the beginning of the list
b)
Replaces Bristol with Liverpool
c)
Replaces Manchester with Liverpool
d)
Adds Liverpool to the end of the list
10.
In the following code, "city" is an example of a what?
a)
List
b)
Loop
c)
Variable
d)
Array
11.

Each item in a list has an index. What is the first index in a Python list?

a)

0

b)

1

c)

a

d)

A

12.
What output will this code produce?
a)
4
b)
2
c)
3
d)
5
13.
What output will this code produce?
a)
3
b)
20
c)
25
d)
17
14.
What output will this code produce?
a)
1
b)
3
c)
2
d)
4
15.

What will the output be from the following code?

print(3+4)

a)

3+4

b)

7

c)

SyntaxError

d)

print(3+4)

16.
print("12"*3)
What would this print?
a)
36
b)
121212
c)
24
d)
12*3
17.

What will the output be from the following Python code?

Print("Hello world!")

a)

NameError

b)

Hello world!

c)

"Hello world"

d)

Print(Hello world!)

18.

What will the output be from the following Python code?

print(9/3)

a)

3

b)

3.0

c)

9/3

d)

SyntaxError

19.

What will the output be from the following Python code?

print(Hello world!)

a)

Hello world!

b)

SyntaxError

c)

Hello world

d)

print(Hello world!)

20.
A location in memory used to store data that can be changed.
a)
Constant
b)
Value
c)
Variable
d)
Iteration
21.

What is the Python built-in function to converts a number to a string?

a)

str()

b)

int()

c)

parseInt()

d)

convert

22.
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
23.

Which of these is correct Python conditional statement?

a)

IF answer == "Yes":

b)

if answer == "Yes"

c)

if answer == "Yes":

d)

if answer = "yes":