← IGCSE Computer Science Paper 2

Writing literals in Cambridge pseudocode

A fixed value written in code: a real with digits either side of the point (4.7), a CHAR in single quotes ('x'), a STRING in double quotes ("Hello"), or BOOLEAN TRUE or FALSE.

Understanding Writing literals in Cambridge pseudocode in IGCSE Computer Science Paper 2

What it does: 0.0 follows the rule because it has a digit before and after the point, so it is a valid REAL literal. BOOLEAN values are the keywords TRUE and FALSE written in capitals and without quotes. A CHAR uses single quotes. Double quotes make it a STRING. Cambridge pseudocode needs a digit on each side of the point, so .5 must be written 0.5.

Common mistakes: A REAL literal needs a digit on each side of the decimal point. It should be Price ← 4.7. A REAL literal needs a digit before the decimal point as well as after it. It should be Score ← 0.0.

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 is a correct REAL literal in Cambridge pseudocode?
4.7.7
Matches
Letter ← "x"
↓
A single CHAR is written in double quotes, which makes it a STRING. CHAR literals need single quotes: 'x'.
Applying
Meanings
Term
literal
Meaning
A fixed value written in code: a real with digits either side of the point (4.7), a CHAR in single quotes ('x'), a STRING in double quotes ("Hello"), or BOOLEAN TRUE or FALSE.
Practice
Price ← 4.7
Testing
Gaps
Total ← 0.
Check Answer
Spots
2DECLARE Grade : CHAR
3Price ← 4.

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

The 'Silverback Gorilla' badge — Savannah Master, 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 is a correct REAL literal in Cambridge pseudocode?
A. 4.7 ✓
B. .7
A real literal needs a digit on each side of the decimal point, so .7 should be written 0.7.
2. Which is the correct way to write the CHAR literal x?
A. "x"
B. 'x' ✓
A CHAR uses single quotes. Double quotes make it a STRING.
3. Which is a correct STRING literal?
A. 'Hello'
B. "Hello" ✓
A STRING uses double quotes. Single quotes are only for a single CHAR.
4. Which is a correct BOOLEAN literal?
A. TRUE ✓
B. "TRUE"
BOOLEAN literals are written as TRUE or FALSE with no quotes. With quotes it would be a STRING.
5. Which is a correct real literal for zero?
A. 0.0 ✓
B. 0.
A real literal needs a digit after the point as well as before it, so 0.0 is correct.

Match the Pairs

'x' → A CHAR literal: a single character written inside single quotes
"" → An empty STRING literal: double quotes with no characters between them
A REAL literal must have a digit on each side of the decimal point → Price ← 0.0
A BOOLEAN literal is written as TRUE or FALSE, with no quote marks → Found ← TRUE
Letter ← "x" → A single CHAR is written in double quotes, which makes it a STRING. CHAR literals need single quotes: 'x'.
Height ← .5 → The REAL literal has no digit before the decimal point. It should be written 0.5.

Key Term

literal
A fixed value written in code: a real with digits either side of the point (4.7), a CHAR in single quotes ('x'), a STRING in double quotes ("Hello"), or BOOLEAN TRUE or FALSE.

Fill in the Blanks

1. DECLARE Total : REAL Total ← 0.0
Hint: Type the digit that must follow the decimal point so zero is written as a REAL literal
2. DECLARE Initial : CHAR Initial ← 'x'
Hint: Type the data type keyword for a single character stored using single quotes
3. DECLARE Greeting : STRING Greeting ← "Hello"
Hint: Type the data type keyword for text stored using double quotes
4. DECLARE Name : STRING Name ← ""
Hint: Type the variable that is being set to a STRING literal containing no characters
5. DECLARE Found : BOOLEAN Found ← FALSE
Hint: Type the BOOLEAN literal meaning not true, because nothing has been found yet

Spot the Error

Question 1
A DECLARE Price : REAL
B DECLARE Grade : CHAR
C Price ← 4.
D Grade ← 'A'
Line C — A REAL literal needs a digit on each side of the decimal point. It should be Price ← 4.7.
Question 2
A DECLARE Name : STRING
B DECLARE Score : REAL
C Name ← "Hello"
D Score ← .0
Line D — A REAL literal needs a digit before the decimal point as well as after it. It should be Score ← 0.0.
Question 3
A Letter ← 'xy'
B OUTPUT Letter
C OUTPUT "Done"
Line A — A CHAR literal is exactly one character in single quotes. 'xy' is two characters, so it should be 'x'.
Question 4
A DECLARE Greeting : STRING
B Greeting ← "Hi"
C OUTPUT 'Hello'
D OUTPUT Greeting
Line C — A STRING literal uses double quotes. Single quotes are for a CHAR, so it should be OUTPUT "Hello".
Question 5
A DECLARE Found : BOOLEAN
B Found ← "FALSE"
C OUTPUT Found
Line B — A BOOLEAN literal is written as TRUE or FALSE with no quotes. In quotes it becomes a STRING. It should be Found ← FALSE.

Student with a class code? Join your class →