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

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

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"
ENDCASE

A CASE checks its clauses in order and runs only the first match. OTHERWISE, if used, must come last.

Loops

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

Practise it on CodeArc

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.