Cambridge pseudocode for 0478 and 2210: the format you are marked against
0478 · 2210 · Published 2026-11-13
How this was made: Written by AI and checked by AI, including Anthropic's Claude, against the official Cambridge syllabus (0478/2210, 2026–2028, version 6). It may contain mistakes and we revise it when errors are found — spot one? Email [email protected].
Section 4 of the 0478 and 2210 syllabus sets out exactly how pseudocode appears in the exam. Your own answers don't have to be letter-perfect, since the logic matters more than the syntax, but writing in the same style makes your answers clear and avoids ambiguity. This is a guide to that format, with the mistakes students make most often.
Style rules
- Keywords are in upper case: IF, REPEAT, PROCEDURE.
- Identifiers use Pascal case (NumberOfPlayers): letters and digits only, starting with a capital letter. No underscores, and never a keyword as a name.
- Statements inside a block are indented four spaces. THEN, ELSE and CASE clauses are indented only two.
- Comments start with //.
Variables, constants and data types
The five data types are INTEGER, REAL, CHAR, STRING and BOOLEAN. A REAL literal always has a digit on both sides of the point (4.0, not 4.). A CHAR uses single quotes and a STRING double quotes. The assignment operator is ←, not =.
DECLARE Counter : INTEGER DECLARE TotalToPay : REAL CONSTANT HourlyRate ← 6.50 Counter ← Counter + 1
A constant can only be given a literal value, never another variable or an expression.
Arrays
Arrays are declared with lower and upper bounds, usually starting at 1. A 2D array gives both dimensions.
DECLARE StudentNames : ARRAY[1:30] OF STRING DECLARE Board : ARRAY[1:3, 1:3] OF CHAR StudentNames[1] ← "Ali" Board[2, 3] ← 'X'
Input, output and operators
- INPUT Answer and OUTPUT "You have ", Lives, " lives left". OUTPUT can take several values separated by commas.
- Arithmetic: + - * / and ^ for powers. Integer division uses functions: DIV(10, 3) returns 3 and MOD(10, 3) returns 1.
- Comparison: = < <= > >= and <> for 'not equal'. The results are BOOLEAN.
- Logic: only AND, OR and NOT. Use brackets to make the order explicit.
- Strings: LENGTH("Happy Days") is 10, and SUBSTRING("Computer", 1, 4) is "Comp", because positions start at 1. LCASE and UCASE change case.
- ROUND(7.456, 1) gives 7.5. RANDOM() returns a random number between 0 and 1 inclusive.
Selection
IF Answer < 0 OR Answer > 100
THEN
Correct ← FALSE
ELSE
Correct ← TRUE
ENDIF
CASE OF Move
'W' : Position ← Position - 10
'E' : Position ← Position + 10
OTHERWISE OUTPUT "Beep"
ENDCASEA CASE checks its clauses in order and runs only the first match. OTHERWISE, if used, must come last.
Loops
- FOR Index ← 1 TO 30 … NEXT Index: count-controlled. Add STEP for a different increment, which can be negative. If the start is bigger than the end, the body never runs.
- REPEAT … UNTIL condition: post-condition, so the body always runs at least once. Ideal for validation.
- WHILE condition DO … ENDWHILE: pre-condition, so the body may not run at all.
REPEAT
OUTPUT "Please enter the password"
INPUT Password
UNTIL Password = "Secret"Procedures and functions
A procedure is a complete statement and is run with CALL. A function returns one value, declares its return type with RETURNS, uses RETURN, and is only ever used inside an expression, never with CALL.
PROCEDURE Line(Size : INTEGER)
DECLARE Length : INTEGER
FOR Length ← 1 TO Size
OUTPUT '-'
NEXT Length
ENDPROCEDURE
CALL Line(60)
FUNCTION SumSquare(Number1 : INTEGER, Number2 : INTEGER) RETURNS INTEGER
RETURN Number1 * Number1 + Number2 * Number2
ENDFUNCTION
OUTPUT "Sum of squares = ", SumSquare(10, 20)Files
DECLARE LineOfText : STRING OPENFILE "FileA.txt" FOR READ READFILE "FileA.txt", LineOfText CLOSEFILE "FileA.txt"
The modes are READ and WRITE. Opening a file for WRITE creates a new file, and any data already in it is lost.
The mistakes we see most
- Using = to assign (Total = 0) instead of ←.
- Writing Python or Java outside the 15-mark scenario question. Coded answers elsewhere on Paper 2 must be pseudocode.
- Using CALL with a function, or using a procedure inside an expression.
- Missing closing keywords: ENDIF, NEXT Index, ENDWHILE, UNTIL.
- Writing conditions in words ('if x is bigger than y') instead of x > y.
- Assuming arrays and strings start at 0. In Cambridge pseudocode they usually start at 1.
Practise it on CodeArc
- Variables, data types, selection and iteration (2210)
- Strings, operators, subroutines and maintainable code (2210)
- Arrays (2210)
- File handling (2210)
- Programming — IGCSE 0478
- The 15-mark scenario question
Questions
Do I lose marks for small pseudocode syntax errors in 0478?
The syllabus says knowledge of programming language syntax is not examined and the logic matters more than the syntax. But answers must be precise: conditions such as x > y, not 'x is greater than y'.
Do arrays start at 0 or 1 in Cambridge pseudocode?
The lower bound is stated when the array is declared, for example ARRAY[1:30]. Cambridge generally uses a lower bound of 1, and string positions in SUBSTRING also start at 1.
What is the difference between a procedure and a function in Cambridge pseudocode?
A procedure is a complete statement, run with CALL. A function returns a single value, declares its type with RETURNS, and is used inside an expression without CALL.