wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Quiz

Total questions: 20

Worksheet time: 8mins

Name
Class
Date
1.
What is Python?
a)
text based programming language
b)
word processor 
c)
spreadsheet
d)
block based programming language
2.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
3.
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
4.
What symbol do you use to make a comment in Python?
a)
@
b)

:

c)
;
d)
#
5.
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.
6.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

7.
What will the output be from the following code?
print(3*4+5)
a)
27
b)
17
c)
12
d)
SyntaxError
8.
What Python command lets the user enter an answer to a question?
a)
answer()
b)
open()
c)
print()
d)
input()
9.

x = 5

print(x == 2)

a)

True

b)

0

c)

2

d)

False

10.
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
11.

What output will be printed, if 15 and 30 are entered by the user?

a)

Syntax error

b)

The sum of the two numbers - 45

c)

The concatenation of the two numbers - 1530

12.

What result will be displayed if 15 and 20 is entered by the user?

a)

"num1 + num2"

b)

1520

c)

35

13.

What datatype will the answer be if the user enters 15 and 30?

a)

Integer

b)

String

c)

Boolean

d)

Float

14.

for i in range(1,5):

print(i)

a)

1234

b)

1

2

3

4

c)

Indentation Error

15.

What is the output of this code?

a)

0

1

2

3

4

5

6

7

8

9

b)

0123456789

c)

10

d)

Syntax Error

16.

Which of the following is a list?

a)

[1, 2, 3, 4]

b)

(1, 2, 3, 4)

c)

"1,2,3,4"

17.

a = [1,5,2,7,9]

a.insert(0,3)

a.pop(4)

print(a)

a)

[1, 5, 2, 7, 9, 3]

b)

[3, 1, 5, 2, 9]

c)

[3, 1, 5, 7, 9]

d)

[1, 5, 2, 7, 3]

18.

a = 5

if a>5:

print("Hi")

else:

print("Hello")

a)

Hi

b)

Hello

c)

Indentation Error

19.
a)

Hi

b)

Hello

c)

Indentation Error

20.

Which of these functions gives a random item from a list?

a)

random.randint()

b)

random.choice()

c)

random.sample()