Upgrade to access all Cambridge 9618 lessons including arrays, data structures, and algorithm implementation.
Upgrade to Pro →An array is a data structure that stores a fixed number of elements of the same data type in a contiguous block of memory. Arrays allow multiple values to be stored under a single variable name, accessed using an index.
Key properties of arrays in Cambridge 9618:
Cambridge 9618 syntax:
The format is: DECLARE name : ARRAY[lower:upper] OF type
The array has upper - lower + 1 elements. So ARRAY[1:5] has 5 elements; ARRAY[0:6] has 7 elements.
The standard pattern for processing all elements of a 1D array uses a FOR loop from lower bound to upper bound:
A 2D array is essentially a table (matrix) — an array of arrays. Elements are accessed using two indices: [row, column].
Highlighted cell: grid[2,3] = 99
Nested FOR loops are needed — outer loop for rows, inner loop for columns:
| Use case | Example |
|---|---|
| Storing a list of values | Student marks, temperatures across a week |
| Implementing searching | Linear search or binary search over a sorted array |
| Implementing sorting | Bubble sort or merge sort in-place on an array |
| Representing a grid | Chess board, seating plan, pixel image |
| Lookup tables | ASCII table, conversion table |
| Frequency counting | Count occurrences of each score |
DECLARE name : ARRAY[lower:upper] OF type. Two common marks lost: (1) writing ARRAY[1..5] instead of ARRAY[1:5]; (2) missing the OF keyword. For 2D arrays, a comma separates dimensions: ARRAY[1:3, 1:4]. The number of elements is always (upper − lower + 1) per dimension.
.. instead of : in array bounds — Cambridge uses ARRAY[1:10] not ARRAY[1..10]OF type in the declarationARRAY[1:10], valid indices are 1 to 10 (not 0 to 9)[row, col] order8 questions · Cambridge 9618 standard
temps with 7 elements (indexed 1 to 7) of type REAL.[2]ARRAY[3:8] OF INTEGER contain?[1]A with indices 1 to n. The maximum should be stored in a variable called maxVal.[5]seats representing a cinema hall with 10 rows and 15 columns of BOOLEAN values (TRUE = occupied).[2]M with dimensions ARRAY[1:3, 1:4].[5]| Term | Definition |
|---|
10 questions · 10 marks · 10 minutes