Displaying a 2D array with nested loops
Placed inside nested FOR loops (outer loop for rows, inner loop for columns), this line displays each element of a 2D array once, in row order.
Understanding Displaying a 2D array with nested loops in IGCSE Computer Science Paper 2
What it does: The inner FOR loop steps through the columns, and the OUTPUT line shows one element per pass, giving one output per element. Row changes on each pass while the column stays at 3, so only the elements in column 3 are output. Cambridge pseudocode uses one pair of square brackets with the indexes separated by a comma: Grid[Row, Column]. In nested loops that display a 2D array, the outer loop counts the rows, so it runs once per row.
Common mistakes: The outer loop for the rows is missing the assignment arrow. It should be FOR Row ← 1 TO 3. The inner loop is FOR Col, so it must end with NEXT Col. NEXT Row belongs on the last line, closing the outer loop.
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 469–478) and word search (Modules 459–478).
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
OUTPUT Name[Row, Column]Fill in the Blanks
Spot the Error
Student with a class code? Join your class →