ALL CAPS (e.g. INPUT, OUTPUT, IF, ELSE, FOR, WHILE, CASE, ENDCASE, PROC, FUNC).IF…ENDIF, FOR…ENDFOR, WHILE…ENDWHILE, CASE…ENDCASE, PROC…ENDPROC).# or //.camelCase or snake_case consistently.UPPERSNAKECASE.| Section | Purpose | Typical Keywords |
|---|---|---|
| Input | Obtain data from the user, a file or another system. | INPUT, READ |
| Process | Perform calculations, decisions, loops, recursion, or call procedures/functions. | SET, CALCULATE, IF, ELSE, ENDIF, FOR, ENDFOR, WHILE, ENDWHILE, CASE, ENDCASE, CALL, RETURN |
| Output | Present the result to the user, a file or another system. | OUTPUT, DISPLAY, PRINT, WRITE |
# Assign a constantSET TAX_RATE ← 0.20
# Determine pass/failIF mark ≥ 40 THEN
SET result ← "PASS"
ELSE
SET result ← "FAIL"
ENDIF
| Loop Type | Purpose | Keywords | Typical Use |
|---|---|---|---|
| Count‑controlled (pre‑condition) | Known number of repetitions | FOR i ← 1 TO n DO … ENDFOR | Processing an array, summing n numbers |
| Condition‑controlled (pre‑condition) | Repeat while a condition is true | WHILE condition DO … ENDWHILE | Input validation, searching |
| Condition‑controlled (post‑condition) | Execute at least once | REPEAT … UNTIL condition | Menu‑driven programs |
# Grade from markINPUT mark
CASE mark OF
0..39: SET grade ← "F"
40..49: SET grade ← "D"
50..59: SET grade ← "C"
60..69: SET grade ← "B"
70..100: SET grade ← "A"
ENDCASE
OUTPUT grade
# Factorial (n!)FUNC factorial(n)
IF n = 0 THEN
RETURN 1
ELSE
RETURN n * factorial(n-1)
ENDIF
ENDFUNC
INPUT n
SET result ← factorial(n)
OUTPUT result
# Procedure – calculates net payPROC calculateNetPay(grossPay, netPay)
IF grossPay > 500 THEN
SET netPay ← grossPay * 0.80 # 20 % tax
ELSE
SET netPay ← grossPay
ENDIF
ENDPROC
# Main algorithm
INPUT name, hoursWorked, hourlyRate
SET grossPay ← hoursWorked * hourlyRate
CALL calculateNetPay(grossPay, netPay)
OUTPUT name, netPay
Complex problems are broken into smaller, manageable sub‑algorithms. Each sub‑algorithm can be written as a separate procedure or function and then CALLed from the main algorithm.
#-------------------------------------------------# MAIN
#-------------------------------------------------
INPUT name, hoursWorked, hourlyRate
CALL computeGrossPay(hoursWorked, hourlyRate, grossPay)
CALL applyTax(grossPay, netPay)
OUTPUT name, netPay
#-------------------------------------------------
# PROCEDURE: computeGrossPay
#-------------------------------------------------
PROC computeGrossPay(hours, rate, gross)
SET gross ← hours * rate
ENDPROC
#-------------------------------------------------
# PROCEDURE: applyTax
#-------------------------------------------------
PROC applyTax(gross, net)
IF gross > 500 THEN
SET net ← gross * 0.80
ELSE
SET net ← gross
ENDIF
ENDPROC
CONST MAX_STUDENTS ← 30SET total ← 0
# Input marks for a class and calculate the averageINPUT n # n ≤ MAX_STUDENTS
FOR i ← 1 TO n DO
INPUT marks[i]
SET total ← total + marks[i]
ENDFOR
SET average ← total / n
OUTPUT average
# Record for a studentTYPE Student
name : STRING
id : INTEGER
mark : INTEGER
ENDTYPE
SET student1.name ← "Alice"
SET student1.id ← 1023
SET student1.mark ← 78
OUTPUT student1.name, student1.mark
FOR i ← 1 TO n is O(n)). Avoid unnecessary nested loops when a linear solution exists.Flow‑chart: Read n → Initialise sum←0 → WHILE i ≤ n → sum←sum+i → i←i+1 → ENDWHILE → Output sum
# Sum of first n natural numbersINPUT n
SET sum ← 0
SET i ← 1
WHILE i ≤ n DO
SET sum ← sum + i
SET i ← i + 1
ENDWHILE
OUTPUT sum
INPUT or OUTPUT – algorithm is incomplete.x, y) instead of descriptive ones (hoursWorked, grossPay).ENDIF, ENDFOR, ENDWHILE – leads to mismatched blocks.FOR not LOOP).| Syllabus Block | Present in Notes? | Typical Omission | Suggested Add‑On |
|---|---|---|---|
| Information representation (binary, BCD, ASCII/Unicode, two’s‑complement, overflow) | No | Only mentioned in passing. | Add a short subsection with binary addition, two’s‑complement example and overflow detection. |
| Multimedia (bitmap vs. vector, lossy vs. lossless compression) | No | Graphics and sound rarely explained. | Insert a table comparing formats and a calculation of bitmap file size. |
| Communication (networks, topologies, IP, DNS, client‑server vs. P2P, cloud, wired vs. wireless) | No | Topology diagrams omitted. | Include a labelled diagram of the 4‑layer model and a mini‑exercise converting an IPv4 address to binary. |
| Hardware (CPU, RAM/ROM types, embedded systems, buffers) | No | Embedded systems glossed over. | Brief case study of a micro‑controller temperature sensor highlighting SRAM vs. DRAM. |
| Logic gates & circuits | No | Truth‑tables without circuit construction. | Provide a three‑step activity: Boolean expression → truth‑table → circuit diagram. |
| Processor fundamentals (Von Neumann, registers, ALU, CU, bus, fetch‑decode‑execute cycle, interrupts) | No | Interrupts omitted. | Insert a flow‑chart of an interrupt‑service routine and bullet points on performance impact. |
| Assembly language & bit manipulation | No | Only a few instructions listed. | Supply a two‑pass assembler example (LOAD, ADD, STORE) and a bit‑mask exercise (set/clear flag). |
| System software (OS functions, utilities, libraries, translators) | No | Differences between compiler, interpreter and IDE are thin. | Add a comparison matrix and a short “read‑the‑code” activity using a tiny Java/Python snippet. |
# Convert decimal 13 to 8‑bit two’s‑complement binarySET decimal ← 13
SET binary ← "00001101" # direct conversion
OUTPUT "Binary (unsigned):", binary
# Subtract 20 using two’s‑complement
SET a ← 13 # 00001101
SET b ← 20 # 00010100
# Two’s‑complement of b
SET bComp ← "11101011" # invert + 1
SET result ← a + bComp # binary addition
# Detect overflow (carry out of MSB)
IF carry_out = 1 THEN
OUTPUT "Overflow occurred"
ENDIF
OUTPUT "Result (two’s‑complement):", result
# 1024 × 768 image, 24‑bit colourSET width ← 1024
SET height ← 768
SET bitsPerPixel ← 24
SET totalBits ← width * height * bitsPerPixel
SET totalBytes ← totalBits / 8
SET totalKB ← totalBytes / 1024
OUTPUT "File size ≈", totalKB, "KB"
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.