← IGCSE Computer Science Paper 2

One-dimensional arrays

Creates an array called Marks: a named list of 10 items, numbered from lower bound 1 to upper bound 10. Every item must be the same data type, here INTEGER.

Understanding One-dimensional arrays in IGCSE Computer Science Paper 2

What it does: The [1:5] shows lower bound 1 and upper bound 5, so Scores has 5 items numbered 1 to 5, not starting at 0. OF REAL after the bounds sets one data type for all 8 items in Prices, so every item must be a REAL number. Cambridge pseudocode uses DECLARE name : ARRAY[lower:upper] OF type. The square brackets after the type belong to other languages.

Common mistakes: The array is declared as ARRAY[1:5], so the upper bound is 5. Index 6 is outside the array. The line should use an index from 1 to 5, such as T[5] ← 21.0. Cambridge arrays start at index 1, and this array has lower bound 1. Index 0 does not exist. The first item is T[1] ← 18.5.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

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 265–274) and word search (Modules 254–274).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which declaration creates a list of 10 whole numbers called Marks in Cambridge pseudocode?
DECLARE Marks : INTEGER[10]DECLARE Marks : ARRAY[1:10] OF INTEGER
Matches
DECLARE Marks : ARRAY[0:9] OF INTEGER
↓
Cambridge arrays start at index 1, so the lower bound should be 1 and the upper bound 10 for 10 items, not [0:9].
Applying
Meanings
Term
DECLARE Marks : ARRAY[1:10] OF INTEGER
Meaning
Creates an array called Marks: a named list of 10 items, numbered from lower bound 1 to upper bound 10. Every item must be the same data type, here INTEGER.
Practice
DECLARE Marks : ARRAY[1:10] OF INTEGER
Testing
Gaps
Marks : ARRAY[1:10] OF INTEGER
Check Answer
Spots
2T[1] ← 18.5
3T[6] ← 21.0

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Hyena' badge — Savannah Debugger, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which declaration creates a list of 10 whole numbers called Marks in Cambridge pseudocode?
A. DECLARE Marks : INTEGER[10]
B. DECLARE Marks : ARRAY[1:10] OF INTEGER ✓
Cambridge pseudocode uses DECLARE name : ARRAY[lower:upper] OF type. The square brackets after the type belong to other languages.
2. In ARRAY[1:10], what does the 1 stand for?
A. The lower bound: the index of the first item ✓
B. The number of items stored in the array
The first number is the lower bound (where the index starts). The second number, 10, is the upper bound.
3. In Cambridge pseudocode, which is the index of the first item in DECLARE Marks : ARRAY[1:10] OF INTEGER?
A. Marks[0]
B. Marks[1] ✓
Cambridge arrays start at index 1 here because the lower bound is 1. Marks[0] would be outside the array bounds.
4. DECLARE Marks : ARRAY[1:10] OF INTEGER. How many items can Marks hold?
A. 10 items, from Marks[1] to Marks[10] ✓
B. 9 items, from Marks[1] to Marks[9]
Count from the lower bound 1 up to and including the upper bound 10. That gives 10 items.
5. Which statement about the items in DECLARE Marks : ARRAY[1:10] OF INTEGER is true?
A. Every item must be an INTEGER ✓
B. Some items can be INTEGER and some can be STRING
All items in an array must be the same data type. Here that type is INTEGER.

Match the Pairs

DECLARE Marks : ARRAY[1:10] OF INTEGER → Creates an array called Marks holding 10 whole numbers, numbered from index 1 to index 10
DECLARE Names : ARRAY[1:30] OF STRING → Creates an array called Names with 30 items, all of them STRING, from index 1 to index 30
The lower bound of a Cambridge array is 1, so the first item is at index 1 and the upper bound 5 gives 5 items → DECLARE Scores : ARRAY[1:5] OF INTEGER
All items in an array must be the same data type, such as REAL numbers for prices → DECLARE Prices : ARRAY[1:8] OF REAL
DECLARE Marks : ARRAY[0:9] OF INTEGER → Cambridge arrays start at index 1, so the lower bound should be 1 and the upper bound 10 for 10 items, not [0:9].
DECLARE Marks : ARRAY[1:10] → The data type is missing. An array declaration must say OF and give one type, such as OF INTEGER, for all the items.

Key Term

DECLARE Marks : ARRAY[1:10] OF INTEGER
Creates an array called Marks: a named list of 10 items, numbered from lower bound 1 to upper bound 10. Every item must be the same data type, here INTEGER.

Fill in the Blanks

1. DECLARE Marks : ARRAY[1:10] OF INTEGER
Hint: Type the keyword that starts a declaration of a variable or array.
2. DECLARE Marks : ARRAY[1:10] OF INTEGER
Hint: Type the keyword that says this is a named list of items, not a single value.
3. DECLARE Marks : ARRAY[1:10] OF INTEGER
Hint: Type the lower bound: the index of the first item in a Cambridge array.
4. DECLARE Marks : ARRAY[1:10] OF INTEGER
Hint: Type the upper bound: the index of the last item, which is also how many items the array holds.
5. DECLARE Names : ARRAY[1:30] OF STRING
Hint: Type the data type that every item in this array must have, since the items hold text.

Spot the Error

Question 1
A DECLARE T : ARRAY[1:5] OF REAL
B T[1] ← 18.5
C T[6] ← 21.0
Line C — The array is declared as ARRAY[1:5], so the upper bound is 5. Index 6 is outside the array. The line should use an index from 1 to 5, such as T[5] ← 21.0.
Question 2
A DECLARE T : ARRAY[1:5] OF REAL
B T[0] ← 18.5
C T[2] ← 21.0
D OUTPUT T[1]
Line B — Cambridge arrays start at index 1, and this array has lower bound 1. Index 0 does not exist. The first item is T[1] ← 18.5.
Question 3
A DECLARE C : ARRAY[1:4] OF CHAR
B C[1] ← 'A'
C C[2] ← 'B'
D C[3] ← 7
Line D — Every item in an array must be the same data type. C is an array of CHAR, so it cannot hold the integer 7. The line should store a character, such as C[3] ← 'C'.
Question 4
A DECLARE T : ARRAY(1:5) OF REAL
B T[1] ← 18.5
C T[5] ← 20.5
Line A — The bounds in an array declaration go in square brackets, not round brackets. It should be ARRAY[1:5].
Question 5
A // Store 5 temperatures
B DECLARE T : ARRAY[5:1] OF REAL
C T[1] ← 18.5
Line B — The lower bound must come first and be smaller than the upper bound. [5:1] is back to front. It should be ARRAY[1:5].

Student with a class code? Join your class →