Completing a partly written algorithm
Fill each missing line or value by asking what the standard method (total, count, max, search, sort) needs at that point: start value, loop bound, condition or closing keyword.
Understanding Completing a partly written algorithm in IGCSE Computer Science Paper 2
What it does: Every IF...THEN must be closed with ENDIF before the loop's NEXT, so the counting step only happens when the condition is true. A total must start at 0 so the first mark added is not changed. Starting at 1 would make the answer too big by 1. The loop bound must reach the last index. Stopping at 29 would skip the 30th name. More than 50 means greater than (>). Using >= would also count marks that are exactly 50. A WHILE ... DO loop ends with ENDWHILE. UNTIL belongs to a REPEAT loop. A totalling algorithm needs its running total set to 0 before the loop, otherwise the answer starts from a wrong or unknown value.
Common mistakes: To find the maximum, the condition must check for a score greater than Max. Using < would find the minimum instead. It should be IF Score[i] > Max THEN. A counter must start at 0 so that it counts only the items that meet the condition. Starting at 1 makes the final count one too high. It should be Count ← 0.
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 307–316) and word search (Modules 296–316).
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
complete the algorithmFill in the Blanks
Spot the Error
Student with a class code? Join your class →