READ variable – prompts the user and stores the value. Only READ (or READ … with a prompt) is accepted in the exam.WRITE expression – displays the evaluated expression. Only WRITE is accepted.variable ← expressionIF condition THEN … END IF (or ELSE branch when required)FOR i ← start TO end DO … END FOR or WHILE condition DO … END WHILE# comment textExplicit declarations are not required in the exam, but they help the examiner see the intended data type.
# Declaration (optional)
INTEGER a, b, n, i
REAL total, average, C, F
CONST PI ← 3.14159
Constants are introduced with CONST and never altered after the initial assignment.
| Category | Operator(s) | Purpose | Example |
|---|---|---|---|
| Arithmetic | + | Addition | a + b |
| Arithmetic | - | Subtraction | a - b |
| Arithmetic | * | Multiplication | a * b |
| Arithmetic | / | Real division (INTEGER ÷ INTEGER → REAL) | a / b |
| Arithmetic | mod | Remainder after integer division | a mod b |
| Relational | =, <>, <, >, ≤, ≥ | Comparison (produces TRUE/FALSE) | a ≥ b |
| Logical | AND | Both conditions true | (x AND y) |
| Logical | OR | At least one condition true | (x OR y) |
| Logical | NOT | Negates a condition | NOT x |
| Order (highest → lowest) |
|---|
| 1. Parentheses ( ) |
| 2. Unary NOT |
| 3. Multiplication *, Division /, Modulo mod |
| 4. Addition +, Subtraction - |
| 5. Relational =, <>, <, >, ≤, ≥ |
| 6. Logical AND |
| 7. Logical OR |
When in doubt, enclose the intended part of an expression in parentheses – this avoids ambiguity and loss of marks.
5 / 2 = 2.5).INT() (truncates toward zero).REAL to INTEGER – the result is undefined in the exam environment.| Function | Purpose | Syntax example |
|---|---|---|
| ABS(x) | Absolute value | absVal ← ABS(-7) |
| SQRT(x) | Square root (real result) | root ← SQRT(25) |
| INT(x) | Truncate to integer (floor) | i ← INT(3.9) # i = 3 |
| POWER(x, y) | x raised to the power y | p ← POWER(2, 5) # p = 32 |
| LEN(s) | Length of a string | l ← LEN("Cambridge") |
Only the functions listed above are guaranteed to be available in the Cambridge exam environment.
= for assignment – in pseudocode = is a relational operator; assignment uses the left‑arrow ←./ always produces a real result.CONST keyword when defining a constant.LOG, EXP) – these are not permitted in the exam.# Sum, product and remainder of two integers
READ a
READ b
sum ← a + b
product ← a * b
remainder ← a mod b
WRITE "Sum = " + sum
WRITE "Product = " + product
WRITE "Remainder = " + remainder
# Eligibility based on age and test score
READ age
READ score
eligible ← (age ≥ 18) AND (score ≥ 70)
WRITE "Eligibility: " + eligible
# Pass/fail decision based on average mark
READ m1
READ m2
READ m3
average ← (m1 + m2 + m3) / 3 # real division
IF average ≥ 50 THEN
result ← "PASS"
ELSE
result ← "FAIL"
END IF
WRITE "Average = " + average
WRITE "Result = " + result
# Compute n! (n is a positive integer)
READ n
fact ← 1
FOR i ← 1 TO n DO
fact ← fact * i
END FOR
WRITE "Factorial of " + n + " = " + fact
# Celsius to Fahrenheit conversion
CONST FA ← 9 / 5 # 9/5 = 1.8 (real constant)
READ C # temperature in Celsius (REAL)
F ← FA * C + 32
WRITE "Celsius = " + C
WRITE "Fahrenheit = " + F
# Pythagoras theorem
READ x
READ y
distance ← SQRT( POWER(x,2) + POWER(y,2) )
WRITE "Distance from origin = " + distance
Multiple of 5 or 7
Write pseudocode that reads an integer n and outputs TRUE if n is a multiple of 5 or 7, otherwise FALSE.
Mark‑scheme hint: use the modulo operator and an OR logical test.
Modular arithmetic with squares
Write pseudocode that reads two numbers x and y, computes (x² + y²) mod 10, and displays the result.
Mark‑scheme hint: use POWER(x,2) and mod.
Temperature conversion
Write pseudocode that reads a temperature in Celsius, converts it to Fahrenheit using F = (9/5)·C + 32, and prints both values.
Mark‑scheme hint: declare a constant for 9/5 (or write the fraction directly).
Factorial (loop)
Write pseudocode that reads a positive integer n, calculates n! using a loop, and writes the result.
Mark‑scheme hint: a FOR loop from 1 to n is the simplest approach.
Pass/Fail using IF‑THEN‑ELSE
Write pseudocode that reads three exam marks, computes the average, and writes “PASS” if the average is at least 50, otherwise writes “FAIL”.
Mark‑scheme hint: use the relational operator ≥ inside an IF statement.
Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources, past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.