Lesson 6.1 · Answer it
Which kind of error
5 marksYou mark it yourself against the marking points
A student tests a quiz program that asks the player three questions and keeps the answers in a list. Something different goes wrong on three different days. For each of (a), (b) and (c), state whether the error is a syntax error, a run-time error or a logic error.
(a) When the student starts the program, it asks no questions at all. A message points at line 7, where a closing bracket is missing. [1]
(b) The program asks all three questions. Then it stops with an error message when it tries to read a fourth answer from the list. [1]
(c) The program asks all three questions and finishes with no message, but it says the player scored 2 out of 3 when every answer was right. [1]
(d) The student changes the program to fix the error in (c). Explain how the student could test whether it is now fixed. [2]
[5]