📘 Paper 2 · Topic 7: Algorithm Design & Problem Solving
7.2a Pseudocode & Flowcharts
Cambridge IGCSE Computer Science 0478 · ~16 min read · ⭐ Pro

Cambridge Pseudocode — The Full Reference

Cambridge has its own pseudocode style that is used in exams. You must learn the exact keywords and structures. The key sections are:

Input / Output

INPUT name
OUTPUT "Hello, ", name
OUTPUT score

Assignment

score ← 0
name ← "Alice"
score ← score + 10

Selection — IF

IF score >= 50 THEN
    OUTPUT "Pass"
ELSE
    OUTPUT "Fail"
ENDIF

Selection — CASE OF

CASE OF grade
    "A": OUTPUT "Excellent"
    "B": OUTPUT "Good"
    OTHERWISE: OUTPUT "Revise"
ENDCASE

Iteration — FOR loop (count-controlled)

FOR counter ← 1 TO 10
    OUTPUT counter
NEXT counter

Iteration — WHILE loop (pre-condition)

WHILE answer <> "quit" DO
    INPUT answer
ENDWHILE

Iteration — REPEAT...UNTIL (post-condition)

REPEAT
    INPUT number
UNTIL number > 0

Key difference between WHILE and REPEAT

WHILE...DOREPEAT...UNTIL
Condition checkedBefore the loop body runsAfter the loop body runs
Minimum runs0 times (may never run)At least 1 time
Stops whenCondition becomes FALSECondition becomes TRUE

Cambridge Pseudocode — Operators

OperatorMeaning
Assignment
=Equals (comparison)
<>Not equal to
< >Less than / Greater than
<= >=Less than or equal / Greater than or equal
AND OR NOTLogical operators
MODModulus (remainder after division)
DIVInteger division (whole number result)
&String concatenation (joining strings)

Flowcharts — Detailed

Flowcharts use standard symbols connected by arrows to show the flow of an algorithm. In the Cambridge exam you may be asked to:

  • Read a flowchart and describe what it does (trace through it)
  • Complete a partially drawn flowchart
  • Convert pseudocode to a flowchart or vice versa

Standard symbols

SymbolShapeUse
TerminatorOval/Rounded rectangleSTART and END of the algorithm
ProcessRectangleCalculations, assignments, actions
DecisionDiamond (two exits: YES/NO)Conditions — IF statements, loop conditions
Input/OutputParallelogram (slanted)INPUT or OUTPUT
Flow lineArrowShows direction of execution
Exam tip: In Paper 2, you will often be asked to write or complete pseudocode. Always use correct Cambridge keywords (THEN, ENDIF, ENDWHILE, NEXT, etc.) and the ← symbol for assignment. Common mistakes: using = for assignment (wrong — use ←); using Python-style indentation only with no keywords; forgetting ENDIF or ENDWHILE.
⚠️ Common Mistakes
  • Using = for assignment — in Cambridge pseudocode this is ALWAYS
  • Forgetting closing keywords: every IF needs ENDIF, every WHILE needs ENDWHILE, every FOR needs NEXT
  • WHILE checks condition BEFORE the loop body; REPEAT...UNTIL checks AFTER — confusing these loses marks
  • Not labelling YES/NO exits on the decision diamond in flowcharts
Video coming soon
Click slide or press arrow keys to navigate
✍️

Worksheet — Pseudocode & Flowcharts

5 questions · 12 marks

Q1Write pseudocode to input 10 numbers from the user and output their total. [3]
✅ Mark scheme
total ← 0 [1]; FOR counter ← 1 TO 10 — INPUT number — total ← total + number — NEXT counter [1]; OUTPUT total [1]
Q2Explain the difference between a WHILE loop and a REPEAT...UNTIL loop in Cambridge pseudocode. [3]
✅ Mark scheme
WHILE: the condition is checked before the loop body runs, so it may execute 0 times [1]; REPEAT...UNTIL: the condition is checked after the loop body runs, so it always executes at least once [1]; WHILE continues while the condition is TRUE; REPEAT...UNTIL continues until the condition becomes TRUE [1]
Q3Write pseudocode using IF...THEN...ELSE to check if a number is positive, negative, or zero. [3]
✅ Mark scheme
IF number > 0 THEN OUTPUT "Positive" [1]; ELSE IF number < 0 THEN OUTPUT "Negative" [1]; ELSE OUTPUT "Zero" ENDIF ENDIF [1] (accept valid nested IF structure)
Q4State what the MOD operator returns. Give an example. [2]
✅ Mark scheme
MOD returns the remainder after integer division [1]; e.g., 17 MOD 5 = 2 (because 17 ÷ 5 = 3 remainder 2) [1]
Q5Name the flowchart symbol that has two exits and state what they represent. [1]
✅ Mark scheme
The diamond (decision symbol) has two exits: YES (condition is true) and NO (condition is false) [1]
Quiz — Pseudocode & Flowcharts
Q 1 of 8
Score
/ 8
Click to reveal
TermDefinition
🎯

Mini Test — Pseudocode

10 minutes · mixed marks

← 7.1 Algorithm Design Topic 7: Algorithm Design Next: 7.2b Trace Tables →
🔒
Pro Content
Upgrade to access all lessons.
£7.99/month
or £59/year
Subscribe now →