Common array mistakes in pseudocode
Typical bugs: loop limits not matching ARRAY[l:u], swapped row and column indexes, a total not reset to 0, or the wrong data type stored. Check bounds, index order and starting values.
Understanding Common array mistakes in pseudocode in IGCSE Computer Science Paper 2
What it does: The loop limits must match the declaration exactly. Starting at 1 would skip element 0 and the loop would also be wrong at the top end. If Total is not reset to 0 first, it keeps an old value and the answer is too large. Setting the starting value fixes this. The upper bound is 30. Index 31 does not exist, so TO 31 causes an index out of range error. Every element must hold the declared data type. A string cannot be stored in an INTEGER array. A 2D array is always written Grid[Row, Column]. Swapping them reads a different cell and can go outside the declared bounds.
Common mistakes: The array starts at index 0, so a loop starting at 1 skips D[0] and the total is too small. It should be FOR i ← 0 TO 6. The loop uses index 0, but the declaration starts at 1, so T[0] is out of range. The declaration should be ARRAY[0:4].
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 479–488) and word search (Modules 479–499).
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
common array mistakesFill in the Blanks
Spot the Error
Student with a class code? Join your class →