AQA · GCSE · Computer Science

    Course version: 8525 · Version from Sept 2020

    Understand that there are different types of error:

    Full specification wording

    Robust and secure programming: Understand that there are different types of error:

    Programs can fail for different reasons, and recognising the type of error helps you fix it.

    Checked against the AQA 8525 specification (opens in a new tab) on .

    • Point 11 of 14

    Study notes

    From the checked teaching notes for this specification point.

    The idea

    Programs can fail for different reasons, and recognising the type of error helps you fix it. A syntax error breaks the rules of the language, so the program will not run at all; for example, a missing closing bracket or a misspelled keyword that the parser rejects. A logic error is syntactically valid and runs, but produces the wrong result, such as using the wrong operator or an incorrect condition in a loop. A runtime error occurs while the program is executing, for example dividing by zero or accessing an array index that is out of range. Classifying an error correctly tells you whether to fix the code before running, trace the algorithm, or add validation and error handling.

    What earns the marks

    • Defines a syntax error as code that breaks the grammar/rules of the language so the program cannot run.
    • Defines a logic error as code that runs but produces an incorrect or unintended result.
    • Defines a runtime error as an error that occurs while the program is executing.
    • Gives a valid example of each type, such as a missing bracket for syntax, a wrong condition for logic, and division by zero for runtime.
    • Explains how the error type affects the fix, such as correcting code before running, tracing logic, or adding validation/handling.

    Common mistakes and how to put them right

    • Calling a misspelled function name a syntax error.

      Put it right: Is that in many languages an unknown name is syntactically valid and fails at runtime, so classify it as a runtime error unless the language's parser rejects it.

    • Treating a logic error as one that stops the program.

      Put it right: Is that a logic error lets the program run but gives a wrong result.

    • Assuming any crash is a syntax error.

      Put it right: Is that a crash during execution is a runtime error, while a syntax error prevents the program running at all.

    Exam tips

    • For each scenario, ask whether the program runs and whether the result is correct before naming the error type.
    • Match each error to a concrete example to justify your classification.
    • Link the error type to the appropriate fix, such as editing code, tracing logic, or adding validation.

    Try the lesson

    The start of the Robust and secure programming: Understand that there are different types of error: lesson, made from checked teaching notes for this specification point.

    Have a go first

    A program contains the line `total = total + ` with nothing after the plus sign. The program will not run at all. What type of error is this?

    There is more to this lesson

    The full lesson goes on to check your understanding and help you earn the marks. Create a free account to carry on, with your progress saved.

    Carry on with the full lesson

    A week of Premium from your first lesson · Then the free plan continues · No card, no charge

    Test your understanding of Robust and secure programming: Understand that there are different types of error:

    Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.

    Take topic quiz

    A week of Premium from your first lesson · Then the free plan continues · No card, no charge