A program contains a syntax error. An interpreter reports the error as soon as it finds it.
Identify when a compiler reports the syntax errors it finds in the source code.
Mark scheme
- B At the end of translating the program (1)
- The only correct answer is B. The correct answer is at the end of translating the program.
- A is not correct because a compiler translates the whole program and does not report an error after each line; reporting after each line is how an interpreter behaves
- C is not correct because a compiler does not stop at the first error; it finishes translating and reports the errors it finds at the end
- D is not correct because syntax errors are found during translation, before the object code is run
Example answers and how they were marked
B At the end of translating the program
Why: Chosen option states that errors are reported once the whole program has been translated, as a compiler does (1).
A After each line is translated
Why: Near miss: reporting an error after each line is the behaviour of an interpreter, not a compiler, so no mark.
C When the first error is found
Why: Misconception that a compiler stops and reports at the first error it finds; a compiler reports the errors at the end of translation, so no mark.