| OCR |
GCSE (9-1) Computer Science
Mark Scheme
J277/02: Unit 2.3 Robust Programs
|
| Question | Answer | Marks | Guidance |
|---|---|---|---|
| 1a | An error in the grammar/spelling/rules of the programming language. | 1 |
Must mention "rules" or "grammar".
|
| 1b | The program runs but produces an incorrect/unexpected result. | 1 |
Critical: Must mention that the program runs or does not crash (initially).
|
| 1c |
(i) During writing / translation (compilation/interpretation). (1) (ii) During execution / While running. (1) |
2 | |
| 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)
|
6 |
age is a string (from input). Cannot add 1 to a string. Python is case sensitive (Print vs print).
|
| 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)
|
5 |
Ghost Topic: Must be a decrement to fix the loop logic.
|
| 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 |
Students often fail to explain why it's an error in the context of the scenario.
|
| 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)
|
6 |
Working: 30 / 3 = 10. 10 + 20 + 10 = 40. Brackets are required for the refinement mark.
|
| 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)
|
3 |
Common off-by-one error.
|