wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Year 9 Quiz

Total questions: 19

Worksheet time: 14mins

Name
Class
Date
1.
To repeat a fixed number of times use a
a)
while loop
b)
for loop
c)
if loop
d)
indentation
2.
The second part of if, that is executed when the condition is false
a)
if
b)
else
c)
for
d)
input
3.
The character that must be at the end of the line for if, while, for etc.
a)
:
b)
;
c)
.
d)
,
4.
What is the name of the environment in Python that write your programs and then test them out?
a)
Shell
b)
Window
c)
IDLE
d)
CLI
5.
What button do you press to compile (run) your program so that it runs in the shell?
a)
F3
b)
F5
c)
F7
d)
F9
6.
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.
7.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
8.

What will the output be from the following code (can you see the error?)?

print(Hello world!)

a)

Hello world!

b)

SyntaxError

c)

Hello world

d)

print(Hello world!)

9.
What will the output be from the following code?
print(3+4)
a)
3+4
b)
7
c)
SyntaxError
d)
print(3+4)
10.
Data type for a whole number
a)
String
b)
Integer
c)
Boolean
d)
Float
11.
A location in memory used to store data that can be changed.
a)
Constant
b)
Value
c)
Variable
d)
Iteration
12.
What will be the output?
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
13.

What will be the output?

name = 'Dave'

greeting = "Good morning" + name

print (greeting)

a)

greeting 'Dave'

b)

Good morning Dave

c)

Good morning name

d)

Good morning + Dave

14.
How do you program an input from the user? 
a)
print
b)
variable = input()
c)
if
d)
else
15.
What does the following code do?
name = input("what is your name")  
a)
says hello 
b)
asks for the users DOB
c)
Asks for the users name and stores it in a variable 
d)
Checks information 
16.

If the first three letters of the surname "Jones" were to be printed, which of the following would be correct?

a)

print(surname[0]+surname[2]+surname[4])

b)

print([surname[1]+surname[2]+surname[3])

c)

print([surname[1-3])

d)

print([surname[0]+surname[1]+surname[2])

17.

Which of the following input statements are correct?

a)

input="Enter your name")

b)

name =input enter your name

c)

name=input("Enter your name")

d)

name=input["Enter your name"]

18.

Which of the following converts the variable"mynumber" to an integer?

a)

str(mynumber)

b)

float(mynumber)

c)

num(mynumber)

d)

int(mynumber)

19.

Which value below would be accepted for this input statement?

value=int(input("Enter your value here : "))

a)

3.141

b)

0.1204345

c)

23.25

d)

16