Every program can contain errors (bugs). Cambridge IGCSE requires you to identify and distinguish between three types of error.
A syntax error breaks the rules of the programming language. The program cannot run at all — the translator (compiler/interpreter) detects it and stops. Examples: misspelled keywords, missing brackets, incorrect punctuation.
// Syntax errors (Cambridge pseudocode examples)
OUTPU "Hello" // OUTPU is not a keyword — should be OUTPUT
x = 5 // Should be x ← 5 (wrong assignment operator)
IF x > 0 // Missing THEN
OUTPUT x
ENDIF
A logic error means the program runs without crashing, but produces the wrong output. The code is syntactically correct but does not do what was intended. These are harder to find.
// Logic error example
total ← 0
FOR i ← 1 TO 5
total ← i // BUG: should be total ← total + i
NEXT i
OUTPUT total // Outputs 5 instead of 15
A runtime error (also called an execution error) occurs while the program is running — after it has started. The program crashes mid-execution. Examples: dividing by zero, accessing an array index that doesn't exist, reading a file that doesn't exist.
// Runtime error example DECLARE arr : ARRAY[1:5] OF INTEGER OUTPUT arr[6] // Runtime error: index 6 out of bounds result ← 10 / 0 // Runtime error: division by zero
| Error type | When detected | Program runs? | Example |
|---|---|---|---|
| Syntax | Before running (by translator) | No | Missing THEN, wrong keyword |
| Logic | When you check the output | Yes, but wrong answer | Using + instead of *, wrong condition |
| Runtime | While running | Starts then crashes | Divide by zero, out-of-bounds array |
Testing uses carefully chosen test data to check that a program works correctly. Cambridge IGCSE requires you to know three types of test data.
Values that the program should accept and process correctly. They are within the expected range.
Values at the very edge of the valid range. Boundary data tests whether the program handles the limits correctly. If a program accepts ages 0–120, boundary data would be 0 and 120 (and possibly -1 and 121 as out-of-range).
Values that the program should reject — outside the valid range, or the wrong data type entirely. Tests whether the program handles invalid input gracefully.
| Type | Test value(s) | Expected result |
|---|---|---|
| Normal | 45, 72, 99 | Accepted and processed |
| Boundary | 0, 100 | Accepted (edge of valid range) |
| Boundary | -1, 101 | Rejected (just outside valid range) |
| Erroneous | -50, 999, "abc" | Rejected with error message |
| Type | When done | Description |
|---|---|---|
| Iterative testing | During development | Testing each module/subroutine as it is written. Errors are found and fixed immediately before more code is added. |
| Final testing | After development is complete | Testing the whole program together to check it works as a complete system. Ensures all parts work together correctly. |
3 questions · 11 marks
| Term | Definition |
|---|
10 minutes · mixed marks