Writing a complete array program: declare, fill and output
The pattern of a complete array program: declare the array, use a FOR loop to INPUT a value into each element, then use a second FOR loop to OUTPUT every element.
Understanding Writing a complete array program: declare, fill and output in IGCSE Computer Science Paper 2
What it does: The OUTPUT loop uses the same bounds as the INPUT loop and reads each element in turn, here showing a name and its mark. The outer loop picks the row and the inner loop picks each column, so every cell of the grid receives a value. Indentation shows which loop is inside which. The array must be declared first. Then you fill it with INPUT, and only then can you OUTPUT the values that are stored in it. Names are text, so the array needs the data type STRING. An INTEGER array can only hold whole numbers. The loop must match the bounds 1 to 30. Going up to 31 would be an index out of range error.
Common mistakes: Array elements are accessed with square brackets, not round ones. It should be INPUT Pay[i]. A FOR loop in IGCSE pseudocode is closed with NEXT and the loop variable, not ENDFOR. Line 3 should be NEXT i.
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
DECLARE, FOR INPUT, FOR OUTPUTFill in the Blanks
Spot the Error
Student with a class code? Join your class →