Finding the minimum in Cambridge pseudocode
Inside a loop, this compares each item with Smallest and replaces Smallest when a lower value is found. Start Smallest as Marks[1], not 0, so the minimum is correct.
Understanding Finding the minimum in Cambridge pseudocode in IGCSE Computer Science Paper 2
What it does: Using < means Smallest only changes when a lower value appears. Using > would find the maximum instead. Starting from Marks[1] always gives a real value from the data, so the minimum is correct for any numbers, including negatives. No positive mark is less than 0, so the IF condition is never true and Smallest never changes. Each item must be compared with Smallest. If the check is after the loop, only one item is looked at.
Common mistakes: Starting Smallest at 0 gives the wrong minimum. Marks are never below 0, so the IF would never replace it and the answer would stay 0. It should be Smallest ← Marks[1]. The assignment is the wrong way round. This overwrites the array item instead of updating Smallest. It should be THEN Smallest ← Marks[Index].
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 286–295) and word search (Modules 275–295).
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
IF Marks[Index] < Smallest THEN Smallest ← Marks[Index] ENDIFFill in the Blanks
Spot the Error
Student with a class code? Join your class →