The specification requires you to understand the two types of error and to identify and categorise errors within algorithms and programs.
Syntax error
An error that breaks the rules (grammar) of the programming language, so the program will not run at all.
The translator (compiler or interpreter, 3.4.4) detects it and reports it before execution.
IF x > 5 # missing THEN
OUTPUT 'Hello # missing closing quotation mark
FOR i ← 1 TO 10 # missing ENDFOR
prnt('Hello') # misspelled keyword
Key point: the program cannot run. You are told where the problem is, which makes syntax errors comparatively easy to fix.
Logic error
An error where the program runs successfully but produces the wrong result.
The syntax is perfectly legal, so nothing is reported — the program simply does the wrong thing.
average ← a + b / 2 # precedence — should be (a + b) / 2
IF age > 18 THEN # should be ≥ 18 — excludes exactly 18
FOR i ← 0 TO LEN(a) # off-by-one — reads past the end
IF mark ≥ 0 OR mark ≤ 100 THEN # should be AND — accepts everything
total ← total - price # should be + — wrong operator
The comparison table
| Syntax error | Logic error |
|---|
| Cause | Breaks the language's rules | The instructions are legal but wrong |
| Does the program run? | No | Yes |
| Reported by the translator? | Yes | No |
| How it is found | The error message tells you | Testing and tracing |
| Difficulty | Easier — you are told where | Much harder — you must notice the output is wrong |
Why logic errors are more dangerous. A syntax error stops you immediately. A logic error lets a program run for months producing subtly wrong results — an incorrect grade boundary, a slightly wrong total — with nothing to draw attention to it. Making that point is a strong AO3 observation.
Categorising errors in an exam
Ask one question: would the program run?
- No → syntax error.
- Yes, but the answer is wrong → logic error.
IF x = 5 THEN
OUTPUT 'Five'
# no ENDIF → SYNTAX (will not run)
IF x = 5 THEN
OUTPUT 'Four'
ENDIF → LOGIC (runs, wrong output)
AQA tip. A third category, the runtime error (such as dividing by zero or an out-of-range array index), causes a crash during execution. The specification names only syntax and logic, so use those two terms — but if a question describes a crash mid-run, an out-of-range index is usually a logic error in the loop bounds.