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.
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.
// 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 = ", TotalExam command words
The command word tells you what kind of answer earns the marks.
| Command word | What your answer needs |
|---|---|
| Calculate | Work out a result from the facts, figures, or information given. |
| Compare | Identify similarities and differences, and comment on them. |
| Define | Give the precise meaning. |
| Demonstrate | Show how, or give an example. |
| Describe | State the points, characteristics, and main features. |
| Evaluate | Judge the quality, importance, amount, or value. |
| Explain | Give reasons, show relationships, and support them with evidence. |
| Give | Produce an answer from source material or recall. |
| Identify | Name, select, or recognise. |
| Outline | Set out the main points. |
| Show (that) | Provide structured evidence that leads to a result. |
| State | Express in clear terms. |
| Suggest | Apply 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, orREPEAT ... 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
ROUNDandRANDOMuse the correct syntax. - You have dry-run the program with normal and edge-case inputs.