← IGCSE Computer Science Paper 2

Writing literals in pseudocode

Literals have fixed forms: CHAR in single quotes, STRING in double quotes, REAL with a digit each side of the point, BOOLEAN as TRUE or FALSE in capitals.

Understanding Writing literals in pseudocode in IGCSE Computer Science Paper 2

What it does: Writing 4.0 gives a digit before and after the point, so it is a valid REAL literal. 4. is not valid. BOOLEAN values are the keywords TRUE and FALSE in upper case, with no quotes around them. A CHAR literal uses single quotes. Double quotes make it a STRING, even when it holds only one character.

Common mistakes: A STRING literal must be in double quotes. Single quotes are only for one CHAR. It should be Name ← "Sam". A REAL literal needs a digit on both sides of the decimal point. 4. is wrong and should be 4.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 146–155) and word search (Modules 146–165).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which is the correct way to write the single character Y as a CHAR literal in pseudocode?
'Y'"Y"
Matches
Grade ← "A" (Grade is a CHAR)
↓
A CHAR literal must use single quotes, not double quotes. Double quotes make it a STRING. It should be 'A'.
Applying
Meanings
Term
'Y' "Yes" 4.0 TRUE
Meaning
Literals have fixed forms: CHAR in single quotes, STRING in double quotes, REAL with a digit each side of the point, BOOLEAN as TRUE or FALSE in capitals.
Practice
DECLARE Grade : CHAR
Testing
Gaps
DECLARE Grade :
Check Answer
Spots
1Name ← 'Sam'
2Age ← 15

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

The 'Golden Eagle' badge — High Flyer, 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 the correct way to write the single character Y as a CHAR literal in pseudocode?
A. 'Y' ✓
B. "Y"
A CHAR literal uses single quotes. Double quotes make it a STRING, even when it holds only one character.
2. Which is the correct way to write the word Yes as a STRING literal?
A. 'Yes'
B. "Yes" ✓
A STRING literal uses double quotes. Single quotes are only for one CHAR.
3. Which is a correct empty STRING literal?
A. ''
B. "" ✓
An empty string is two double quotes with nothing between them. Single quotes must hold exactly one character, so '' is not valid.
4. Which is the correct way to write the REAL number four?
A. 4.0 ✓
B. 4.
A REAL literal needs a digit on both sides of the decimal point, so 4.0 is correct and 4. is not.
5. Which is a correct REAL literal for half?
A. 0.5 ✓
B. .5
There must be a digit before the point as well as after it, so write 0.5 and not .5.

Match the Pairs

'Y' → A CHAR literal: one character inside single quotes
"" → An empty STRING literal: double quotes with nothing between them
A REAL literal needs a digit on both sides of the decimal point → Price ← 4.0
A BOOLEAN literal is TRUE or FALSE, written in capitals → IsValid ← TRUE
Grade ← "A" (Grade is a CHAR) → A CHAR literal must use single quotes, not double quotes. Double quotes make it a STRING. It should be 'A'.
Total ← 4. → A REAL literal needs a digit after the decimal point. 4. should be written as 4.0.

Key Term

'Y' "Yes" 4.0 TRUE
Literals have fixed forms: CHAR in single quotes, STRING in double quotes, REAL with a digit each side of the point, BOOLEAN as TRUE or FALSE in capitals.

Fill in the Blanks

1. DECLARE Grade : CHAR // Store the letter A Grade ← 'A'
Hint: Type the data type that matches a single character written in single quotes.
2. DECLARE Name : STRING // Start with no text at all Name ← ""
Hint: Type the data type that matches an empty pair of double quotes, which holds text of any length.
3. DECLARE Price : REAL // The price is exactly four Price ← 4.0
Hint: Type the REAL literal for four, with a digit on both sides of the decimal point.
4. DECLARE Found : BOOLEAN // Nothing has been found yet Found ← FALSE
Hint: Type the BOOLEAN literal meaning not true, written in capital letters.
5. DECLARE Temp : INTEGER // Three degrees below zero Temp ← -3
Hint: Type the INTEGER literal for a negative three: a minus sign and a whole number, with no quotes or decimal point.

Spot the Error

Question 1
A Name ← 'Sam'
B Age ← 15
C OUTPUT Name, Age
Line A — A STRING literal must be in double quotes. Single quotes are only for one CHAR. It should be Name ← "Sam".
Question 2
A DECLARE Total : REAL
B Qty ← 3
C Total ← Qty * 4.
D OUTPUT Total
Line C — A REAL literal needs a digit on both sides of the decimal point. 4. is wrong and should be 4.0.
Question 3
A DECLARE Found : BOOLEAN
B DECLARE Count : INTEGER
C Count ← 0
D Found ← false
E OUTPUT Found
Line D — BOOLEAN values are written in capitals as TRUE or FALSE. It should be Found ← FALSE.
Question 4
A DECLARE Initial : CHAR
B DECLARE Name : STRING
C Name ← "Maya"
D Initial ← "M"
Line D — Initial is a CHAR, so its literal goes in single quotes. Double quotes make it a STRING. It should be Initial ← 'M'.
Question 5
A Temp ← .5
B OUTPUT Temp
C Temp ← Temp + 1.0
Line A — A REAL literal needs a digit before the decimal point as well as after it. It should be Temp ← 0.5.

Student with a class code? Join your class →