Robust Programs (Error Identification)
1a: An error in the grammar/spelling/rules of the programming language. (1)
1b: The program runs but produces an incorrect/unexpected result. (1)
1c: (i) During writing / translation (compilation/interpretation). (1)
(ii) During execution / While running. (1)
2: Error 1 (Line 02): next_age = int(age) + 1
(Casting Error) (2)
Error 2 (Line 03): if next_age >= 18: (Missing Colon) (2)
Error 3 (Line 04): print(...) (Case Error) (2)
3: (a) Infinite Loop (1)
(b) The variable count is never updated/changed inside the loop (1) so the condition count >
0 remains True forever (1).
(c) count = count - 1 (or count -= 1) (2)
4: (a) "Denied" (1)
(b) The user meets one criteria (Height 150 > 140), so they should be allowed. The AND
operator requires both to be true, excluding valid customers. (2)
(c) if age > 12 or height > 140: (2)
5: (a) 40.0 (2)
(b) Division happens before addition (1). Only score3 is being divided by 3, not the
total (1).
(c) average = (score1 + score2 + score3) / 3 (2)
students contains 5 names.students = ["Ali", "Bea", "Cam", "Dan", "Eve"]i = 5 is a Logic
Error in the design of the loop range.
6: (a) Array indices start at 0. The last item is at index 4,
but the loop tries to access index 5. (2)
(b) for i = 0 to 4 (or range(5) in Python) (1)