Docs

Pseudocode reference

Writing an exam-style answer

A step-by-step routine for Cambridge-style pseudocode answers: plan inputs and outputs, lay out the program, read command words, and check your work.

updated November 2, 2026

Where these conventions come from

The pseudocode reference follows the Cambridge IGCSE Computer Science (0478) conventions for 2026 to 2028, from the assessment details in the syllabus (pages 35 to 49). Choose another exam syntax in Settings and the compiler, highlighting, and autocomplete follow that board instead.

Key idea. Cambridge's printed examples use a left arrow ← for assignment. In the editor, type <-.

Seven steps for every question

Work through the same steps each time. Most logic errors come from skipping one of them.

  • Read the question and list the inputs and outputs it asks for.
  • Declare every variable and array with the right data type.
  • Set counters, totals, and flags before any loop uses them.
  • Choose selection and loop types from the conditions in the question.
  • Write the processing in small, readable blocks.
  • Output the results after processing.
  • Dry-run the program with normal values and edge cases.

Lay out the program

A clear answer has four parts in order: declarations and constants, initial values, input and processing, then output. Comments that label each part help the examiner follow your logic.

Pseudocode
// 1) Declarations and constants
DECLARE Index : INTEGER
DECLARE Value : INTEGER
DECLARE Total : INTEGER
CONSTANT MaxItems <- 5

// 2) Initialisation
Total <- 0

// 3) Input and processing
FOR Index <- 1 TO MaxItems
    INPUT Value
    Total <- Total + Value
NEXT Index

// 4) Output
OUTPUT "Total = ", Total

Exam command words

The command word tells you what kind of answer earns the marks.

Command wordWhat your answer needs
CalculateWork out a result from the facts, figures, or information given.
CompareIdentify similarities and differences, and comment on them.
DefineGive the precise meaning.
DemonstrateShow how, or give an example.
DescribeState the points, characteristics, and main features.
EvaluateJudge the quality, importance, amount, or value.
ExplainGive reasons, show relationships, and support them with evidence.
GiveProduce an answer from source material or recall.
IdentifyName, select, or recognise.
OutlineSet out the main points.
Show (that)Provide structured evidence that leads to a result.
StateExpress in clear terms.
SuggestApply your knowledge to give valid proposals or considerations.

Check before you submit

Run the program, then go through this list.

  • Every variable and array is declared with the correct data type.
  • Counters, totals, and flags have initial values.
  • The loop type fits the question: FOR, WHILE, or REPEAT ... UNTIL.
  • Every IF, CASE, and loop block has its closing keyword.
  • Procedures are called with CALL; function calls appear inside expressions.
  • The output matches what the question asks for, word for word.
  • Library routines such as ROUND and RANDOM use the correct syntax.
  • You have dry-run the program with normal and edge-case inputs.