8. Programming
The core skills: variables, constants, data types, input/output, selection (IF/CASE), iteration (FOR/WHILE/REPEAT), procedures, functions, string handling, arrays and file handling — in pseudocode and a high-level language.
In the 2029–31 syllabus Paper 2 is Python 3.10+ only: this becomes Topics 8 and 10 (Python lists, string methods, match-case, file handling). No pseudocode. What changes in 2029 → · Study the new topics: 8. Programming fundamentals, 10. Further programming and testing
Statometer96BankerNext Paper 294%Everything for this topic — study hub
O Level / IGCSE · 2210 · 0478 · Paper 2
This topic is rows 27–31 of the study route.Open it on your study route
Statometer — what 25 real papers say about this topic and each of its 5 syllabus bullets
Banker · #1 of 10 in O Level / IGCSE · recomputed with every new session
Set in nearly every paper and worth a big slice of it — revise first, expect it.
- Next Paper 2
- 94%
- 9 in 10 chance it is set
- Marks a paper
- 47.2 / 75
- 63% of Paper 2 · fair share 25%
- Appeared in
- 25 / 25
- Paper 2 sittings 2023–2026
- Last set
- May/Jun 2026
- 0478/23 · Q10 · 15 marks · 11-series streak
What the papers say
- Set in 25 of 25 Paper 2 sittings on the current syllabus — treat it as certain.
- Worth about 47.2 marks a paper (63% of Paper 2, 2.5× its fair share).
- Last set May/Jun 2026 · 0478/23 · Q10 for 15 marks — in the most recent series.
- Set in each of the last 11 series without a miss.
- Steady at around 49.3 marks a paper year on year.
- Lives on “Write” and “Explain” — 55% of its questions: you must produce something — code, a diagram, a table — practise doing it, not reading it.
- 37% of its questions involve a diagram, table or figure — practise with pen and paper.
- 47% of its questions are set out as code, pseudocode or a table to complete.
- Most of its marks (86%) come in extended questions of 6+ marks — plan the answer before writing.
- Its biggest question so far: 15 marks (May/Jun 2026 · 2210/21 · Q12).
- Inside the topic, §8.1 Totalling, counting and string handling (length, substring, upper, lower); arithmetic, relational and logical operators; nested statements carries the most marks (46%) and §8.3 File handling the least (2%).
- It is examined as a mix: AO2 48%, AO3 32%, AO1 20% — you must apply it to the scenario or the given data — a definition alone will not score.
- The examiner has commented on 220 of its questions — read “What the examiner said” before you practise.
- The single biggest share of Paper 2 among its 4 topics.
Command words
Share of questions using the word (a question can use several). What each wants →
Question shapes
- 1–2 mk21
- 3–4 mk67
- 5–6 mk60
- 7–9 mk64
- 10+ mk112
Average 8.9 marks a question · 37% with a figure or table · 47% with code · biggest 15 marks
Assessment objectives — how it is examined
Every part of every current-syllabus question filed under Cambridge's AO1 / AO2 / AO3 (from its command word and what it asks you to do), so you know whether this topic pays for definitions, for applying, or for judging and building.
- AO1 Knowledge & understanding
- AO2 Apply to a context
- AO3 Evaluate & judge
Paper 2 as a whole
| Paper 2 | Syllabus | Measured |
|---|---|---|
| AO1 Knowledge & understanding | 20% | 27% |
| AO2 Apply to a context | 60% | 51% |
| AO3 Evaluate & judge | 20% | 22% |
Syllabus = Cambridge's grid; measured = the bank's current-syllabus papers.
Inside the topic — every syllabus bullet, measured
Each part of each question is filed under the bullet it examines; the numbers are per Paper 2 sitting, exactly like the topic's. Open a bullet for its own Statometer.
8.1Programming concepts#2 of 19 on Paper 2Banker · 9894% next paper13.9 marks25/25 sittings↗ May/Jun 2026Banker · 9894%
13.9 · 34% of topic25/25May/Jun 2026latest series · ↗Asked in nearly every paper — the bullet to know cold.Syllabus: variables, constants and data types; input and output; sequence, selection (IF, CASE) and iteration (count-controlled, pre-condition and post-condition loops)
- Next Paper 2
- 94%
- 9 in 10
- Marks a paper
- 13.9
- 19% of the paper · 34% of the topic
- Asked in
- 25 / 25
- Paper 2 sittings · 180 questions
- Last asked
- May/Jun 2026
- 0478/23 · Q10 · 7.5 marks · 11-series streak
- Asked in 25 of 25 Paper 2 sittings — nearly every paper.
- About 13.9 marks a paper (19% of Paper 2; 34% of the topic's marks across its 5 bullets).
- Last asked May/Jun 2026 · 0478/23 · Q10 (7.5 marks) — in the most recent series.
- Asked in each of the last 11 series.
- Rising: 12.4 → 15.2 marks a paper.
- Usually “Write” or “Explain”: you must produce something — code, a diagram, a table — practise doing it, not reading it.
- Biggest chunk of marks so far: 15 in Oct/Nov 2025 · 2210/22 · Q8.
- It is examined as a mix: AO3 41%, AO2 40%, AO1 19% — give a judgement with a reason and a conclusion — “because” earns the mark.
Last 12 sittings↗ RisingAssessment objectives
AO1 19%AO2 40%AO3 41%- AO1 Knowledge & understanding
- AO2 Apply to a context
- AO3 Evaluate & judge
- Write60%
- Explain39%
- Describe26%
- Identify26%
8.1Totalling, counting and string handling (length, substring, upper, lower); arithmetic, relational and logical operators; nested statements#1 of 19 on Paper 2Banker · 9894% next paper20.4 marks25/25 sittings→ May/Jun 2026Banker · 9894%
20.4 · 46% of topic25/25May/Jun 2026latest series · →Asked in nearly every paper — the bullet to know cold.
- Next Paper 2
- 94%
- 9 in 10
- Marks a paper
- 20.4
- 27% of the paper · 46% of the topic
- Asked in
- 25 / 25
- Paper 2 sittings · 198 questions
- Last asked
- May/Jun 2026
- 0478/23 · Q10 · 7.5 marks · 11-series streak
- Asked in 25 of 25 Paper 2 sittings — nearly every paper.
- About 20.4 marks a paper (27% of Paper 2; 46% of the topic's marks across its 5 bullets).
- Last asked May/Jun 2026 · 0478/23 · Q10 (7.5 marks) — in the most recent series.
- Asked in each of the last 11 series.
- Usually “Write” or “Explain”: you must produce something — code, a diagram, a table — practise doing it, not reading it.
- Biggest chunk of marks so far: 15 in Oct/Nov 2025 · 0478/21 · Q11.
- It is examined mostly as AO2 (Apply to a context, 54%), the rest AO3 (31%) — you must apply it to the scenario or the given data — a definition alone will not score.
Last 12 sittings→ SteadyAssessment objectives
AO1 16%AO2 54%AO3 31%- AO1 Knowledge & understanding
- AO2 Apply to a context
- AO3 Evaluate & judge
- Write59%
- Explain38%
- Identify25%
- Describe25%
8.1Procedures, functions and parameters; local and global variables; library routines (MOD, DIV, ROUND, RANDOM); writing maintainable programs#6 of 19 on Paper 2Core · 7278% next paper4.7 marks21/25 sittings↘ May/Jun 2026Core · 7278%
4.7 · 7% of topic21/25May/Jun 2026latest series · ↘A regular earner inside the topic — most papers touch it.
- Next Paper 2
- 78%
- 8 in 10
- Marks a paper
- 4.7
- 6% of the paper · 7% of the topic
- Asked in
- 21 / 25
- Paper 2 sittings · 53 questions
- Last asked
- May/Jun 2026
- 0478/23 · Q9 · 6 marks · 11-series streak
- Asked in 21 of 25 Paper 2 sittings — about 8 papers in 10.
- About 4.7 marks a paper (6% of Paper 2; 7% of the topic's marks across its 5 bullets).
- Last asked May/Jun 2026 · 0478/23 · Q9 (6 marks) — in the most recent series.
- Asked in each of the last 11 series.
- Easing: 4.9 → 4.6 marks a paper.
- Usually “Write”: you must produce something — code, a diagram, a table — practise doing it, not reading it.
- Biggest chunk of marks so far: 15 in May/Jun 2025 · 0478/22 · Q10.
- It is examined as a mix: AO1 45%, AO2 31%, AO3 25% — definitions and descriptions in syllabus words score.
Last 12 sittings↘ EasingAssessment objectives
AO1 45%AO2 31%AO3 25%- AO1 Knowledge & understanding
- AO2 Apply to a context
- AO3 Evaluate & judge
- Write32%
- State21%
- Explain21%
- Complete17%
8.2Arrays#5 of 19 on Paper 2Banker · 8077% next paper5.7 marks19/25 sittings↗ May/Jun 2026Banker · 8077%
5.7 · 11% of topic19/25May/Jun 2026latest series · ↗Asked in nearly every paper — the bullet to know cold.Syllabus: declaring and using 1D and 2D arrays; variables as indexes; reading and writing array values with (nested) iteration
- Next Paper 2
- 77%
- 8 in 10
- Marks a paper
- 5.7
- 8% of the paper · 11% of the topic
- Asked in
- 19 / 25
- Paper 2 sittings · 82 questions
- Last asked
- May/Jun 2026
- 0478/23 · Q4 · 2.5 marks · 11-series streak
- Asked in 19 of 25 Paper 2 sittings — about 8 papers in 10.
- About 5.7 marks a paper (8% of Paper 2; 11% of the topic's marks across its 5 bullets).
- Last asked May/Jun 2026 · 0478/23 · Q4 (2.5 marks) — in the most recent series.
- Asked in each of the last 11 series.
- Rising: 4.6 → 6.3 marks a paper.
- Usually “Write” or “Explain”: you must produce something — code, a diagram, a table — practise doing it, not reading it.
- Biggest chunk of marks so far: 15 in Oct/Nov 2025 · 2210/23 · Q10.
- It is examined mostly as AO2 (Apply to a context, 56%), the rest AO3 (33%) — you must apply it to the scenario or the given data — a definition alone will not score.
Last 12 sittings↗ RisingAssessment objectives
AO2 56%AO3 33%- AO1 Knowledge & understanding
- AO2 Apply to a context
- AO3 Evaluate & judge
- Write73%
- Explain54%
- Describe40%
- Identify28%
8.3File handling#18 of 19 on Paper 2Occasional · 3146% next paper1.5 marks11/25 sittings→ May/Jun 2026Occasional · 3146%
1.5 · 2% of topic11/25May/Jun 2026latest series · →Rotated in occasionally — the bullet students skip and then meet.Syllabus: why programs store data in files; opening, closing, reading and writing single items of data and lines of text
- Next Paper 2
- 46%
- 2 in 4
- Marks a paper
- 1.5
- 2% of the paper · 2% of the topic
- Asked in
- 11 / 25
- Paper 2 sittings · 17 questions
- Last asked
- May/Jun 2026
- 2210/22 · Q7 · 3 marks
- Asked in 11 of 25 Paper 2 sittings — roughly one paper in 2.
- About 1.5 marks a paper (2% of Paper 2; 2% of the topic's marks across its 5 bullets).
- Last asked May/Jun 2026 · 2210/22 · Q7 (3 marks) — in the most recent series.
- Usually “Write”: you must produce something — code, a diagram, a table — practise doing it, not reading it.
- Biggest chunk of marks so far: 6 in Oct/Nov 2023 · 2210/23 · Q3.
- It is examined mostly as AO2 (Apply to a context, 68%), the rest AO1 (22%) — you must apply it to the scenario or the given data — a definition alone will not score.
Last 12 sittings→ SteadyAssessment objectives
AO1 22%AO2 68%- AO1 Knowledge & understanding
- AO2 Apply to a context
- AO3 Evaluate & judge
- Write47%
- Describe24%
- Explain18%
- Give18%
4% of the topic's marks sit in question parts that belong to another topic (scenario questions cross sections) or that no bullet claims; they count for the topic, not for a bullet.
Marks a paper, year by year
Grey years are the previous syllabus (2010–2022, 181 questions) — history, not counted in the rates.
By exam series
- Feb/Mar4/4 · 43 mk
- May/Jun12/12 · 48.6 mk
- Oct/Nov9/9 · 44.6 mk
What you need to know5syllabus §8.1, §8.2, §8.3
- 8.1Programming concepts — variables, constants and data types; input and output; sequence, selection (IF, CASE) and iteration (count-controlled, pre-condition and post-condition loops)
- 8.1Totalling, counting and string handling (length, substring, upper, lower); arithmetic, relational and logical operators; nested statements
- 8.1Procedures, functions and parameters; local and global variables; library routines (MOD, DIV, ROUND, RANDOM); writing maintainable programs
- 8.2Arrays — declaring and using 1D and 2D arrays; variables as indexes; reading and writing array values with (nested) iteration
- 8.3File handling — why programs store data in files; opening, closing, reading and writing single items of data and lines of text
Video lectures53ZAK's YouTube channel · play here
O Level202539 views
O LevelAS20232.1K views
O LevelAS2023466 views
O LevelAS2023119 views
O Level20232.3K views
O Level2023562 views
Infographics3draw these the way the examiner expects · download as PNG
Three kinds of loop
Procedure vs function
Arrays, records & text files
Key terms17use these exact words in the exam
Code help6referenced to the Cambridge pseudocode guide
PROCEDURE Greet(Name : STRING)OUTPUT "Hello ", NameENDPROCEDUREFUNCTION Area(W : REAL, H : REAL) RETURNS REALRETURN W * HENDFUNCTIONCALL Greet("Zak")OUTPUT "Area = ", Area(3.5, 2.0)
DECLARE S, R, Ch : STRINGDECLARE i, V : INTEGERS ← "Computer Science"V ← 0R ← ""FOR i ← 1 TO LENGTH(S)Ch ← UCASE(SUBSTRING(S, i, 1))IF Ch = "A" OR Ch = "E" OR Ch = "I" OR Ch = "O" OR Ch = "U" THENV ← V + 1ENDIFR ← Ch & RNEXT iOUTPUT "Vowels: ", VOUTPUT "Reversed: ", R
DECLARE Seat : ARRAY[1:3, 1:4] OF STRINGDECLARE R, C : INTEGERFOR R ← 1 TO 3FOR C ← 1 TO 4Seat[R, C] ← "-"NEXT CNEXT RSeat[2, 3] ← "ZAK"FOR R ← 1 TO 3OUTPUT Seat[R, 1], " ", Seat[R, 2], " ", Seat[R, 3], " ", Seat[R, 4]NEXT R
DECLARE Line : STRINGOPENFILE "scores.txt" FOR WRITEWRITEFILE "scores.txt", "Ali,87"WRITEFILE "scores.txt", "Sara,92"CLOSEFILE "scores.txt"OPENFILE "scores.txt" FOR READWHILE NOT EOF("scores.txt") DOREADFILE "scores.txt", LineOUTPUT LineENDWHILECLOSEFILE "scores.txt"
Library routines: MOD, DIV, ROUND, RANDOM, LENGTH
pseudocode 2210 §8.1 library routines Run in PlaygroundDECLARE Total, Count, Minutes, Hours, Mins, Dice : INTEGERDECLARE Average : REALDECLARE Name : STRINGTotal ← 17Count ← 3Average ← Total / CountOUTPUT "Average to 2 d.p.: ", ROUND(Average, 2)Minutes ← 135Hours ← DIV(Minutes, 60)Mins ← MOD(Minutes, 60)OUTPUT Hours, " h ", Mins, " min"Dice ← INT(RANDOM() * 6) + 1IF Dice >= 1 AND Dice <= 6 THENOUTPUT "Dice roll is in range 1-6"ENDIFName ← "Ayesha"OUTPUT "Name has ", LENGTH(Name), " letters"OUTPUT UCASE(Name), " ", LCASE(Name)
💡 RANDOM() gives a REAL from 0 up to (not including) 1 in the 2210 guide, so INT(RANDOM() * 6) + 1 is a whole number 1–6. DIV and MOD split minutes into hours and minutes.
Nested statements: loop inside a loop with selection
pseudocode 2210 §8.1 nested statements Run in PlaygroundDECLARE Row, Col : INTEGERDECLARE Line : STRINGFOR Row ← 1 TO 4Line ← ""FOR Col ← 1 TO 4IF Col <= Row THENLine ← Line & "*"ELSELine ← Line & "."ENDIFNEXT ColOUTPUT LineNEXT Row
💡 The inner FOR runs completely for every pass of the outer FOR; the IF inside decides each character.
Playground examples56runnable programs for this topic
- Run
Hello — INPUT, OUTPUT & arithmetic
Read a name and an age, then output a sentence built from several values.
- Run
The five basic data types
INTEGER, REAL, CHAR, STRING and BOOLEAN — how each is declared, written and output.
- Run
Constants & expressions
CONSTANT for values that never change; brackets and ROUND to control the result.
- Run
DIV and MOD — quotient and remainder
Convert minutes to hours and minutes, then give change using the fewest coins.
- Run
Relational & logic operators
Every comparison gives TRUE or FALSE; AND, OR and NOT combine them.
- Run
Converting between types
NUM_TO_STR, STR_TO_NUM, ASC and CHR — the library routines that move between numbers, strings and characters.
- Run
IF … THEN … ELSE
Pass or fail from a single input.
- Run
Nested IF — grade boundaries
There is no ELSEIF in Cambridge pseudocode: nest the IFs and close every ENDIF.
- Run
CASE OF — a menu
One value, many outcomes; OTHERWISE catches everything else.
- Run
CASE with ranges and lists
Ranges like 5 TO 17 and lists like "Sat", "Sun" on one line each.
- Run
CASE with character ranges — count letter types
'A' TO 'Z' and '0' TO '9' ranges compare characters by their ASCII order, as in the 9618 guide.
- Run
Complex conditions — leap year
AND, OR and NOT with brackets to make the order of evaluation explicit.
- Run
FOR loop & totalling
A count-controlled loop that accumulates a running total.
- Run
FOR with STEP
Count down with a negative step, and count in twos.
- Run
WHILE with a sentinel — totalling & counting
Read numbers until -1; INPUT once before the loop and again at the end of the body.
- Run
REPEAT … UNTIL — password with 3 attempts
A post-condition loop runs at least once; the condition is checked at the end.
- Run
Nested FOR loops — times-table grid
The inner loop runs completely for every pass of the outer loop.
- Run
The same job with FOR, WHILE and REPEAT
Count-controlled, pre-condition and post-condition loops side by side.
- Run
2210 string routines
LENGTH, SUBSTRING(start, length), UCASE and LCASE on whole strings — the O Level set.
- Run
Reverse a string
Walk the string backwards with STEP -1 and build a new one.
- Run
Palindrome check
Lower-case the word, reverse it, compare.
- Run
Count the vowels
Take one character at a time and test it against a list of values.
- Run
Initials from a full name
Find each space and take the character after it.
- Run
Word count & longest word
Split a sentence on spaces without any split function — track the current word as you go.
- Run
Letters, digits or other?
Compare characters with ranges like 'A' to 'Z' — the basis of format checks.
- Run
Fill a 1D array with INPUT, output it backwards
Arrays are indexed from 1; a FOR loop visits every element.
- Run
2D array — marks table with row and column totals
ARRAY[1:3, 1:4]: the first index is the row (student), the second the column (test).
- Run
Parallel arrays — names and marks
Two arrays share an index: Names[i] belongs with Marks[i].
- Run
Frequency count of 600 dice rolls
The dice value is used directly as the array index — no IF needed.
- Run
Procedures with parameters
A procedure that draws a line, called by another procedure that draws a triangle.
- Run
Functions that RETURN a value
Functions are used inside expressions — never with CALL.
- Run
Local vs global variables
A DECLARE inside a procedure makes a new local variable; without one, the global is used.
- Run
Text file — write then read to EOF
OPENFILE FOR WRITE creates the file; FOR READ plus a WHILE NOT EOF loop reads every line.
- Run
APPEND to a file & count its lines
WRITE starts a new file; APPEND adds after the existing data.
- Run
O Level Section B — a week of temperatures
Validate seven readings into an array, then report the average and the hottest day. Everything Paper 2 Section B expects in one program.
- Run
O Level Section B — cinema booking
Ticket types with CASE, quantities, a running total and a group discount.
- Run
Hello — input(), print() and f-strings
Read a name and an age, convert the age with int(), and print a sentence. The Python twin of the first pseudocode example.
- Run
Data types: int, float, str, bool
Python works out the type from the value — type() shows it. Compare with DECLARE in pseudocode.
- Run
Constants (by convention) and rounding
Python has no CONSTANT keyword — UPPER_CASE names signal a value that must not change. round() controls decimal places.
- Run
// and % — quotient and remainder
Minutes to hours and minutes, and change with the fewest coins. // is DIV, % is MOD.
- Run
Converting between str and numbers
input() always gives a str. int() and float() convert it; str() goes the other way. The #1 cause of TypeError.
- Run
if / elif / else — grade boundaries
elif replaces the nested IF … ELSE … ENDIF of pseudocode. Conditions are checked in order; the first true one wins.
- Run
match / case — the CASE statement
Python 3.10+ has match, the closest thing to CASE OF … OTHERWISE. Ranges are written as guards.
- Run
Boolean conditions — and, or, not
Leap years and a login check. Note the lower-case and / or / not, and == for comparison.
- Run
for … in range() — counted loops
range(1, 6) is FOR i ← 1 TO 5. range(10, 0, -2) counts down. The end value is not included!
- Run
while — condition-controlled loop
WHILE … ENDWHILE. Python has no REPEAT … UNTIL: write while True with a break, or test the condition first.
- Run
Nested loops — times table
One loop inside another; end="\t" keeps each row on one line.
- Run
String handling — len, slicing, upper, lower
Python strings are indexed from 0. s[i], s[a:b], len(), .upper(), .lower() replace LENGTH, SUBSTRING, UCASE, LCASE.
- Run
Reverse a string and test a palindrome
Loop version (exam-style) and the slice trick s[::-1].
- Run
Count vowels and words
Character-by-character loop with in, then split() to count words.
- Run
Caesar cipher with ord() and chr()
Shift each letter by a key, wrapping round the alphabet with %. Non-letters are left alone.
- Run
Lists — the Python array
Create, index, change, append, and loop. Remember index 0. len() gives the size.
- Run
2D list — seating plan
A list of lists. seat[row][col]. Build it with a comprehension so each row is a separate list.
- Run
Functions and procedures — def and return
A procedure is a def with no return; a function returns a value. Parameters are passed by value for numbers/strings.
- Run
Write then read a text file
open() with 'w', 'a' and 'r'; with closes the file for you. The file appears in the Files panel after the run.
- Run
2210 Section B: marks for a class
Read 5 marks with validation into a list, then output the average and the highest with the student's name. Typical 15-mark task.
Also for this topic: 33 Java programs · 25 VB.NET programs in the browser compilers.
Flowchart Studio12draw-it-yourself tasks and worked flowcharts, run and checked box by box
- Open
Swap two values
Three assignments with a temporary variable — order matters.
- Open
Grade from a mark (CASE)
A CASE statement becomes a chain of decisions, each branch to the right.
- Open
Leap year
Compound condition with AND / OR in one decision box.
- Open
Count 1 to 10 (FOR)
The FOR loop drawn the Cambridge way: set counter, test, body, add one, loop back.
- Open
Times table
Count-controlled loop with a calculation in the body.
- Open
Keep doubling (WHILE)
Pre-condition loop: the test is at the top, so the body may never run.
- Open
Guess the number (REPEAT)
Post-condition loop: the decision sits at the bottom, so the body runs at least once.
- Open
Countdown with STEP −1
A FOR loop that counts down — the decision becomes >=.
- Open
Nested loops (grid)
A loop inside a loop: the inner arrow-back sits inside the outer one.
- Open
Length check on a password
LENGTH() inside the decision box; loop until 8 or more characters.
- Open
Fill an array of 5 names
The loop counter doubles as the array index.
- Open
Calling a procedure
The main chart uses the subroutine symbol; the procedure gets its own chart tab.
Test yourself
Ready to check you know it?
Every round is a fresh random draw, weak cards come back until you get them right, and past-paper questions come with their mark schemes. Marks earn XP on your dashboard.
NewCS Games · 16 to play
Revise this topic by playing
Quiz battles, a daily CS word, SQL whodunnits, logic-gate puzzles and arcade — every game drills the syllabus. Solo against AskZ bots, with friends, or with your whole class. Free, no sign-up.


