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

Question: 1 / 400

Which error occurs when the compiler or interpreter runs the program but it behaves unexpectedly?

Syntax Error

Logic Error

A logic error occurs when a program runs without crashing but produces incorrect or unexpected results. This type of error typically stems from flaws in the program's logic, such as using the wrong formula, incorrect looping structures, or inappropriate condition checks.

Unlike syntax errors, which prevent the program from compiling or running at all due to incorrect code structure, logic errors allow the program to execute but yield outputs that do not match the user’s intentions or expectations. Performance tests and diagnosing errors refer more to methods of evaluating program efficiency or identifying issues rather than specific types of errors within the code itself. Therefore, a logic error is the most fitting answer to the question regarding unexpected behavior during program execution.

Get further explanation with Examzify DeepDiveBeta

Performance Test

Diagnosing Errors

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy