What an array is; 1D and 2D syntax
An array is a fixed-length structure holding many elements of the same data type, each reached by a numeric index. Declared with a lower and upper bound: 1D DECLARE Name : ARRAY[l:u] OF <type>; 2D ARRAY[l1:u1, l2:u2] OF <type> (e.g. ARRAY[1:30] OF STRING, ARRAY[1:3, 1:3] OF CHAR). A 1D array is one numbered list; a 2D array is a grid, Grid[row, column]. The first index can be 0 or 1, but the syllabus pseudocode generally uses 1.
Read/write elements; loop over an array
Write to an element by assigning to it: StudentNames[1] ← "Ali" (or Grid[2,3] ← 'X'). Read it by using the indexed element in an expression, e.g. OUTPUT StudentNames[1]. Because the index can be a variable, a FOR loop steps the counter through every position: FOR Index ← 1 TO 30 ... NEXT Index. A 2D array needs nested loops — an outer for rows, an inner for columns — using both indices Arr[Row, Col].
Index vs value; bounds are inclusive
The index identifies an element's position, not the value stored there: in StudentNames[1] ← "Ali" the index is 1, the value is "Ali". Valid indices run from the lower to the upper bound inclusive: ARRAY[1:5] has indices 1-5, i.e. five elements (upper − lower + 1). Marks[0] or Marks[6] is out of bounds and fails at run time. The first index can be 0 or 1, but the syllabus pseudocode generally uses 1 — always loop within the bound in the DECLARE.
Drawn from real examiner reports.
2D arrays need a nested loop
For a 2D array, move through it with nested iteration (outer loop for rows, inner for columns) and reference each cell with both indices, e.g. Temps[Day, Hour]. Using only one loop, or one index, cannot reach every cell. When you see a grid (days × readings, a 3 by 3 board), write the outer FOR for one dimension and the inner FOR for the other.
November 2023 Paper 21/23: a task requiring a nested loop / 2D array was not attempted well — many did not use a nested loop or 2D array, or "failed to use both dimensions" on a temperature grid.
Looping outside the array bounds
Valid indices run from the declared lower bound to upper bound inclusive. Looping FOR i ← 0 TO 5 or FOR i ← 1 TO 6 over an ARRAY[1:5] reaches an index that does not exist — an out-of-bounds access that crashes the program at run time. Loop from the exact bound in the DECLARE (1 TO 5, not 0 TO 5 or 1 TO 6).
June 2023 Paper 21/22/23: a program crashed "when it tried to access an index that did not exist" (out-of-bounds access).
Index is the position, not the value
The index is the position (which slot), not the contents. Describing Marks[3] as "the number 3" instead of "the value in the third element of Marks" is the wrong-form answer that scores zero. State it precisely: the index says which element you are accessing; the value is what that element stores.
Use the counter, not a fixed index
Inside a loop, index the array with the loop counter, not a fixed number. Writing Marks[1] on every pass processes only the first element; Marks[Index] moves through all of them as Index changes. Using a variable as the subscript is exactly what lets one short loop handle the whole array.
Reset accumulator before, not in, the loop
An accumulator must be initialised before the loop: Total ← 0 placed inside the loop resets it to 0 on every pass, so the final total is wrong. For a per-group total in a 2D task, reset it inside the outer loop (once per group, before the inner loop) and output each group's result inside the outer loop.
The FOR-loop array scaffold
One scaffold covers most array marks: declare with bounds; initialise any accumulator (Total ← 0); loop the full bound (FOR Index ← 1 TO 10); index with the counter (Marks[Index]) every pass; close with NEXT Index; put per-element output inside, overall result after.
Use arrays as the scenario declares them
If the scenario says an array is already declared, do not re-declare it — use it as given. Re-declaring wastes time. Read the whole scenario first to pick the right array name and type, and answer in syllabus pseudocode.
Place 2D output in the right loop
In a nested 2D loop, put a per-row result (e.g. that row's total) inside the outer loop, after the inner loop; put a whole-grid result after both loops. Output in the inner loop prints once per cell — a common grid-task mark-loser.
An array stores many values of the same data type under one identifier, each reached by a numeric index. It is the workhorse data structure of Paper 2 — instead of Mark1, Mark2, … Mark30 you declare one array and step a loop through it.
Full notes, flashcards, Q&A and the topic quiz for every premium subject.
Premium plans are US$8.99/month or US$49.99/year — first month free.
Studying with a parent's blessing? Show them this.