← IGCSE Computer Science Paper 2

What a constant is

A named value set once before the program runs that never changes, unlike a variable. Example: CONSTANT Pi ← 3.142 or CONSTANT HourlyRate ← 12.50 are fixed while the program runs.

Understanding What a constant is in IGCSE Computer Science Paper 2

What it does: The value 100 is given at the moment the constant is created and is never reassigned. A constant uses the keyword CONSTANT followed by its name, the ← operator and a value. DECLARE is used for variables. A fixed pay rate stays the same for the whole run. A score changes as the program runs, so it needs a variable.

Common mistakes: HourlyRate is a constant, so its value cannot be changed while the program runs. This line should assign to the variable instead: Hours ← 8. A constant is given its value with the assignment arrow ←, not =. It should be CONSTANT Pi ← 3.142.

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 307–316) and word search (Modules 296–316).

Take this worksheet further — free with Cloodit

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

Learning
Duo
A constant is a named value that can be changed many times while the program runs.
FalseTrue
Matches
CONSTANT Pi ← 3.142 Pi ← 3.14159
↓
The second line tries to change the value of a constant, but a constant is set once and cannot change while the program runs.
Applying
Meanings
Term
CONSTANT
Meaning
A named value set once before the program runs that never changes, unlike a variable. Example: CONSTANT Pi ← 3.142 or CONSTANT HourlyRate ← 12.50 are fixed while the program runs.
Practice
CONSTANT Pi ← 3.142
Testing
Gaps
Pi ← 3.142
Check Answer
Spots
2DECLARE Hours : INTEGER
3HourlyRate ← 15.00

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

The 'Gila Monster' badge — Patient Coder, 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. A constant is a named value that can be changed many times while the program runs.
A. False ✓
B. True
A constant is set once, before the program runs, and never changes. A variable is the one whose value can change.
2. Which line declares a constant in Cambridge pseudocode?
A. CONSTANT Pi ← 3.142 ✓
B. DECLARE Pi : CONSTANT
A constant uses the keyword CONSTANT followed by its name, the ← operator and a value. DECLARE is used for variables.
3. Which value is best stored as a constant?
A. Score, a number that goes up for each correct answer
B. HourlyRate, a fixed pay rate of 12.50 ✓
A fixed pay rate stays the same for the whole run. A score changes as the program runs, so it needs a variable.
4. What is the main difference between a constant and a variable?
A. A constant can change; a variable keeps the same value
B. A constant keeps the same value; a variable's value can change ✓
Variables can be given new values as the program runs. Constants are fixed.
5. When is the value of a constant set?
A. Once, before the program runs ✓
B. Again and again while the program runs
A constant is given its value once, and it then stays fixed for the whole run of the program.

Match the Pairs

CONSTANT Pi ← 3.142 → Creates a named value Pi that is fixed at 3.142 and cannot change while the program runs
CONSTANT HourlyRate ← 12.50 → Creates a named pay rate of 12.50 that stays the same every time the program uses it
A constant is set once before the program runs, so its value is written when it is named → CONSTANT MaxScore ← 100
A variable can be given new values as the program runs, unlike a constant → Score ← Score + 10
CONSTANT Pi ← 3.142 Pi ← 3.14159 → The second line tries to change the value of a constant, but a constant is set once and cannot change while the program runs.
DECLARE HourlyRate : REAL HourlyRate ← 12.50 → HourlyRate is meant to be fixed, but this declares it as a variable, so it could be changed later in the program.

Key Term

CONSTANT
A named value set once before the program runs that never changes, unlike a variable. Example: CONSTANT Pi ← 3.142 or CONSTANT HourlyRate ← 12.50 are fixed while the program runs.

Fill in the Blanks

1. CONSTANT Pi ← 3.142
Hint: Type the keyword that declares a named value that never changes.
2. CONSTANT HourlyRate ← 12.50
Hint: Type the identifier that names the fixed pay rate.
3. CONSTANT Pi ← 3.142
Hint: Type the assignment operator that sets the constant's value once.
4. CONSTANT HourlyRate ← 12.50 Pay ← Hours * HourlyRate
Hint: Type the name of the constant used to work out the pay.
5. CONSTANT Pi ← 3.142 Area ← Pi * Radius ^ 2
Hint: Type the name of the constant that holds the circle value.

Spot the Error

Question 1
A CONSTANT HourlyRate ← 12.50
B DECLARE Hours : INTEGER
C HourlyRate ← 15.00
D OUTPUT HourlyRate * Hours
Line C — HourlyRate is a constant, so its value cannot be changed while the program runs. This line should assign to the variable instead: Hours ← 8.
Question 2
A CONSTANT Pi = 3.142
B DECLARE Radius : REAL
C Radius ← 5
D OUTPUT Pi * Radius ^ 2
Line A — A constant is given its value with the assignment arrow ←, not =. It should be CONSTANT Pi ← 3.142.
Question 3
A CONSTANT MaxScore ← 100
B DECLARE Score : INTEGER
C MaxScore ← 85
D OUTPUT Score, " out of ", MaxScore
Line C — MaxScore is a constant set once at the start, so it cannot be assigned a new value. The variable Score should be assigned: Score ← 85.
Question 4
A DECLARE Total : REAL
B CONSTANT VatRate
C Total ← 50 * VatRate
D OUTPUT Total
Line B — A constant must be given its fixed value when it is set up. The line should be CONSTANT VatRate ← 0.2.
Question 5
A CONSTANT Pi ← 3.142
B DECLARE Radius : REAL
C DECLARE Area : REAL
D INPUT Pi
E Area ← Pi * Radius ^ 2
Line D — INPUT would change Pi while the program runs, but a constant never changes. The user should enter the variable instead: INPUT Radius.

Student with a class code? Join your class →