← IGCSE Computer Science Paper 2

Cambridge 0478 pseudocode conventions

Cambridge pseudocode writes keywords like IF, FOR and WHILE in capitals and indents the lines inside each structure, so the code is easy to read.

Understanding Cambridge 0478 pseudocode conventions in IGCSE Computer Science Paper 2

What it does: The OUTPUT line is indented inside the FOR loop, showing it belongs to the loop body. Two separate assignments are written on two separate lines, one statement per line. Cambridge pseudocode writes keywords such as FOR, TO and NEXT in capital letters. Comments begin with // so they are not mistaken for instructions. Each statement goes on its own line, which keeps the algorithm clear and easy to trace. Keywords are always written in capitals, including closing keywords like ENDWHILE. Indentation is for readability. It shows which lines belong inside a loop or selection. INPUT is a keyword, so it is written in capital letters.

Common mistakes: NEXT is a keyword, so Cambridge pseudocode writes it in capital letters. The line should be 'NEXT Count'. The keyword WHILE is written in lowercase. Cambridge pseudocode keywords are in capital letters, so it should be 'WHILE Count < 3 DO'.

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 254–264) and word search (Modules 254–274).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which line follows Cambridge 0478 pseudocode conventions for keywords?
FOR Count ← 1 TO 10for Count ← 1 to 10
Matches
if Score > 50 then OUTPUT "Pass" endif
↓
The keywords if, then and endif are in lower case; Cambridge pseudocode writes them in capitals (IF, THEN, ENDIF)
Applying
Meanings
Term
UPPERCASE keywords
Meaning
Cambridge pseudocode writes keywords like IF, FOR and WHILE in capitals and indents the lines inside each structure, so the code is easy to read.
Practice
// Add up five marks
Testing
Gaps
Index ← 1 TO 5
Check Answer
Spots
3 Total ← Total + Count
4next Count

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

The 'Seahorse' badge — Range Rider, 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 Cambridge 0478 pseudocode conventions for keywords?
A. FOR Count ← 1 TO 10 ✓
B. for Count ← 1 to 10
Cambridge pseudocode writes keywords such as FOR, TO and NEXT in capital letters.
2. Which version shows the correct indentation?
A. FOR i ← 1 TO 5 OUTPUT i NEXT i ✓
B. FOR i ← 1 TO 5 OUTPUT i NEXT i
Lines inside a loop are indented so the body of the loop is easy to see.
3. Which line is a correct Cambridge pseudocode comment?
A. Add the mark to the total
B. // Add the mark to the total ✓
Comments begin with // so they are not mistaken for instructions.
4. Which layout follows the one statement per line convention?
A. Total ← 0 Count ← 0 ✓
B. Total ← 0 Count ← 0
Each statement goes on its own line, which keeps the algorithm clear and easy to trace.
5. Where should the OUTPUT line be written inside this IF structure?
A. IF Mark >= 50 THEN OUTPUT "Pass" ENDIF
B. IF Mark >= 50 THEN OUTPUT "Pass" ENDIF ✓
The line inside an IF is indented. IF and ENDIF line up with each other.

Match the Pairs

// Add each mark to Total → A comment: two slashes start a note for the reader that is not part of the algorithm's steps
FOR Index ← 1 TO 10 → Keywords FOR and TO are written in capital letters so they stand out from variable names
Lines inside a loop or IF are indented so the structure is easy to see → FOR Count ← 1 TO 5 OUTPUT Count NEXT Count
Each line holds one statement only → Total ← 0 Count ← 0
if Score > 50 then OUTPUT "Pass" endif → The keywords if, then and endif are in lower case; Cambridge pseudocode writes them in capitals (IF, THEN, ENDIF)
WHILE Num < 10 DO Num ← Num + 1 ENDWHILE → The line inside the WHILE loop is not indented, so the loop body is hard to see

Key Term

UPPERCASE keywords
Cambridge pseudocode writes keywords like IF, FOR and WHILE in capitals and indents the lines inside each structure, so the code is easy to read.

Fill in the Blanks

1. FOR Index ← 1 TO 5 OUTPUT Index NEXT Index
Hint: Type the keyword, written in capital letters, that starts a loop with a set number of repeats.
2. IF Score >= 50 THEN OUTPUT "Pass" ENDIF
Hint: Type the capitalised keyword that comes straight after the IF condition.
3. Total ← 0 // add each mark to the total Total ← Total + Mark
Hint: Type the symbol that starts a comment line in Cambridge pseudocode.
4. WHILE Count <= 10 DO Count ← Count + 1 ENDWHILE
Hint: Type the capitalised keyword that closes a WHILE loop.
5. REPEAT Num ← Num + 1 UNTIL Num = 5
Hint: Type the capitalised keyword that ends a loop and holds the stopping condition.

Spot the Error

Question 1
A Total ← 0
B FOR Count ← 1 TO 3
C Total ← Total + Count
D next Count
E OUTPUT Total
Line D — NEXT is a keyword, so Cambridge pseudocode writes it in capital letters. The line should be 'NEXT Count'.
Question 2
A Count ← 0
B while Count < 3 DO
C OUTPUT Count
D Count ← Count + 1
E ENDWHILE
Line B — The keyword WHILE is written in lowercase. Cambridge pseudocode keywords are in capital letters, so it should be 'WHILE Count < 3 DO'.
Question 3
A INPUT Mark
B IF Mark >= 50 THEN
C OUTPUT "Pass"
D else
E OUTPUT "Fail"
F ENDIF
Line D — ELSE is a keyword and must be in capital letters. It should be 'ELSE'.
Question 4
A DECLARE Total : INTEGER
B # Start the total at zero
C Total ← 0
Line B — Cambridge pseudocode comments start with //, not #. The # style belongs to Python. It should be '// Start the total at zero'.
Question 5
A DECLARE Total : INTEGER
B DECLARE Count : INTEGER
C Total ← 0 Count ← 0
D Count ← 0
Line C — Two statements are squeezed onto one line. Cambridge pseudocode uses one statement per line, so this line should be just 'Total ← 0' and 'Count ← 0' stays on its own line.

Student with a class code? Join your class →