OCR GCSE Computer Science Complete Practice Exam 2025

Question: 1 / 400

Which type of error occurs when rules or grammar of a programming language are not followed?

Logic error

Syntactical error

The type of error that occurs when the rules or grammar of a programming language are not followed is known as a syntactical error. This type of error arises when the code violates the specific syntax rules established by the programming language, making it impossible for the code to be correctly understood by the compiler or interpreter.

For instance, if a programmer forgets to include a semicolon at the end of a statement or misplaces parentheses, those mistakes will trigger a syntactical error. The importance of this type of error lies in the fact that it is usually detected during the compilation phase when the code is being translated from source code to machine code.

In contrast, logic errors involve the code running without crashing but producing incorrect results, while runtime errors occur during the program's execution due to illegal operations, like dividing by zero. Compilation errors, although closely related, typically refer to errors during the compiling stage that prevent the code from being built into an executable program, but they can encompass a broader range of issues, not just syntax errors alone.

Get further explanation with Examzify DeepDiveBeta

Runtime error

Compilation error

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy