Cambridge O Level Computer Science · Syllabus 2210 · Algorithm Design and Problem-Solving
Pseudocode
What is Pseudocode?
A structured way of writing an algorithm that uses program-like statements for assignment, selection, iteration, input and output but belongs to no particular programming language; Cambridge pseudocode uses upper-case keywords, Pascal-case identifiers, a left arrow for assignment and named block-ending keywords such as ENDIF, NEXT and ENDWHILE.
This definition is part of the Algorithm Design and Problem-Solving chapter in Cambridge O Level Computer Science.
Pseudocode in context
Topic 7 is about the work that happens before and around writing code. You analyse a problem (identify it, strip away what does not matter, break it into parts, and name the inputs, processes, outputs and storage), you design a solution (structure diagram, flowchart, pseudocode), you code it, and you test it with data you chose on purpose. Along the way you use a small fixed set of standard methods — linear search, bubble sort, totalling, counting, maximum, minimum, average — you protect the input with validation and verification, and you prove behaviour with trace tables and with normal, abnormal, extreme and boundary test data. Nothing in this topic requires you to be fluent in a programming language; it requires you to be exact.
Pseudocode is a way of writing an algorithm that uses the structure of a program — assignment, selection, iteration, input and output — without belonging to any programming language. Section 4 of the syllabus sets out exactly how it appears in examinations. Because Paper 2 marks logic rather than syntax, a small slip is survivable; what is not survivable is ambiguity, and the conventions below exist to remove it.
The three design notations are not three solutions to compare. They are three views of the same solution, each showing something the others hide. A structure diagram shows what the parts are; a flowchart shows the paths through them; pseudocode states each step exactly. In an exam you will normally be asked for one — but being able to move between them is what makes a flowchart question answerable when you thought in pseudocode, and the other way round.
Common mistakes with Pseudocode
- M6. “An algorithm has to be written in a programming language.” Correct An algorithm is a finite, ordered, unambiguous sequence of steps. It can be a flowchart, pseudocode, a structure diagram or ordinary written steps.
- M9. “Python syntax is accepted throughout Paper 2.” Correct Where a solution involves coding, answers must be in pseudocode. Python, Visual Basic and Java are permitted only in the final 15-mark scenario question. Why it matters A correct Python answer to an ordinary Paper 2 question is awarded no marks.
- M10. “Pseudocode does not have to be precise because it is not executable.” Correct The syllabus states that precision is required, and gives the example that x > y is acceptable while “x is greater than y” is not.
Examiner tips on Pseudocode
- Which one will the exam ask for? Read the command. “Draw a flowchart” means shapes and arrows. “Write an algorithm”, “write pseudocode” or “complete the pseudocode” means Cambridge pseudocode. “Complete the structure diagram” means fill in boxes in a hierarchy. Answering in the wrong notation is one of the few ways to write a completely correct solution and score zero.
Questions students ask about Pseudocode
Do I have to memorise the whole pseudocode guide?
No, but you do need fluency in the parts Topic 7 uses: DECLARE, assignment with ←, INPUT and OUTPUT, IF … THEN … ELSE … ENDIF, FOR … NEXT, WHILE … ENDWHILE, REPEAT … UNTIL, the relational and logical operators, and array declaration and indexing. Since the logic is what is marked rather than the syntax, a small slip is survivable — but a condition a marker cannot read is not.
Can I draw a flowchart when the question asks for pseudocode, or the other way round?
No. The command tells you the notation and answering in another one risks scoring nothing, however correct the logic is. What you can do is sketch a flowchart in rough to work out the structure, and then write the pseudocode that the question asked for.
Do I need to declare variables in a pseudocode answer?
It is good practice and takes one line each, and some questions award a mark for appropriate data types — particularly for choosing REAL where an average or a price is involved. Declaring also forces you to decide the type before you use it, which is how the “average came out as a whole number” class of error gets prevented.

