Reading and changing array elements
Refers to one element of the array Marks by its index, here 3. You can read it or assign to it, e.g. Marks[3] ← 55. An index outside the array bounds causes an error.
Understanding Reading and changing array elements in IGCSE Computer Science Paper 2
What it does: Marks[3] on the right of ← reads the element at index 3 without changing the array. The array name comes first, then the index in square brackets, then the ← assignment arrow and the new value. Marks[3] is the third element, which is 45. 72 is Marks[2], the second element. Assigning to an element overwrites its old value. The other elements stay where they are and keep their values. The array starts at index 1, so index 0 does not exist. Using an index outside the bounds causes an error. Putting an array element on the left of ← assigns a new value to that one element.
Common mistakes: An element is chosen with square brackets, not round brackets. It should be Marks[3] ← 55. The index variable is spelt Index, but Indx was never given a value. It should be OUTPUT Marks[Index].
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 275–285) and word search (Modules 275–295).
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
Marks[3]Fill in the Blanks
Spot the Error
Student with a class code? Join your class →