Cambridge O Level 2210 · IGCSE 0478 / 0984

Cambridge O Level Pseudocode Tutorial

A free Paper 2 tutorial for Cambridge O Level Computer Science 2210. The language is the same as IGCSE 0478 and 0984, so one set of keywords covers both courses. Every snippet below runs in this site's compiler — not a screenshot, not a PDF.

Independent learning tool, not an official Cambridge International product. Write the syllabus forms (DECLARE, <-, ENDIF, NEXT) so a marker can follow the algorithm on paper.

Who this Cambridge O Level pseudocode tutorial is for

Paper 2 (Algorithms, Programming and Logic) is where 2210 students write algorithms, complete trace tables, and read printed pseudocode. The questions are not “describe a computer system”. They are “write the algorithm”, “correct the error”, “dry-run this loop”.

If you have been using Python print, = for assignment, or for i in range, this page is the translation layer into Cambridge form. If you already know the keywords, skip to the Paper 2 Path and practise with an autograder.

  • O Level 2210 — this is the syllabus named in the title. Section 8 of the subject content is the programming language used here.
  • IGCSE 0478 and 0984 — same Paper 2 pseudocode. Follow this tutorial as-is.
  • AS & A Level 9618 — start here for the shared core, then use the syntax guide for records, pointers, classes and random-access files.

Your first Cambridge program

The smallest useful program prints a line. Keywords are UPPERCASE in the exam. Strings use double quotes. This interpreter also accepts lowercase, but write the Cambridge form so muscle memory matches the paper.

OUTPUT "Hello, World!"
Output
Hello, World!

Several values on one OUTPUT are separated by commas. There is no print(), no console.log, and no semicolon. Comments start with // and run to the end of the line.

Next: open Level 1 — OUTPUT a string and press Check. The path will not let a Python habit through.

DECLARE, types and assignment

Cambridge wants identifiers named before they are used. DECLARE Score : INTEGER is the form. Then assignment is an arrow, not an equals sign: Score <- 42. On paper, = means “is equal to” inside a condition.

DECLARE Score : INTEGER
Score <- 42
OUTPUT "Your score is ", Score
Output
Your score is 42

The five basic types on 2210 / 0478 Paper 2:

  • INTEGER — whole numbers, including negatives
  • REAL — numbers that may have a fractional part
  • CHAR — a single character
  • STRING — zero or more characters
  • BOOLEANTRUE or FALSE

Constants use CONSTANT MaxSize <- 30. Integer division is DIV; remainder is MOD. Those two operators show up on almost every paper that needs grouping or wrapping an index.

INPUT and the IPO skeleton

Most 15-mark algorithms start by reading data. INPUT Name pauses until a value is provided. An optional string after a comma is a prompt — useful here, optional on paper.

DECLARE Name : STRING
INPUT Name, "What is your name? "
OUTPUT "Hello, ", Name
Output
Hello, Ada

Examiners mark input → process → output. If you OUTPUT before you INPUT, the trace table will not match the mark scheme. Declare, read, calculate, print — in that order — unless the question already pre-populates an array.

IF, ELSE and CASE OF

Selection needs a closer. IF ends with ENDIF. Remember THEN. Extra branches are ELSEIF (one word) and ELSE. Conditions use = < > <= >= and not-equal <> — never !=.

DECLARE Mark : INTEGER
INPUT Mark
IF Mark >= 50 THEN
    OUTPUT "Pass"
ELSE
    OUTPUT "Fail"
ENDIF
Output
Pass

CASE OF is cleaner when one variable has several discrete labels. Close it with ENDCASE and give a fallback with OTHERWISE. On 2210 you will also see nested IF inside a loop — indent the body so the marker can see which ENDIF belongs where.

FOR, WHILE and REPEAT UNTIL

Pick the loop the question is describing, not the one you used last week.

  • FOR Counter <- 1 TO 5 ... NEXT Counter — you know how many times. Count-controlled.
  • WHILE Condition DO ... ENDWHILE — test first. May run zero times. Pre-condition.
  • REPEAT ... UNTIL Condition — body always runs once. Post-condition. The UNTIL test is the stop condition (loop while it is still false).
DECLARE Counter : INTEGER
FOR Counter <- 1 TO 5
    OUTPUT Counter
NEXT Counter
Output
1
2
3
4
5

Paper 2 loves a totaller (Total <- Total + Value), a counter, and a BOOLEAN flag inside these loops. Initialise before the loop. Forget that and the first trace-table row is already wrong.

Arrays are 1-based

Unless the question says otherwise, the first element is index 1: DECLARE Names : ARRAY[1:30] OF STRING. Two-dimensional arrays use ARRAY[1:rows, 1:cols]. A linear search walks 1 TO n with a Found flag and stops when the item is found — that algorithm is in almost every 2210 series.

DECLARE Names : ARRAY[1:3] OF STRING
Names[1] <- "Ada"
Names[2] <- "Ben"
Names[3] <- "Cara"
OUTPUT Names[1]
Output
Ada

Strings are not arrays of characters in the IGCSE/O Level subset. Use LENGTH and SUBSTRING(ThisString, Start, Length) with a 1-based start position — another silent Python trap.

Procedures and functions

