Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python

Total questions: 32

Worksheet time: 20mins

Name
Class
Date
1.
To create a newline at the end of prompt, you can use which of the following expressions?
a)
\new
b)
\n
c)
\break
d)
\return
2.
The number or word we give to a variable
a)
Value
b)
Bug
c)
Information
d)
Text
3.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
4.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
5.
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
6.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
7.
What will the output be from the following code?
print(3*4+5)
a)
27
b)
17
c)
12
d)
SyntaxError
8.
What will the output be from the following code?
print("Hello" + str(2) + "world!")
a)
Hello world! Hello world!
b)
Hello2world!
c)
Hello Hello world! world!
d)
SyntaxError
9.
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 
10.
Tells the interpreter that the code which follows is a function
a)
const
b)
int
c)
def
d)
while
11.
Python identifies blocks of code by
a)
BEGIN and END keywords
b)
{ and }
c)
aligning up the starts of lines (indentation)
d)
guessing
12.

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

print (people[1])

what would this result be?

a)
John
b)
Rob
c)
Bob
13.

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

print (people[-1])

what would this result be?

a)
John
b)
Rob
c)
Bob
14.

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

print (people[4])

what would this result be?

a)
John
b)
Rob
c)
Bob
d)
Error
15.
What letter will be printed on the screen after running this code:
a)
e
b)
x
c)
t
d)
Nothing prints
16.
What output will this code produce?
a)
4
b)
2
c)
3
d)
5
17.
What output will this code produce?
a)
3
b)
20
c)
25
d)
17
18.
What output will this code produce?
a)
1
b)
3
c)
2
d)
4
19.
print("12"*3)
What would this print?
a)
36
b)
121212
c)
24
d)
12*3
20.

What will this code do?

a)

Print Numbers 1-11

b)

Print Numbers 1-10

c)

Print Numbers 2-10

d)

Print Error

21.

What will this code print?

a)

Print the word 'letter'.

b)

Print a user input on one line.

c)

Print a user input one letter at a time.

d)

Print an Error.

22.

Which of these operators means EQUAL TO?

a)

'='

b)

'=>'

c)

'<='

d)

'=='

23.

FOR loops are

a)

loops which run an unknown number of times

b)

loops which run for a specific number of times

c)

the same as if statements

d)

not part of programming

24.

Which type of loop iterates until instructed otherwise?

a)

FOR loop

b)

WHILE loop

25.
What will print?
a)
nothing
b)
5
c)
6
d)
an error message
26.
What will print?
a)
nothing
b)
5
c)
6
d)
an error message
27.
What will print?
a)
nothing
b)
7
c)
z
d)
12
28.
How many times will Boo print?
a)
none
b)
4
c)
5
d)
1
29.
How many times will Boo print?
a)
none
b)
4
c)
5
d)
1
30.
What will print?
a)
1 2
b)
1
c)
3
d)
5
31.

What term is used to describe data passed into a function?

a)

Variable

b)

Loop

c)

Constant

d)

Parameter

32.

Leo wants to create a function that will roll a dice. Which is the correct function definition header?

a)

def dice roll ():

b)

def diceroll ()

c)

def diceroll ():

d)

def diceroll []: