← IGCSE Computer Science Paper 2

A constant's value must be a literal

A constant must be set to a literal value, such as 6.50. It cannot be given a variable, another constant or an expression like Rate * 2.

Understanding A constant's value must be a literal in IGCSE Computer Science Paper 2

What it does: 100 is a literal number, so this is a correct constant declaration. "Oakfield" is a string literal, so it can be the value of a constant. A constant can only be set to a literal. Rate * 2 has to be calculated, so it is an expression. "Hello" is a STRING literal. UCASE(Word) is a function call using a variable, so it is not a literal. Variables, other constants and expressions must never be used as a constant's value.

Common mistakes: A constant's value must be a literal. Price * 0.2 uses a variable in an expression. It should be CONSTANT VatRate ← 0.2. Rate * 2 is an expression, so it cannot be a constant's value. Use a literal: CONSTANT Double ← 13.00.

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 317–326) and word search (Modules 317–336).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which constant declaration is valid in Cambridge pseudocode?
CONSTANT Total ← Rate * 2CONSTANT Rate ← 6.50
Matches
CONSTANT Copy ← Rate
↓
The constant is set to another constant (Rate), not a literal. Use a literal such as CONSTANT Copy ← 6.50.
Applying
Meanings
Term
CONSTANT Rate ← 6.50
Meaning
A constant must be set to a literal value, such as 6.50. It cannot be given a variable, another constant or an expression like Rate * 2.
Practice
CONSTANT Rate ← 6.50
Testing
Gaps
Rate ← 6.50
Check Answer
Spots
1DECLARE Price : REAL
2CONSTANT VatRate ← Price * 0.2

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

The 'Snow Leopard' badge — Silent 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 constant declaration is valid in Cambridge pseudocode?
A. CONSTANT Rate ← 6.50 ✓
B. CONSTANT Total ← Rate * 2
A constant must be given a literal value such as 6.50. Rate * 2 is an expression, so it is not allowed.
2. Which constant declaration is NOT valid?
A. CONSTANT Copy ← Rate ✓
B. CONSTANT MaxScore ← 100
Copy ← Rate tries to use another identifier as the value. A constant's value must be a literal like 100.
3. True or false: CONSTANT Pi ← 3.14 is a valid constant declaration.
A. True, 3.14 is a literal value ✓
B. False, a constant cannot hold a REAL value
3.14 is a REAL literal, so it is a valid value for a constant.
4. Why is CONSTANT Total ← Rate * 2 invalid?
A. The name Total is too long
B. The value is an expression, not a literal ✓
A constant can only be set to a literal. Rate * 2 has to be calculated, so it is an expression.
5. Which one gives a constant a literal value?
A. CONSTANT Greeting ← UCASE(Word)
B. CONSTANT Greeting ← "Hello" ✓
"Hello" is a STRING literal. UCASE(Word) is a function call using a variable, so it is not a literal.

Match the Pairs

CONSTANT Rate ← 6.50 → Valid: the constant is set to the literal value 6.50
CONSTANT Total ← Rate * 2 → Not valid: the value is an expression, not a literal
A constant's value must be a literal, so a number written directly is allowed → CONSTANT MaxScore ← 100
A constant's value must be a literal, so a text value written directly in quotes is allowed → CONSTANT School ← "Oakfield"
CONSTANT Copy ← Rate → The constant is set to another constant (Rate), not a literal. Use a literal such as CONSTANT Copy ← 6.50.
CONSTANT Tax ← Price * 0.2 → The value is an expression using a variable. Use a literal such as CONSTANT Tax ← 0.2.

Key Term

CONSTANT Rate ← 6.50
A constant must be set to a literal value, such as 6.50. It cannot be given a variable, another constant or an expression like Rate * 2.

Fill in the Blanks

1. CONSTANT Rate ← 6.50
Hint: Type the keyword that declares a named value which can never change while the program runs.
2. CONSTANT Rate ← 6.50
Hint: Type the operator that sets the constant to its literal value (typed as <-).
3. // The maximum score is 100 CONSTANT MaxScore ← 100
Hint: Type the literal value described in the comment. A constant must be given a fixed value, not a variable or an expression.
4. CONSTANT Rate ← 5 // Literal for double the rate CONSTANT Double ← 10
Hint: A constant cannot be set to Rate * 2, so type the literal number that equals double the rate.
5. DECLARE Count : INTEGER CONSTANT Limit ← 10
Hint: Type the keyword used for a value set once to a literal, not the one used for a variable.

Spot the Error

Question 1
A DECLARE Price : REAL
B CONSTANT VatRate ← Price * 0.2
C Price ← 10.00
D OUTPUT Price * VatRate
Line B — A constant's value must be a literal. Price * 0.2 uses a variable in an expression. It should be CONSTANT VatRate ← 0.2.
Question 2
A CONSTANT Rate ← 6.50
B CONSTANT Double ← Rate * 2
C OUTPUT Rate, Double
Line B — Rate * 2 is an expression, so it cannot be a constant's value. Use a literal: CONSTANT Double ← 13.00.
Question 3
A CONSTANT Rate ← 6.50
B DECLARE Hours : INTEGER
C Hours ← 4
D CONSTANT Copy ← Rate
Line D — A constant cannot be set to another constant. Rate is a name, not a literal. It should be CONSTANT Copy ← 6.50.
Question 4
A DECLARE Name : STRING
B CONSTANT School ← Name
C Name ← "Sam"
D OUTPUT Name, School
Line B — A constant cannot be given a variable. Name is a variable, not a literal. It should be CONSTANT School ← "Oakwood".
Question 5
A CONSTANT Width ← 4
B CONSTANT Height ← 5
C CONSTANT Area ← Width * Height
D OUTPUT Area
Line C — Width * Height is an expression made from two constants. A constant needs a literal value: CONSTANT Area ← 20.

Student with a class code? Join your class →