← IGCSE Computer Science Paper 2

Layout conventions for Cambridge pseudocode

Pseudocode layout convention: keywords in UPPER CASE, identifiers in PascalCase, and lines inside a statement indented four spaces. Meta-variables use angled brackets, like <identifier>.

Understanding Layout conventions for Cambridge pseudocode in IGCSE Computer Science Paper 2

What it does: CONSTANT is an upper case keyword and MaxScore is a PascalCase identifier, so the line follows the layout convention. The lines inside the IF statement are indented by four spaces, with a further four for the nested line, which is the Cambridge layout rule. INPUT and OUTPUT are keywords, so Cambridge pseudocode writes them in capitals. Each word in an identifier starts with a capital letter, which makes it easier to read. PlayerName is clearer than playername. Meta-variables in angled brackets show what kind of item goes there. For example, DECLARE <identifier> : <data type>. You replace them with real names and types.

Common mistakes: Keywords such as DECLARE are always written in UPPER CASE. The line should be DECLARE Score : INTEGER. INPUT is a keyword, so it must be in UPPER CASE. The line should be INPUT Name.

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 347–357) and word search (Modules 337–357).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which line follows the Cambridge convention for keywords and identifiers?
DECLARE TotalScore : INTEGERdeclare totalscore : integer
Matches
declare totalscore : integer
↓
The keywords DECLARE and INTEGER are written in lower case. They must be in upper case, and the identifier should be PascalCase: DECLARE TotalScore : INTEGER
Applying
Meanings
Term
DECLARE TotalScore : INTEGER
Meaning
Pseudocode layout convention: keywords in UPPER CASE, identifiers in PascalCase, and lines inside a statement indented four spaces. Meta-variables use angled brackets, like <identifier>.
Practice
DECLARE TotalScore : INTEGER
Testing
Gaps
TotalScore : INTEGER
Check Answer
Spots
1declare Score : INTEGER
2Score ← 0

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

The 'Star Fox' badge — Frozen 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 line follows the Cambridge convention for keywords and identifiers?
A. declare totalscore : integer
B. DECLARE TotalScore : INTEGER ✓
Keywords such as DECLARE and INTEGER are written in upper case. The identifier TotalScore is written in mixed case (PascalCase).
2. Which line writes the keyword OUTPUT correctly?
A. OUTPUT "Hello" ✓
B. output "Hello"
INPUT and OUTPUT are keywords, so Cambridge pseudocode writes them in capitals.
3. Which identifier follows the mixed case (PascalCase) convention?
A. playername
B. PlayerName ✓
Each word in an identifier starts with a capital letter, which makes it easier to read. PlayerName is clearer than playername.
4. How many spaces should lines inside a statement, such as a loop body, be indented by?
A. Four spaces ✓
B. One space
Cambridge pseudocode indents lines inside a statement by four spaces so the structure is easy to see.
5. Which constant declaration follows the layout convention?
A. CONSTANT MaxScore ← 100 ✓
B. constant maxscore ← 100
CONSTANT is a keyword so it is in upper case. The identifier MaxScore uses mixed case.

Match the Pairs

DECLARE TotalScore : INTEGER → A keyword in upper case followed by an identifier in PascalCase, the standard layout for declaring a variable
<identifier> → A meta-variable in angled brackets that stands for any identifier you choose to write
Keywords such as CONSTANT are written in upper case and identifiers use PascalCase → CONSTANT MaxScore ← 100
Lines inside a statement are indented by four spaces → IF Score > 50 THEN OUTPUT "Pass" ENDIF
declare totalscore : integer → The keywords DECLARE and INTEGER are written in lower case. They must be in upper case, and the identifier should be PascalCase: DECLARE TotalScore : INTEGER
IF Age >= 16 THEN OUTPUT "Adult" ENDIF → The lines inside the IF statement are not indented. THEN and OUTPUT should be indented by four spaces.

Key Term

DECLARE TotalScore : INTEGER
Pseudocode layout convention: keywords in UPPER CASE, identifiers in PascalCase, and lines inside a statement indented four spaces. Meta-variables use angled brackets, like <identifier>.

Fill in the Blanks

1. DECLARE TotalScore : INTEGER
Hint: Type the upper case keyword that creates a new variable.
2. CONSTANT MaxScore ← 100
Hint: Type the upper case keyword that sets up a value which never changes.
3. INPUT PlayerName
Hint: Type the upper case keyword that reads a value from the user into the variable.
4. IF Score > 50 THEN OUTPUT "Pass" ENDIF
Hint: Type the upper case keyword that displays a value, on the line indented four spaces.
5. DECLARE <identifier> : <data type>
Hint: Type the meta-variable, in angled brackets, that stands for any variable name.

Spot the Error

Question 1
A declare Score : INTEGER
B Score ← 0
C OUTPUT Score
Line A — Keywords such as DECLARE are always written in UPPER CASE. The line should be DECLARE Score : INTEGER.
Question 2
A DECLARE Name : STRING
B input Name
C OUTPUT Name
Line B — INPUT is a keyword, so it must be in UPPER CASE. The line should be INPUT Name.
Question 3
A FOR Count ← 1 TO 5
B OUTPUT Count
C Total ← Total + Count
D Next Count
Line D — NEXT is a keyword, so it must be written fully in UPPER CASE, not mixed case. The line should be NEXT Count.
Question 4
A CONSTANT MaxScore ← 100
B DECLARE total_score : INTEGER
C TotalScore ← 0
Line B — Cambridge identifiers use PascalCase, with no underscores or lower-case first letter. It should be DECLARE TotalScore : INTEGER.
Question 5
A // Layout of INPUT and OUTPUT
B OUTPUT <value>
C INPUT [identifier]
Line C — Meta-variables in Cambridge pseudocode are written in angled brackets <like this>, not square brackets. It should be INPUT <identifier>.

Student with a class code? Join your class →