← IGCSE Computer Science Paper 2

Array data types: INTEGER, REAL, CHAR, STRING, BOOLEAN

The data type after OF decides what every element can hold. ARRAY[1:10] OF INTEGER holds ten whole-number scores; REAL, CHAR, STRING or BOOLEAN would hold other kinds of data.

Understanding Array data types: INTEGER, REAL, CHAR, STRING, BOOLEAN in IGCSE Computer Science Paper 2

What it does: Whole-number scores need INTEGER after OF, so every element holds a whole number. CHAR holds one single character. BOOLEAN only holds TRUE or FALSE.

Common mistakes: TEXT is not a data type after OF. An array of single letters is declared with CHAR: DECLARE L : ARRAY[1:3] OF CHAR. The array is OF REAL, so every element must hold a number with a decimal part. The text "cheap" cannot be stored. It should be P[3] ← 3.20.

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 439–448) and word search (Modules 439–458).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which declaration suits ten whole-number test scores?
DECLARE Scores : ARRAY[1:10] OF CHARDECLARE Scores : ARRAY[1:10] OF INTEGER
Matches
DECLARE Prices : ARRAY[1:10] OF INTEGER Prices[1] ← 2.50
↓
The array is declared OF INTEGER, so its elements can only hold whole numbers. The decimal 2.50 does not fit. The type after OF should be REAL.
Applying
Meanings
Term
ARRAY[1:10] OF INTEGER
Meaning
The data type after OF decides what every element can hold. ARRAY[1:10] OF INTEGER holds ten whole-number scores; REAL, CHAR, STRING or BOOLEAN would hold other kinds of data.
Practice
DECLARE Scores : ARRAY[1:10] OF INTEGER
Testing
Gaps
DECLARE Scores : ARRAY[1:10] OF
Check Answer
Spots
1DECLARE L : ARRAY[1:3] OF TEXT
2L[1] ← 'A'

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

The 'Ermine' badge — Tundra Streak, 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 suits ten whole-number test scores?
A. DECLARE Scores : ARRAY[1:10] OF INTEGER ✓
B. DECLARE Scores : ARRAY[1:10] OF CHAR
Whole numbers need INTEGER. CHAR only holds a single character.
2. Which declaration suits ten prices such as 2.50 and 7.99?
A. DECLARE Prices : ARRAY[1:10] OF REAL ✓
B. DECLARE Prices : ARRAY[1:10] OF INTEGER
Prices have decimal places, so the elements must be REAL. INTEGER holds whole numbers only.
3. Which declaration can store the 26 letters of the alphabet, one letter per element?
A. DECLARE Letters : ARRAY[1:26] OF CHAR ✓
B. DECLARE Letters : ARRAY[1:26] OF BOOLEAN
CHAR holds one single character. BOOLEAN only holds TRUE or FALSE.
4. Which declaration suits 30 yes/no flags that record whether each student is present?
A. DECLARE Present : ARRAY[1:30] OF REAL
B. DECLARE Present : ARRAY[1:30] OF BOOLEAN ✓
A yes/no value is TRUE or FALSE, which is the BOOLEAN data type.
5. Which statement about the data type in ARRAY[1:10] OF INTEGER is true?
A. Each element can have a different data type
B. Every element must be an INTEGER ✓
An array holds one data type only. The type after OF applies to every element.

Match the Pairs

DECLARE Prices : ARRAY[1:10] OF REAL → An array of ten elements, each of which can hold a number with a decimal part, such as 2.50
DECLARE Flags : ARRAY[1:30] OF BOOLEAN → An array of thirty elements, each of which can only hold TRUE or FALSE
The array must store ten whole-number test scores, so the element data type is INTEGER → DECLARE Scores : ARRAY[1:10] OF INTEGER
The array must store the 26 letters of the alphabet, one single character in each element → DECLARE Letters : ARRAY[1:26] OF CHAR
DECLARE Prices : ARRAY[1:10] OF INTEGER Prices[1] ← 2.50 → The array is declared OF INTEGER, so its elements can only hold whole numbers. The decimal 2.50 does not fit. The type after OF should be REAL.
DECLARE Flags : ARRAY[1:30] OF BOOLEAN Flags[1] ← "Yes" → A BOOLEAN element can only hold TRUE or FALSE. The text "Yes" is a string, so it does not match the element data type. It should be Flags[1] ← TRUE.

Key Term

ARRAY[1:10] OF INTEGER
The data type after OF decides what every element can hold. ARRAY[1:10] OF INTEGER holds ten whole-number scores; REAL, CHAR, STRING or BOOLEAN would hold other kinds of data.

Fill in the Blanks

1. DECLARE Scores : ARRAY[1:10] OF INTEGER
Hint: Type the data type that holds whole-number test scores.
2. DECLARE Prices : ARRAY[1:10] OF REAL
Hint: Type the data type that holds prices with decimal places.
3. DECLARE Letters : ARRAY[1:26] OF CHAR
Hint: Type the data type that holds a single character in each element.
4. DECLARE Present : ARRAY[1:30] OF BOOLEAN
Hint: Type the data type for yes or no flags that are TRUE or FALSE.
5. DECLARE Names : ARRAY[1:30] OF STRING Names[1] ← "Ava"
Hint: Type the data type that holds text of several characters, as stored on the next line.

Spot the Error

Question 1
A DECLARE L : ARRAY[1:3] OF TEXT
B L[1] ← 'A'
C OUTPUT L[1]
Line A — TEXT is not a data type after OF. An array of single letters is declared with CHAR: DECLARE L : ARRAY[1:3] OF CHAR.
Question 2
A DECLARE P : ARRAY[1:3] OF REAL
B P[1] ← 2.50
C P[2] ← 1.75
D P[3] ← "cheap"
Line D — The array is OF REAL, so every element must hold a number with a decimal part. The text "cheap" cannot be stored. It should be P[3] ← 3.20.
Question 3
A DECLARE L : ARRAY[1:3] OF CHAR
B L[1] ← 'AB'
C L[2] ← 'B'
D OUTPUT L[1]
Line B — A CHAR element holds exactly one character. 'AB' is two characters, so it should be L[1] ← 'A'.
Question 4
A // F: ARRAY[1:30] OF BOOLEAN
B F[1] ← TRUE
C F[2] ← FALSE
D F[3] ← 1
Line D — A BOOLEAN array can only hold TRUE or FALSE. The number 1 is an INTEGER, so it should be F[3] ← TRUE.
Question 5
A // N: ARRAY[1:5] OF STRING
B N[1] ← 42
C N[2] ← "Liam"
D OUTPUT N[1]
Line B — The array is OF STRING, so each element holds text in double quotes. 42 is an INTEGER, so it should be N[1] ← "Ava".

Student with a class code? Join your class →