Oxford, Cambridge and RSA (OCR) GCSE Computer Science Practice Exam

Question: 1 / 400

What indicates that a program has executed but produced an unexpected result?

Syntax error

Runtime error

Logic error

The correct answer signifies a situation where the program has successfully run without any issues during compilation or at runtime, but the output does not match what was intended by the programmer. A logic error occurs when the underlying algorithm or the logic used in the program is flawed, leading to incorrect or unexpected results even though the program executes successfully.

In contrast, a syntax error refers to mistakes in the code that prevent it from compiling, such as typos or incorrect use of language rules. A runtime error occurs when the program encounters an issue while it is running, such as trying to divide by zero or accessing an out-of-bounds array element, which stops the program from executing properly. A compilation error occurs before the program starts running, indicating problems during the translation of the source code into machine code.

Thus, when a program executes but fails to produce the expected result due to incorrect logic, it is identified as a logic error, highlighting the critical distinction between errors that prevent execution and those that occur during execution resulting in faulty outcomes.

Get further explanation with Examzify DeepDiveBeta

Compilation error

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy