Finding errors in an algorithm
A mistake that breaks pseudocode rules or gives wrong results. Find it by reading the code, then trace it with test values and compare the actual output with the expected output.
Understanding Finding errors in an algorithm in IGCSE Computer Science Paper 2
What it does: The code runs but repeats the wrong number of times, so the output is wrong. This is a logic error found by tracing. Comparing actual with expected output shows an error exists. The trace table helps you find the line that causes it. Pseudocode assignment uses ←. Writing = is a presentation error because it breaks the pseudocode rules. One matching result does not prove the algorithm is correct. Try more test values.
Common mistakes: Presentation error: assignment must use the ← arrow, not =. In pseudocode = is for comparison. It should be Total ← 0. Presentation error: pseudocode keywords must be in upper case. It should be INPUT Number.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 232–241) and word search (Modules 232–253).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
error in an algorithmFill in the Blanks
Spot the Error
Student with a class code? Join your class →