wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Year 9 Python: End of Unit assessment

Total questions: 27

Worksheet time: 20mins

Name
Class
Date
1.
ITERATION is...
a)
The process of repeating part of a program until certain conditions have been met or an event occurs
b)
A way of storing values within a program
c)
Getting the program to select a course of action depending on a particular condition
d)
A way of collecting information from a user with a Python program
2.
ITERATION in Python is carried out using...
a)
WHILE and DO
b)
REPEAT and FOR
c)
WHILE and FOR
d)
REPEAT UNTIL 
3.
TRUE or FALSE:
WHILE and FOR fulfill the same purpose in Python and it doesn't matter which you use 
a)
TRUE
b)
FALSE
4.
When are FOR loops used in Python...
a)
Whenever we need to perform iteration
b)
When the iteration continues an unknown number of times until a certain condition is met
c)
When we know how many times the iteration needs to happen
d)
To help us perform SELECTION
5.
When are WHILE loops used in Python...
a)
Whenever we need to perform iteration
b)
When the iteration continues an unknown number of times until a certain condition is met
c)
When we know how many times the iteration needs to happen
d)
To help us perform SELECTION
6.
Which of the following is the best definition of a VARIABLE?
a)
A variable is container of data
b)
A variable is piece of data
c)
A variable is a number
d)
A variable is a piece of text
7.
Amy creates a program which includes the variable shown here.
What would be the best way of describing "lives"?
a)
"lives" is string
b)
"lives" is an identifier
c)
"lives" could be used in a game
d)
"lives" is a float
8.
Matt wants to create a program to keep a record of temperatures. 
Which DATA TYPE would be most suitable for a variable called "temperature"?
a)
A string
b)
A boolean
c)
An integer 
d)
A float
9.
Anil is writing a program to store information about his favourite films.
What would be a suitable data type for a variable used to store the name of the film?
a)
A string
b)
A booelan
c)
An integer
d)
A float
10.
Mia is writing a program that will store survey she has carried out about smartphones.
What would be a suitable DATA TYPE to use for a variable containing the number of people said they used an Android phone?
a)
A string
b)
An integer
c)
A boolean
d)
A float
11.
Zac has written this program in Python.
The user enters two numbers.
If the user enters 10 for each number, what will the output of the program be?
a)
10
b)
20
c)
1010
d)
It won't run
12.
Max has written this program in Python.
One of the lines contains at least one error.
Which line is it?
a)
Line 1
b)
Line 2
c)
Line 3
d)
Line 4
13.
What word describes the rules that determine how we have to write our programming commands in Python?
a)
Statements
b)
Expressions
c)
Variables
d)
Syntax
14.

What term do we give to code that contains actions that must be executed one after the other without skipping any.

a)

C: Selection

b)

A: Iteration

c)

B: Sequence

d)

D: Decomposition

15.

Akhil has written a program to validate the height of a child wishing to ride a roller coaster: He runs the program and enters the height as being 1.5. What does the program output? if height <= 1.5 print (“You are not tall enough to ride the roller coaster”) elif height >= 2.0 print (“You are too tall to ride the roller coaster”) else print (“You can ride the roller coaster”)

a)

C: You are not tall enough to ride the roller coaster

b)

D: You can ride the roller coaster

c)

B: Nothing

d)

A: You are too tall to ride the roller coaster

16.

Which of the following relational operators would be needed to check if a variable holds a value greater or equal to 100:

a)

C: <=

b)

A: <

c)

D: >=

d)

B: >

17.

Grace has written the following program to validate some user input in response to a question: She has used a Boolean operator AND in her code. What Boolean operator should she have used? if answer == “yes” AND answer == “YES” print (“That’s correct, well done”) else print (“Sorry that is not the correct answer, please try again”)

a)

D: OR

b)

C: NOT

c)

A: EQUALTO

d)

B: XOR

18.

The following code is an example of which programming construct? while retry == “yes” playgame() endgame()

a)

A: Iteration

b)

B: Sequence

c)

C: Selection

d)

D: Decomposition

19.

Ahmer has written the following program: for i = 1 to 5 print (i * 10) next i What would the program output?

a)

A: 5, 6, 7, 8, 9, 10

b)

B: 11, 12, 13, 14, 15

c)

C: 10, 20, 30, 40, 50

d)

D: 10, 10, 10, 10, 10

20.

What will be output as a result of the program below? A = 3 * 4 + 2 print (A)

a)

A: 18

b)

B: 10

c)

C: 14

d)

D: 12

21.
The character that must be at the end of the line for if, while, for etc.
a)
:
b)
;
c)
.
d)
,
22.

What is the coder's word for converting one data type into another?

a)

casting

b)

throwing

c)

catching

23.

Which of these is a variable?


name=input("Welcome to the quiz, what is your name?")

print("Hello",name)

a)

input

b)

print

c)

name

d)

Hello

24.

What is the syntax error in this code?

a)

Incorrect use of variable

b)

Missing : characters at the end of the if and else statements

c)

The code is not indented correctly

d)

Missing brackets

25.

Which of the following is NOT a suitable variable name?

a)

num1

b)

Num1

c)

MyName

d)

My name

26.

What is the value of c after the code has executed?

a)

5

b)

10

c)

20

d)

40

27.

Why is there an error in line 6 of this Python code?

a)

No speech marks

b)

No brackets

c)

No full stop

d)

No comma