11. Programming
Programming basics, constructs, structured programming — procedures, functions, parameters by value/reference, scope.
Statometer93BankerNext Paper 295%Everything for this topic — study hub
AS Level · 9618 · Paper 2
This topic is rows 33–35 of the study route.Open it on your study route
Statometer — what 33 real papers say about this topic and each of its 3 syllabus bullets
Banker · #1 of 12 in AS Level · recomputed with every new session
Set in nearly every paper and worth a big slice of it — revise first, expect it.
- Next Paper 2
- 95%
- 9 in 10 chance it is set
- Marks a paper
- 62.6 / 75
- 84% of Paper 2 · fair share 25%
- Appeared in
- 33 / 33
- Paper 2 sittings 2021–2026
- Last set
- May/Jun 2026
- 9618/23 · Q8 · 19 marks · 11-series streak
What the papers say
- Set in 33 of 33 Paper 2 sittings on the current syllabus — treat it as certain.
- Worth about 62.6 marks a paper (84% of Paper 2, 3.3× its fair share).
- Last set May/Jun 2026 · 9618/23 · Q8 for 19 marks — in the most recent series.
- Set in each of the last 11 series without a miss.
- Easing off: about 80.7 marks a paper earlier, 57.5 in the latest years — still examined, just smaller.
- Lives on “Write” and “Complete” — 82% of its questions: you must produce something — code, a diagram, a table — practise doing it, not reading it.
- 51% of its questions involve a diagram, table or figure — practise with pen and paper.
- 84% of its questions are set out as code, pseudocode or a table to complete.
- Most of its marks (62%) come in extended questions of 12+ marks — plan the answer before writing.
- Its biggest question so far: 27 marks (May/Jun 2026 · 9618/22 · Q1).
- Inside the topic, §11.2 Constructs carries the most marks (57%) and §11.1 Programming basics the least (18%).
- It is examined mostly as AO3 (Design, program & evaluate, 63%), the rest AO2 (37%) — you must build it — write the pseudocode or program, design the structure.
- The examiner has commented on 296 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
- ≤ 6 mk50
- 7–9 mk92
- 10–12 mk101
- 13–15 mk50
- 16+ mk101
Average 12 marks a question · 51% with a figure or table · 84% with code · biggest 27 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 & analyse
- AO3 Design, program & evaluate
Paper 2 as a whole
| Paper 2 | Syllabus | Measured |
|---|---|---|
| AO1 Knowledge & understanding | 0% | 0% |
| AO2 Apply & analyse | 40% | 45% |
| AO3 Design, program & evaluate | 60% | 55% |
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.
11.1Programming basics#3 of 14 on Paper 2Banker · 9586% next paper8.8 marks31/33 sittings↘ May/Jun 2026Banker · 9586%
8.8 · 18% of topic31/33May/Jun 2026latest series · ↘Asked in nearly every paper — the bullet to know cold.Syllabus: pseudocode from a flowchart or structured English; constants, variables, assignment; arithmetic and logical expressions; input/output; built-in functions and library routines
- Next Paper 2
- 86%
- 9 in 10
- Marks a paper
- 8.8
- 12% of the paper · 18% of the topic
- Asked in
- 31 / 33
- Paper 2 sittings · 184 questions
- Last asked
- May/Jun 2026
- 9618/23 · Q8 · 1.5 marks · 11-series streak
- Asked in 31 of 33 Paper 2 sittings — nearly every paper.
- About 8.8 marks a paper (12% of Paper 2; 18% of the topic's marks across its 3 bullets).
- Last asked May/Jun 2026 · 9618/23 · Q8 (1.5 marks) — in the most recent series.
- Asked in each of the last 11 series.
- Easing: 11.5 → 8.4 marks a paper.
- Usually “Complete” or “Write”: you must produce something — code, a diagram, a table — practise doing it, not reading it.
- Biggest chunk of marks so far: 11 in May/Jun 2024 · 9618/21 · Q1.
- It is examined mostly as AO2 (Apply & analyse, 50%), the rest AO3 (50%) — you must apply it to the given data or scenario — work it out, trace it, explain it in context.
Last 12 sittings↘ EasingAssessment objectives
AO2 50%AO3 50%- AO1 Knowledge & understanding
- AO2 Apply & analyse
- AO3 Design, program & evaluate
- Complete55%
- Write54%
- State38%
- Give31%
11.2Constructs#1 of 14 on Paper 2Banker · 9895% next paper38.6 marks33/33 sittings↘ May/Jun 2026Banker · 9895%
38.6 · 57% of topic33/33May/Jun 2026latest series · ↘Asked in nearly every paper — the bullet to know cold.Syllabus: IF (with ELSE and nesting), CASE, count-controlled, pre-condition and post-condition loops, and justifying the choice of loop
- Next Paper 2
- 95%
- 9 in 10
- Marks a paper
- 38.6
- 52% of the paper · 57% of the topic
- Asked in
- 33 / 33
- Paper 2 sittings · 364 questions
- Last asked
- May/Jun 2026
- 9618/23 · Q8 · 17.5 marks · 11-series streak
- Asked in 33 of 33 Paper 2 sittings — nearly every paper.
- About 38.6 marks a paper (52% of Paper 2; 57% of the topic's marks across its 3 bullets).
- Last asked May/Jun 2026 · 9618/23 · Q8 (17.5 marks) — in the most recent series.
- Asked in each of the last 11 series.
- Easing: 48.8 → 36.2 marks a paper.
- Usually “Write” or “Complete”: you must produce something — code, a diagram, a table — practise doing it, not reading it.
- Biggest chunk of marks so far: 24 in May/Jun 2026 · 9618/22 · Q1.
- It is examined mostly as AO3 (Design, program & evaluate, 66%), the rest AO2 (35%) — you must build it — write the pseudocode or program, design the structure.
Last 12 sittings↘ EasingAssessment objectives
AO2 35%AO3 66%- AO1 Knowledge & understanding
- AO2 Apply & analyse
- AO3 Design, program & evaluate
- Write58%
- Complete42%
- State32%
- Give25%
11.3Structured programming#2 of 14 on Paper 2Banker · 9895% next paper14 marks33/33 sittings↘ May/Jun 2026Banker · 9895%
14 · 25% of topic33/33May/Jun 2026latest series · ↘Asked in nearly every paper — the bullet to know cold.Syllabus: defining and calling procedures and functions; parameters by value and by reference; header, interface, argument and return value; writing efficient pseudocode
- Next Paper 2
- 95%
- 9 in 10
- Marks a paper
- 14
- 19% of the paper · 25% of the topic
- Asked in
- 33 / 33
- Paper 2 sittings · 234 questions
- Last asked
- May/Jun 2026
- 9618/23 · Q5 · 2 marks · 11-series streak
- Asked in 33 of 33 Paper 2 sittings — nearly every paper.
- About 14 marks a paper (19% of Paper 2; 25% of the topic's marks across its 3 bullets).
- Last asked May/Jun 2026 · 9618/23 · Q5 (2 marks) — in the most recent series.
- Asked in each of the last 11 series.
- Easing: 20.2 → 11.3 marks a paper.
- Usually “Write” or “Complete”: you must produce something — code, a diagram, a table — practise doing it, not reading it.
- Biggest chunk of marks so far: 13.5 in Oct/Nov 2021 · 9618/22 · Q6.
- It is examined mostly as AO3 (Design, program & evaluate, 69%), the rest AO2 (31%) — you must build it — write the pseudocode or program, design the structure.
Last 12 sittings↘ EasingAssessment objectives
AO2 31%AO3 69%- AO1 Knowledge & understanding
- AO2 Apply & analyse
- AO3 Design, program & evaluate
- Write61%
- Complete40%
- State35%
- Give25%
3% 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 (2015–2021, 212 questions) — history, not counted in the rates.
By exam series
- May/Jun18/18 · 72.3 mk
- Oct/Nov15/15 · 68.1 mk
What you need to know3syllabus §11.1, §11.2, §11.3
- 11.1Programming basics — pseudocode from a flowchart or structured English; constants, variables, assignment; arithmetic and logical expressions; input/output; built-in functions and library routines
- 11.2Constructs — IF (with ELSE and nesting), CASE, count-controlled, pre-condition and post-condition loops, and justifying the choice of loop
- 11.3Structured programming — defining and calling procedures and functions; parameters by value and by reference; header, interface, argument and return value; writing efficient pseudocode
Video lectures37ZAK's YouTube channel · play here
O LevelAS20232.1K views
O LevelAS2023466 views
O LevelAS2023119 views
AS20211.8K views
AS20215.7K views
AS20211.0K views
Infographics3draw these the way the examiner expects · download as PNG
Three kinds of loop
Procedure vs function
BYVAL vs BYREF & scope
Key terms14use these exact words in the exam
Code help4referenced to the Cambridge pseudocode guide
PROCEDURE SWAP(BYREF X : INTEGER, Y : INTEGER)DECLARE Temp : INTEGERTemp ← XX ← YY ← TempENDPROCEDUREFUNCTION Max(Number1 : INTEGER, Number2 : INTEGER) RETURNS INTEGERIF Number1 > Number2 THENRETURN Number1ELSERETURN Number2ENDIFENDFUNCTIONDECLARE A, B : INTEGERA ← 3B ← 9CALL SWAP(A, B)OUTPUT A, " ", B, " max ", Max(A, B)
DECLARE S : STRINGS ← "Happy Days"OUTPUT LENGTH(S) // 10OUTPUT RIGHT(S, 4) // "Days"OUTPUT MID(S, 7, 3) // "Day"OUTPUT UCASE(MID(S, 1, 1)) // 'H'OUTPUT LCASE('W') // 'w'OUTPUT S & "!" // concatenation
DECLARE i, N : INTEGERFOR i ← 3 TO 1 STEP -1OUTPUT "FOR ", iNEXT iN ← 25WHILE N > 9N ← N - 9ENDWHILEOUTPUT "WHILE left ", NREPEATN ← N + 5UNTIL N >= 20OUTPUT "REPEAT reached ", N
DECLARE Mark : INTEGERDECLARE Grade : CHARMark ← 73IF Mark >= 80 THENGrade ← 'A'ELSEIF Mark >= 60 THENGrade ← 'B'ELSEGrade ← 'C'ENDIFENDIFCASE OF Grade'A' : OUTPUT "Excellent"'B' : OUTPUT "Good"OTHERWISE : OUTPUT "Keep going"ENDCASE
Playground examples53runnable 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
The DATE type (9618)
Date literals, DAY/MONTH/YEAR and comparing dates — used to work out an age.
- 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
9618 string functions (§5.5)
LENGTH, MID, RIGHT, LCASE/UCASE on a CHAR and & for joining — the functions the exam always provides.
- 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
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
BYREF vs BYVAL
BYVAL works on a copy; BYREF changes the caller's variable. Watch X before and after.
- Run
Local vs global variables
A DECLARE inside a procedure makes a new local variable; without one, the global is used.
- Run
Passing an array to a procedure and a function
Fill an array BYREF, then total it with a function.
- Run
Stepwise refinement — a bank menu built from modules
The main program only shows the menu and CALLs procedures; each module does one job (a structure chart in code).
- Run
AS Paper 2 — library loans
An array of records, a search function, procedures for borrowing and reporting, all driven by a menu.
- 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
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
BYVAL vs BYREF in Python
Numbers and strings behave like BYVAL; a list passed to a function behaves like BYREF — changes inside are seen outside. To return two values, return a tuple.
- Run
Local and global scope
A variable assigned inside a function is local. global makes a function change a module-level variable — usually better to return a value instead.
- Run
Logic gates and a truth table
Build AND, OR, XOR, NAND from Boolean operators and print the truth table of an expression.
Also for this topic: 26 Java programs · 23 VB.NET programs in the browser compilers.
Flowchart Studio21draw-it-yourself tasks and worked flowcharts, run and checked box by box
- Open
Largest of three numbers
Nested decisions: the chart shows why the second comparison depends on the first.
- Open
Grade from a mark (CASE)
A CASE statement becomes a chain of decisions, each branch to the right.
- Open
Count 1 to 10 (FOR)
The FOR loop drawn the Cambridge way: set counter, test, body, add one, loop back.
- 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
Nested loops (grid)
A loop inside a loop: the inner arrow-back sits inside the outer one.
- Open
Total and average of N numbers
Totalling and counting together, then a division after the loop — the classic 2210 Q.
- Open
Highest and lowest of 10 marks
Set max low and min high, then one decision each inside the loop.
- Open
Range check with a rejection loop
Keep asking until the value is between 1 and 100 — the validation flowchart every paper wants.
- Open
Fill an array of 5 names
The loop counter doubles as the array index.
- Open
Linear search
Search an array for a value with a found flag — 2210 §7's standard method.
- Open
One pass of a bubble sort
Compare neighbours and swap: the decision inside the loop with three process boxes.
- Open
Calling a procedure
The main chart uses the subroutine symbol; the procedure gets its own chart tab.
- Open
A function with RETURN
A function's chart ends with a RETURN terminator instead of Stop.
- Open
Library system
Top module with three sub-modules, parameters in and out, and an iteration mark on the loan loop.
- Open
Quiz program
Selection and iteration marks: a question loop with a check inside it.
- Open
Payroll
A wider chart: four modules at the second level, two of them with children.
- Open
Turnstile
Two states, two events — the textbook state machine, with its transition table.
- Open
Traffic light
A cycle of states driven by a timer event.
- Open
Vending machine
States for money inserted; events for coins, choose and cancel; actions on some arrows.
- Open
Login attempts
A machine that locks the account after three wrong passwords.
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.


