Finding the maximum in Cambridge pseudocode
Used inside a loop to compare each mark with Largest. If the mark is bigger, it replaces Largest. When the loop ends, Largest holds the biggest value in the array.
Understanding Finding the maximum in Cambridge pseudocode in IGCSE Computer Science Paper 2
What it does: Starting at 2 avoids comparing Marks[1] with itself, since Largest ← Marks[1] has already been done. Updating Position at the same time as Largest means Position always holds the index of the biggest value found so far. A new mark replaces Largest only when it is bigger. Using < would find the smallest value instead. Largest is only the true maximum after every element has been checked. Output after the loop gives one answer. Output inside the loop prints values that may not be the maximum yet. Largest starts at 40, becomes 75 as 75 > 40, then stays 75 because 60 is not greater than 75. The last value checked is not automatically the largest.
Common mistakes: The comparison is the wrong way round. Using < only updates Largest when a mark is smaller, so it would find the minimum. It should be IF Marks[Index]>Largest THEN. Cambridge pseudocode arrays start at index 1, so Marks[0] does not exist. Largest should start as the first mark: Largest ← Marks[1].
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] > Largest THEN Largest ← Marks[Index] ENDIFFill in the Blanks
Spot the Error
Student with a class code? Join your class →