← IGCSE Computer Science Paper 2

DECLARE a variable (7a)

Creates a variable called Counter with the data type INTEGER. Form: DECLARE <identifier> : <data type>. Use one DECLARE line per variable.

Understanding DECLARE a variable (7a) in IGCSE Computer Science Paper 2

What it does: The form is DECLARE <identifier> : <data type>, so Counter is the identifier and INTEGER is the data type. Each variable gets its own DECLARE line, so Score and GameOver are declared separately. REAL stores numbers with a decimal part. INTEGER can only store whole numbers, so it cannot hold 12.50. A BOOLEAN variable holds TRUE or FALSE. STRING is for text, so it is the wrong type for a TRUE/FALSE flag. DECLARE only creates the variable and sets its type. A value is given later using an assignment (←) or INPUT.

Common mistakes: The colon between the identifier and the data type is missing. It should be DECLARE Counter : INTEGER. Each DECLARE line creates only one variable. Lives and Level need separate DECLARE lines, so line 2 should be DECLARE Lives : INTEGER.

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 17–26) and word search (Modules 1–26).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which line correctly declares a whole-number variable called Counter?
DECLARE Counter : INTEGERDECLARE INTEGER : Counter
Matches
DECLARE Counter INTEGER
↓
The colon between the identifier and the data type is missing. It should be DECLARE Counter : INTEGER
Applying
Meanings
Term
DECLARE Counter : INTEGER
Meaning
Creates a variable called Counter with the data type INTEGER. Form: DECLARE <identifier> : <data type>. Use one DECLARE line per variable.
Practice
DECLARE Counter : INTEGER
Testing
Gaps
Counter : INTEGER
Check Answer
Spots
1DECLARE Counter INTEGER
2Counter ← 0

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

The 'Moray Eel' badge — Lurking 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 line correctly declares a whole-number variable called Counter?
A. DECLARE Counter : INTEGER ✓
B. DECLARE INTEGER : Counter
The form is DECLARE <identifier> : <data type>. The variable name comes first, then a colon, then the data type.
2. Which line declares a variable to hold a price that can have pence, such as 12.50?
A. DECLARE TotalToPay : INTEGER
B. DECLARE TotalToPay : REAL ✓
REAL stores numbers with a decimal part. INTEGER can only store whole numbers, so it cannot hold 12.50.
3. Which line declares a variable that stores only TRUE or FALSE?
A. DECLARE GameOver : STRING
B. DECLARE GameOver : BOOLEAN ✓
A BOOLEAN variable holds TRUE or FALSE. STRING is for text, so it is the wrong type for a TRUE/FALSE flag.
4. What does the DECLARE statement do?
A. It creates a variable with a name and a data type ✓
B. It gives a variable its first value from the user
DECLARE only creates the variable and sets its type. A value is given later using an assignment (←) or INPUT.
5. Which is the correct way to declare two variables, Score and Lives, both INTEGER?
A. DECLARE Score : INTEGER DECLARE Lives : INTEGER ✓
B. DECLARE Score, Lives : INTEGER
In this course, use one DECLARE line per variable. Each variable gets its own line.

Match the Pairs

DECLARE TotalToPay : REAL → Creates a variable called TotalToPay that stores a real number, such as a price with decimals
DECLARE GameOver : BOOLEAN → Creates a variable called GameOver that can only store TRUE or FALSE
A DECLARE line gives the variable name first, then a colon, then its data type → DECLARE Counter : INTEGER
Use one DECLARE line for each variable, so two variables need two lines → DECLARE Score : INTEGER DECLARE GameOver : BOOLEAN
DECLARE Counter INTEGER → The colon between the identifier and the data type is missing. It should be DECLARE Counter : INTEGER
DECLARE Counter, Total : INTEGER → Two variables are declared on one line. Each variable needs its own DECLARE line

Key Term

DECLARE Counter : INTEGER
Creates a variable called Counter with the data type INTEGER. Form: DECLARE <identifier> : <data type>. Use one DECLARE line per variable.

Fill in the Blanks

1. DECLARE Counter : INTEGER
Hint: Type the keyword that creates a new variable.
2. DECLARE TotalToPay : REAL
Hint: Type the data type for a number that can have decimal places, like a price.
3. DECLARE GameOver : BOOLEAN
Hint: Type the data type that can only store TRUE or FALSE.
4. DECLARE Counter : INTEGER
Hint: Type the symbol that separates the identifier from its data type.
5. DECLARE Counter : INTEGER Counter ← 0
Hint: Type the data type for whole numbers, as the value 0 is assigned below.

Spot the Error

Question 1
A DECLARE Counter INTEGER
B Counter ← 0
C OUTPUT Counter
Line A — The colon between the identifier and the data type is missing. It should be DECLARE Counter : INTEGER.
Question 2
A DECLARE Score : INTEGER
B DECLARE Lives, Level : INTEGER
C Score ← 0
Line B — Each DECLARE line creates only one variable. Lives and Level need separate DECLARE lines, so line 2 should be DECLARE Lives : INTEGER.
Question 3
A DECLARE Lives : INTEGER
B DECLARE GameOver : BOOLEAN
C DECLARE Score : INTEGER
D DECLARE Name : TEXT
Line D — TEXT is not a Cambridge pseudocode data type. A word or sentence is stored as a STRING, so it should be DECLARE Name : STRING.
Question 4
A DEFINE TotalToPay : REAL
B TotalToPay ← 12.5
C OUTPUT TotalToPay
Line A — The keyword to create a variable is DECLARE, not DEFINE. It should be DECLARE TotalToPay : REAL.
Question 5
A DECLARE Counter : INTEGER
B DECLARE GameOver : BOOL
C Counter ← 0
D GameOver ← FALSE
Line B — BOOL is not a valid data type keyword. The full keyword must be used: DECLARE GameOver : BOOLEAN.

Student with a class code? Join your class →