A PROCEDURE does work (often OUTPUT) and does not return a value. A FUNCTION returns a typed result with RETURNS / RETURN. Call a procedure with CALL. The 2210 guide expects at most three parameters on a student-designed routine.

PROCEDURE Greet(Name : STRING)
    OUTPUT "Hello, ", Name
ENDPROCEDURE

CALL Greet("Ada")
Output
Hello, Ada

Library functions you must recognise: LENGTH, SUBSTRING, ROUND, INT, RANDOM, LCASE, UCASE, ASC, CHR. Worked examples live in the procedures section of the guide.

Text files

O Level file handling is sequential text: OPENFILE "Data.txt" FOR READ (or WRITE / APPEND), then READFILE / WRITEFILE, then CLOSEFILE. A read loop continues until EOF(FileName). This compiler simulates files in the browser — the keywords you type are the ones on the paper.

Trace tables

A trace table is a dry run: one column per variable (and sometimes OUTPUT), one row each time a watched variable changes. Cambridge will give you the headings. You fill cells, not rewrite the algorithm.

The editor can emit a trace while the program runs. Use it to check your paper trace, then put the compiler away and do the next one by hand — the exam will not highlight line 7 for you. Open a blank compiler and turn on the trace table from the output pane.

Exam traps this compiler will catch

Habit from another languageCambridge O Level / IGCSE form
print(), console.logOUTPUT
= to store a value<- to store, = only to compare
!= or /=<>
for i in range(5):FOR I <- 1 TO 5NEXT I
Arrays start at 0Arrays start at 1 unless DECLARE says otherwise
END IF, ENDFOR, bare ENDENDIF, NEXT <var>, ENDWHILE, ENDCASE

Error messages here name the IGCSE/O Level equivalent instead of dumping parser jargon. That is deliberate: the paper will not.

Interactive Paper 2 Path (write, run, check)

Reading a tutorial is not the exam skill. The sequenced path is: a short lesson, a starter in the editor, then Check against expected output. Levels 1–3 are free. This is the 2210 / 0478 programming language only — no A Level OOP in the path.

  1. Level 1 · Run · syllabus 8.1.3Free
    OUTPUT, comments, and <- not =
  2. Level 2 · Values · syllabus 8.1.1–8.1.2Free
    DECLARE, types, CONSTANT, DIV and MOD
  3. Level 3 · Input · syllabus 8.1.3, 7.2Free
    INPUT → process → OUTPUT
  4. Level 4 · Branch · syllabus 8.1.4b, 8.1.5
    IF / CASE with both branches closed
  5. Level 5 · Repeat · syllabus 8.1.4c–d
    FOR, WHILE, REPEAT, totalling and counting
  6. Level 6 · Text · syllabus 8.1.4e
    LENGTH and SUBSTRING (1-based)
  7. Level 7 · Arrays · syllabus 8.2, 7.4
    ARRAY[1:n], fill loops, linear search
  8. Level 8 · Routines · syllabus 8.1 procedures/functions
    PROCEDURE vs FUNCTION, library functions
  9. Level 9 · Files · syllabus 8.3
    OPENFILE, READFILE, WRITEFILE, EOF
  10. Level 10 · Paper · syllabus 7.4–7.9, 9, 10
    Validation, trace tables, bubble sort

Cambridge O Level pseudocode FAQ

Is Cambridge O Level 2210 the same as IGCSE 0478 for Paper 2?

For algorithms and programming, yes. Cambridge O Level Computer Science 2210 Paper 2 uses the same pseudocode language as IGCSE 0478 and 0984: DECLARE, <-, INPUT/OUTPUT, IF, CASE, FOR, WHILE, REPEAT, arrays, procedures, functions and text files.

This tutorial is written for 2210. IGCSE students can follow it without changing a line. A Level 9618 adds records, pointers, classes and random-access files — those are in the syntax guide, not required for O Level.

Is this an official Cambridge International tutorial?

No. It is an independent Paper 2 tutorial. The keywords and layout follow the forms in the 2210 / 0478 syllabuses so exam answers look familiar, but this site is not affiliated with or endorsed by Cambridge Assessment International Education.

Where do I practise after reading this tutorial?

Open the interactive Paper 2 Path (https://pseudocode-compiler.sherlemious.com/learn) and start at Level 1 — you write, run and check in the same compiler. Levels 1–3 are free.

Then attempt autograded questions (https://pseudocode-compiler.sherlemious.com/practice) and, when you can finish a short algorithm without looking up keywords, sit a timed mock.

Can I write Python instead of pseudocode in the 2026 paper?

From 2026, IGCSE 0478 Paper 2 also allows Python, Visual Basic or Java. O Level 2210 still trains the syllabus pseudocode in this tutorial because that is the language the paper prints in questions, trace tables and mark schemes.

If you will sit the paper in Python, learn the Cambridge forms first, then use the Python view in the compiler. Do not paste Python into the pseudocode editor.

Do I lose marks if my pseudocode is not identical to the syllabus guide?

Markers award the logic of a working algorithm. They are not a compiler. Using DECLARE, <-, ENDIF and NEXT still helps: the marker can see the block structure, and you will read the printed questions faster.

This interpreter accepts a few conveniences (omitting THEN, using = for assignment). The paper wants the Cambridge forms. Write those here so the habit sticks.

More compiler, plan and teacher answers are in the site FAQ.