Algorithm Design, Testing & the Full IGCSE 0478 Syllabus
1. Programme Development Life‑Cycle (PDLC)
The IGCSE specification expects you to know where testing fits into the PDLC. The five stages are:
Analysis – define the problem, list inputs, outputs, constraints and any validation requirements.
Design – decompose the problem, produce structure diagrams, flowcharts and pseudocode.
Implementation (coding) – translate the design into a programming language (or a simulator).
Testing (validation & verification) – use test data, trace tables and error‑handling to confirm the program works correctly.
Documentation & Maintenance – comment code, write user manuals, and update the programme when requirements change.
2. Key Design Concepts
Concept
What the syllabus expects
Typical classroom activity
Decomposition & Structure diagrams
Break a problem into sub‑problems; show the hierarchy of modules.
Draw a structure diagram for “Calculate the average of a list of marks”.
Flowcharts
Use the standard symbols (terminator, process, decision, input/output, connector) and label each flow line.
Produce a flowchart for the “Maximum of three numbers” algorithm.
Pseudocode conventions
Line numbers, indentation, clear keywords (READ, IF, THEN, ELSE, END IF, WHILE, FOR, OUTPUT).
Write pseudocode for a simple bubble‑sort routine, keeping consistent indentation.
Validation checks
Range, type, length, format, check‑digit, consistency – ensure the *right* data is entered.
Implement a range‑check for a student’s mark (0 ≤ mark ≤ 100).
Verification checks
Visual check, double‑entry, checksum – ensure the data entered is *recorded* correctly.
Use double‑entry to verify a list of ID numbers entered by a user.
Trace tables
Record the value of every variable after each step, including every loop iteration.
Complete a trace table for a factorial routine.
2.1 Flowchart Symbol Reference
Symbol
Name
Purpose
⧉
Terminator
Start / End of the algorithm
▭
Process
Assignment, calculation or data manipulation
▱
Input/Output
READ or DISPLAY statements
◇
Decision
IF…THEN…ELSE test (yes/no branch)
⏺
Connector
Link separate parts of a large flowchart
3. Validation vs Verification
3.1 Validation Example in Pseudocode
1. READ mark
2. IF NOT (0 ≤ mark ≤ 100) THEN
3. OUTPUT "Invalid mark – must be 0‑100"
4. STOP
5. END IF
6. … // continue with processing
4. Test Data Categories (Cambridge terminology)
Category
Definition (syllabus)
Typical purpose
Example (max‑of‑three)
Normal
Typical values that the algorithm is expected to handle.
Confirms basic functionality.
a = 5, b = 8, c = 3
Boundary
Values at the limits of the allowed range, plus the value just outside the range.
Tests range‑check validation.
a = 0, b = 0, c = 0 (and a = ‑1, b = 0, c = 0 as “just outside”).
Extreme
Very large or very small numbers that may cause overflow/underflow.
Relevant for binary/hexadecimal algorithms.
a = 9999, b = 10000, c = 9998
Error
Invalid or unexpected input – used to test error handling.
Triggers validation messages.
a = ‑5, b = 2, c = 7 (negative not allowed).
5. Creating a Trace Table
List every variable that can change during execution.
Number each line of the pseudocode (or give a brief description of the operation).
For each test case, add a row for every step, recording:
Step number/description
Current values of all variables
Any output produced at that step
When a loop repeats, create a separate row for each iteration.
Compare the final output with the expected result; if they differ, locate the first row where the values diverge.
5.1 Example – “Maximum of Three Numbers”
Pseudocode (with line numbers and validation)
1. READ a, b, c
2. IF a < 0 OR b < 0 OR c < 0 THEN
3. OUTPUT "Error – negative numbers not allowed"
4. STOP
5. END IF
6. SET max ← a
7. IF b > max THEN SET max ← b
8. IF c > max THEN SET max ← c
9. OUTPUT max
Trace Table – Normal case (a = 5, b = 8, c = 3)
Step
a
b
c
max
Output
1
5
8
3
–
–
2‑5 (validation)
5
8
3
–
–
6
5
8
3
5
–
7 (true)
5
8
3
8
–
8 (false)
5
8
3
8
–
9
5
8
3
8
8
Trace Table – Error case (a = ‑5, b = 2, c = 7)
Step
a
b
c
max
Output
1
‑5
2
7
–
–
2‑5 (validation fails)
‑5
2
7
–
"Error – negative numbers not allowed"
6. Using Test Data Effectively
Start with normal cases – verify the algorithm works as intended.
Add boundary cases – test the exact limits and the just‑outside values to confirm validation checks.
Introduce extreme cases – check for overflow, underflow, or performance problems (especially for binary/hexadecimal operations).
Finish with error cases – ensure the program detects invalid input and produces a clear error message.
Record results in a trace table for each case; any mismatch should lead to a review of the pseudocode or the validation logic.
7. Common Pitfalls & How to Avoid Them
Missing variables – always list every variable that can change; otherwise the error’s location may be hidden.
One‑off test data – using only a single set of inputs rarely reveals hidden bugs.
Loop rows omitted – each iteration must have its own row; otherwise you cannot see the evolution of variables.
Confusing validation with verification – validation checks the *type/range* of data; verification checks that the data entered is *recorded correctly*.
Ignoring overflow/underflow – when testing binary or hexadecimal algorithms, include the maximum representable value (e.g. 1111₂ = 15₁₀) and one value beyond it.
Incorrect number‑system handling – remember the syllabus expects you to handle negative binary numbers using two’s‑complement and to recognise overflow conditions.
8. Summary Checklist (AO2 – Application of Knowledge)
Have you selected at least one test case from each of the four categories (normal, boundary, extreme, error)?
Is every variable that can change listed in the trace table?
Does each line of the pseudocode (including each loop iteration) have a corresponding row?
Do the final outputs match the expected results for all test cases?
Are validation checks (range, type, etc.) and verification checks (visual, double‑entry) clearly shown in the pseudocode?
Have you noted any failures, identified the offending step, and suggested a correction?
9. Link to Other Syllabus Topics (Paper 2 – Topics 7‑10)
Programming concepts – variables, data types, I/O, sequence, selection, iteration, arrays, file handling. (Apply trace‑table technique to array‑based sorting or file‑read/write programmes.)
Databases – single‑table design, primary key, basic SQL SELECT/INSERT/UPDATE. (Validate data before inserting; verify with a double‑entry test.)
Boolean logic – gate symbols, truth tables, circuit drawing. (A truth‑table is a specialised trace table for logical circuits.)
Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources,
past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.