Name: _______________________________ Class: _____________ Points: ___ /45
Unit 1 revision - Mock
1. Priya is writing a program in pseudocode. Consider her pseudocode below:
START
lastName = "Patel"
isStudent = False
age = 16
score = 88.5
IF lastName == "Patel" THEN
OUTPUT "Access granted!"
ENDIF
STOP
a) State the data types of the following variables:
● lastName ................................................
● isStudent ................................................
● age ................................................
● score ................................................ [4]
b) Priya wants to change the logic of the program so it displays access granted when
lastname == “Patel” and isStudent equals True. What conditional operator should be
used? [1]
_________________________________________________________
2. Read the following pseudocode:
1| START
2| a = INPUT "Type a number"
3| IF a == 18 THEN
4| OUTPUT "18+"
5| ELSE
6| OUTPUT "18 or smaller"
7| ENDIF
8| STOP
⮚ Which line has an error? What is the error? [1]
_______________________________________
⮚ What type of error is this? (logical, syntax or runtime?)[1]
_______________________________________
3. Complete the trace table for the program below. [5]
Line Variable Variable Variable Variabl condition condition condit output
e ion
4 : What is the purpose of a variable in a text-based program? [1]
A) To store data that can change
B) To permanently store a fixed value
C) To add comments to the code
5. What is the purpose of a constant in a text-based program? [1]
A) To store data that can change
B) To permanently store a fixed value
C) To add comments to the code
6. Identify the kind of error and solution: [6]
Code Type of error Solution (explain or write
the correct code)
print(“hello,” ”name”)
num1 = int(input("What's your
first number?"))
num2 = int(input("What's your
second number?"))
result = num1 + num2
print(number3)
if age > 18:
print("You are eighteen years
old.")
7: Identify whether the following scenarios are examples of sequence, iteration, or decision.
[3]
Sequence Iteration Decision
age = int(input("Enter your age: "))
if age >= 10:
print("You can get a library card!") ____ __________
else:
print("You are too young”)
for i in range(3):
_____ _________
print(i)
print("Hello, world!")
name = input("What is your name? ") ___ ___________
print("Nice to meet you, " + name + "!")
8. Look at the code below and add the right input data in each row. [3]
age = int(input("What is your age? "))
if age < 0 or age > 120:
print("Invalid age. It must be between 0 and 120")
elif age < 18:
print("You are a minor.")
elif age < 65:
print("You are an adult.")
else:
print("You are a senior citizen.")
Test Test Input data / Expected Actual Pass/Fail
ID
data test data outcome outcome
1 Normal No need to No need to fill No need to fill
fill in in in
2 Normal No need to No need to fill No need to fill
fill in in in
3 Extreme No need to No need to fill No need to fill
fill in in in
4 Extreme No need to No need to fill No need to fill
fill in in in
5 Invalid No need to No need to fill No need to fill
fill in in in
6 Invalid No need to No need to fill No need to fill
fill in in in
9. Look at the following code. State the output of the code. [1]
friends = ["Hong", "Thao", "Duong", "Phuong Vu"]
print(friends[1])
__________________
10. Look at the following code. State the output of the code. [4]
Type below the output of your program (everything that will be printed):
11. Fill in the information below. [2]
Nguyet is developing a new mobile app for chatting to friends. After her first prototype is
created, she receives feedback that it is difficult to login.
Complete the steps of iterative development that Nguyet should use to improve her app.
Design: Nguyet decides how to make the login easier based on the feedback.
Develop: ........................................................................................................................
..........................................................................................................................................
Test: Nguyet asks one user to try logging in again.
Review and Evaluate: ..................................................................................................
..........................................................................................................................................
..........................................................................................................................................
12. What will this loop output:[1]
FOR i = 0 TO 3
OUTPUT i
END FOR
13. What will be displayed on the screen by this pseudocode algorithm:[1]
FOR m = 10 TO 13
OUTPUT m * 3
END FOR
14. Type the correct outputs for this pseudocode:[1]
FOR c in "camera"
OUTPUT c
END FOR
15. What will the output be for this Python code?[1]
name = "Alberto"
print(name.upper())
_________________________
16. What will the output be for this Python code?
name = "Sarthak"
print(len(name))
_________________________
17. Convert the following pseudocode into a flowchart: [3]
START
INPUT = num1
IF Number > 50 THEN
OUTPUT “Pass”
ELSEIF Number < 50 THEN
OUTPUT “Fail”
ELSE
OUTPUT “Invalid Input”
ENDIF
STOP
Draw your flowchart here:
18. Convert the following Python code into a flowchart: [5]
Draw your flowchart here: