NEW
Font size
WorksheetsYear 9 Python: End of Unit assessment
Total questions: 27
Worksheet time: 20mins
WHILE and FOR fulfill the same purpose in Python and it doesn't matter which you use
What would be the best way of describing "lives"?
Which DATA TYPE would be most suitable for a variable called "temperature"?
What would be a suitable data type for a variable used to store the name of the film?
What would be a suitable DATA TYPE to use for a variable containing the number of people said they used an Android phone?
The user enters two numbers.
If the user enters 10 for each number, what will the output of the program be?
One of the lines contains at least one error.
Which line is it?
What term do we give to code that contains actions that must be executed one after the other without skipping any.
C: Selection
A: Iteration
B: Sequence
D: Decomposition
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”)
C: You are not tall enough to ride the roller coaster
D: You can ride the roller coaster
B: Nothing
A: You are too tall to ride the roller coaster
Which of the following relational operators would be needed to check if a variable holds a value greater or equal to 100:
C: <=
A: <
D: >=
B: >
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”)
D: OR
C: NOT
A: EQUALTO
B: XOR
The following code is an example of which programming construct? while retry == “yes” playgame() endgame()
A: Iteration
B: Sequence
C: Selection
D: Decomposition
Ahmer has written the following program: for i = 1 to 5 print (i * 10) next i What would the program output?
A: 5, 6, 7, 8, 9, 10
B: 11, 12, 13, 14, 15
C: 10, 20, 30, 40, 50
D: 10, 10, 10, 10, 10
What will be output as a result of the program below? A = 3 * 4 + 2 print (A)
A: 18
B: 10
C: 14
D: 12
What is the coder's word for converting one data type into another?
casting
throwing
catching
Which of these is a variable?
name=input("Welcome to the quiz, what is your name?")
print("Hello",name)
input
name
Hello
What is the syntax error in this code?
Incorrect use of variable
Missing : characters at the end of the if and else statements
The code is not indented correctly
Missing brackets
Which of the following is NOT a suitable variable name?
num1
Num1
MyName
My name
What is the value of c after the code has executed?
5
10
20
40
Why is there an error in line 6 of this Python code?
No speech marks
No brackets
No full stop
No comma
