11. Programming
Programming basics, constructs, structured programming — procedures, functions, parameters by value/reference, scope.
Statometer90BankerNext Paper 295%Everything for this topic — study hub
AS Level · 9618 · Paper 2
Statometer — what 33 real papers say about this topic and each of its 3 syllabus bullets
Banker · #2 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
- 57.3 / 75
- 76% 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 57.3 marks a paper (76% of Paper 2, 3.1× 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.
- Steady at around 59.1 marks a paper year on year.
- Lives on “Write” and “Complete” — 88% of its questions: you must produce something — code, a diagram, a table — practise doing it, not reading it.
- 42% of its questions involve a diagram, table or figure — practise with pen and paper.
- 82% of its questions are set out as code, pseudocode or a table to complete.
- Its biggest question so far: 35 marks (Oct/Nov 2023 · 9618/23 · Q7).
- Inside the topic, §11.2 Constructs carries the most marks (54%) and §11.1 Programming basics the least (15%).
- It is examined mostly as AO3 (Design, program & evaluate, 61%), the rest AO2 (39%) — you must build it — write the pseudocode or program, design the structure.
- The examiner has commented on 102 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 mk34
- 7–9 mk49
- 10–12 mk47
- 13–15 mk11
- 16+ mk30
Average 10.6 marks a question · 42% with a figure or table · 82% with code · biggest 35 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% | 46% |
| AO3 Design, program & evaluate | 60% | 54% |
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#5 of 14 on Paper 2Banker · 9384% next paper8.4 marks29/33 sittings→ May/Jun 2026Banker · 9384%
8.4 · 15% of topic29/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
- 84%
- 8 in 10
- Marks a paper
- 8.4
- 11% of the paper · 15% of the topic
- Asked in
- 29 / 33
- Paper 2 sittings · 75 questions
- Last asked
- May/Jun 2026
- 9618/23 · Q8 · 1.5 marks · 11-series streak
- Asked in 29 of 33 Paper 2 sittings — nearly every paper.
- About 8.4 marks a paper (11% of Paper 2; 15% 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.
- 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 AO3 (Design, program & evaluate, 54%), the rest AO2 (46%) — you must build it — write the pseudocode or program, design the structure.
Last 12 sittings→ SteadyAssessment objectives
AO2 46%AO3 54%- AO1 Knowledge & understanding
- AO2 Apply & analyse
- AO3 Design, program & evaluate
- Complete56%
- Write51%
- State28%
- Describe27%
11.2Constructs#1 of 14 on Paper 2Banker · 9895% next paper31.3 marks33/33 sittings↗ May/Jun 2026Banker · 9895%
31.3 · 54% 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
- 31.3
- 42% of the paper · 54% of the topic
- Asked in
- 33 / 33
- Paper 2 sittings · 148 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 31.3 marks a paper (42% of Paper 2; 54% 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.
- Rising: 24.1 → 34.6 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, 58%), the rest AO2 (42%) — you must build it — write the pseudocode or program, design the structure.
Last 12 sittings↗ RisingAssessment objectives
AO2 42%AO3 58%- AO1 Knowledge & understanding
- AO2 Apply & analyse
- AO3 Design, program & evaluate
- Write62%
- Complete47%
- Identify28%
- State26%
11.3Structured programming#2 of 14 on Paper 2Banker · 9895% next paper16 marks33/33 sittings→ May/Jun 2026Banker · 9895%
16 · 31% 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
- 16
- 21% of the paper · 31% of the topic
- Asked in
- 33 / 33
- Paper 2 sittings · 109 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 16 marks a paper (21% of Paper 2; 31% 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.
- 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: 19.5 in Oct/Nov 2023 · 9618/23 · Q7.
- It is examined mostly as AO3 (Design, program & evaluate, 72%), the rest AO2 (28%) — you must build it — write the pseudocode or program, design the structure.
Last 12 sittings→ SteadyAssessment objectives
AO2 28%AO3 72%- AO1 Knowledge & understanding
- AO2 Apply & analyse
- AO3 Design, program & evaluate
- Write62%
- Complete46%
- Identify27%
- Explain24%
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
By exam series
- May/Jun18/18 · 58.9 mk
- Oct/Nov15/15 · 50.7 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 lectures38ZAK's YouTube channel · play here
O LevelAS20232.0K views
O LevelAS2023456 views
O LevelAS2023116 views
AS2023298 views
AS20211.8K views
AS20215.7K 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 examples52runnable programs for this topic
- Run
Hello — INPUT, OUTPUT & arithmetic
Read a name and an age, then output a sentence built from several values.
O LevelASPseudocodeBasics & data types §2.4, §5.1 - Run
The five basic data types
INTEGER, REAL, CHAR, STRING and BOOLEAN — how each is declared, written and output.
O LevelASPseudocodeBasics & data types §2.1–2.2 - Run
Constants & expressions
CONSTANT for values that never change; brackets and ROUND to control the result.
O LevelASPseudocodeBasics & data types §2.5, §5.2 - Run
DIV and MOD — quotient and remainder
Convert minutes to hours and minutes, then give change using the fewest coins.
O LevelASPseudocodeBasics & data types §5.2 - Run
Relational & logic operators
Every comparison gives TRUE or FALSE; AND, OR and NOT combine them.
O LevelASPseudocodeBasics & data types §5.3–5.4 - Run
Converting between types
NUM_TO_STR, STR_TO_NUM, ASC and CHR — the library routines that move between numbers, strings and characters.
O LevelASPseudocodeBasics & data types 2210 §8.1 library routines - Run
The DATE type (9618)
Date literals, DAY/MONTH/YEAR and comparing dates — used to work out an age.
ASA2PseudocodeBasics & data types §2.1–2.2 - Run
IF … THEN … ELSE
Pass or fail from a single input.
O LevelASPseudocodeSelection §6.1 - Run
Nested IF — grade boundaries
There is no ELSEIF in Cambridge pseudocode: nest the IFs and close every ENDIF.
O LevelASPseudocodeSelection §6.1 - Run
CASE OF — a menu
One value, many outcomes; OTHERWISE catches everything else.
O LevelASPseudocodeSelection §6.2 - Run
CASE with ranges and lists
Ranges like 5 TO 17 and lists like "Sat", "Sun" on one line each.
O LevelASPseudocodeSelection §6.2 - Run
Complex conditions — leap year
AND, OR and NOT with brackets to make the order of evaluation explicit.
O LevelASPseudocodeSelection §5.4 - Run
FOR loop & totalling
A count-controlled loop that accumulates a running total.
O LevelASPseudocodeIteration §7.1 - Run
FOR with STEP
Count down with a negative step, and count in twos.
O LevelASPseudocodeIteration §7.1 - Run
WHILE with a sentinel — totalling & counting
Read numbers until -1; INPUT once before the loop and again at the end of the body.
O LevelASPseudocodeIteration §7.3 · 2210 WHILE … DO - Run
REPEAT … UNTIL — password with 3 attempts
A post-condition loop runs at least once; the condition is checked at the end.
O LevelASPseudocodeIteration §7.2 - Run
Nested FOR loops — times-table grid
The inner loop runs completely for every pass of the outer loop.
O LevelASPseudocodeIteration §7.1 - Run
The same job with FOR, WHILE and REPEAT
Count-controlled, pre-condition and post-condition loops side by side.
O LevelASPseudocodeIteration §7.1–7.3 - Run
9618 string functions (§5.5)
LENGTH, MID, RIGHT, LCASE/UCASE on a CHAR and & for joining — the functions the exam always provides.
ASA2PseudocodeString handling §5.5 - Run
Reverse a string
Walk the string backwards with STEP -1 and build a new one.
O LevelASPseudocodeString handling §5.5, §7.1 - Run
Palindrome check
Lower-case the word, reverse it, compare.
O LevelASPseudocodeString handling §5.5 - Run
Count the vowels
Take one character at a time and test it against a list of values.
O LevelASPseudocodeString handling §5.5 - Run
Initials from a full name
Find each space and take the character after it.
O LevelASPseudocodeString handling §5.5 - Run
Word count & longest word
Split a sentence on spaces without any split function — track the current word as you go.
O LevelASPseudocodeString handling §5.5 - Run
Letters, digits or other?
Compare characters with ranges like 'A' to 'Z' — the basis of format checks.
O LevelASPseudocodeString handling §5.3 - Run
Frequency count of 600 dice rolls
The dice value is used directly as the array index — no IF needed.
O LevelASPseudocodeArrays §5.6 - Run
Procedures with parameters
A procedure that draws a line, called by another procedure that draws a triangle.
O LevelASPseudocodeProcedures & functions §8.1 - Run
Functions that RETURN a value
Functions are used inside expressions — never with CALL.
O LevelASPseudocodeProcedures & functions §8.2 - Run
BYREF vs BYVAL
BYVAL works on a copy; BYREF changes the caller's variable. Watch X before and after.
ASA2PseudocodeProcedures & functions §8.3 - Run
Local vs global variables
A DECLARE inside a procedure makes a new local variable; without one, the global is used.
O LevelASPseudocodeProcedures & functions 2210 §8.1 / 9618 §11.3 - Run
Passing an array to a procedure and a function
Fill an array BYREF, then total it with a function.
ASA2PseudocodeProcedures & functions §8.1–8.3 - 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).
ASPseudocodeProcedures & functions §8.1 · 9618 §9.1 - Run
AS Paper 2 — library loans
An array of records, a search function, procedures for borrowing and reporting, all driven by a menu.
ASPseudocodeExam-style tasks §4.2, §8 - 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.
O LevelASPythonBasics & data types §2.4, §5.1 ↔ Python - Run
Data types: int, float, str, bool
Python works out the type from the value — type() shows it. Compare with DECLARE in pseudocode.
O LevelASPythonBasics & data types §2.1–2.2 ↔ Python - 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.
O LevelASPythonBasics & data types §2.5 ↔ Python - Run
// and % — quotient and remainder
Minutes to hours and minutes, and change with the fewest coins. // is DIV, % is MOD.
O LevelASPythonBasics & data types §5.2 ↔ Python - 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.
O LevelASPythonBasics & data types §5.5 NUM_TO_STR ↔ Python - 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.
O LevelASPythonSelection §6.1 ↔ Python - Run
match / case — the CASE statement
Python 3.10+ has match, the closest thing to CASE OF … OTHERWISE. Ranges are written as guards.
O LevelASPythonSelection §6.2 ↔ Python - Run
Boolean conditions — and, or, not
Leap years and a login check. Note the lower-case and / or / not, and == for comparison.
O LevelASPythonSelection §5.3 ↔ Python - 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!
O LevelASPythonIteration §7.1 ↔ Python - Run
while — condition-controlled loop
WHILE … ENDWHILE. Python has no REPEAT … UNTIL: write while True with a break, or test the condition first.
O LevelASPythonIteration §7.2–7.3 ↔ Python - Run
Nested loops — times table
One loop inside another; end="\t" keeps each row on one line.
O LevelASPythonIteration §7.1 ↔ Python - 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.
O LevelASPythonString handling §5.5 ↔ Python - Run
Reverse a string and test a palindrome
Loop version (exam-style) and the slice trick s[::-1].
O LevelASPythonString handling §5.5 ↔ Python - Run
Count vowels and words
Character-by-character loop with in, then split() to count words.
O LevelASPythonString handling §5.5 ↔ Python - Run
Caesar cipher with ord() and chr()
Shift each letter by a key, wrapping round the alphabet with %. Non-letters are left alone.
O LevelASPythonString handling §5.5 ↔ Python - 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.
O LevelASPythonProcedures & functions §8.1–8.2 ↔ Python - 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.
ASPythonProcedures & functions §8.3 ↔ Python - 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.
ASPythonProcedures & functions §8.4 ↔ Python - Run
Logic gates and a truth table
Build AND, OR, XOR, NAND from Boolean operators and print the truth table of an expression.
O LevelASPythonTheory in code 2210 §10 / 9618 §3
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.
O LevelASSelection 2210 §7 - Open
Grade from a mark (CASE)
A CASE statement becomes a chain of decisions, each branch to the right.
O LevelASSelection 2210 §8.1 - Open
Count 1 to 10 (FOR)
The FOR loop drawn the Cambridge way: set counter, test, body, add one, loop back.
O LevelASLoops 2210 §8.1 - Open
Keep doubling (WHILE)
Pre-condition loop: the test is at the top, so the body may never run.
O LevelASLoops 2210 §8.1 - Open
Guess the number (REPEAT)
Post-condition loop: the decision sits at the bottom, so the body runs at least once.
O LevelASLoops 2210 §8.1 - Open
Nested loops (grid)
A loop inside a loop: the inner arrow-back sits inside the outer one.
O LevelASLoops 2210 §8.1 - Open
Total and average of N numbers
Totalling and counting together, then a division after the loop — the classic 2210 Q.
O LevelASTotalling, counting, max / min 2210 §7 - Open
Highest and lowest of 10 marks
Set max low and min high, then one decision each inside the loop.
O LevelASTotalling, counting, max / min 2210 §7 - Open
Range check with a rejection loop
Keep asking until the value is between 1 and 100 — the validation flowchart every paper wants.
O LevelASValidation & rejection loops 2210 §7 - Open
Fill an array of 5 names
The loop counter doubles as the array index.
O LevelASArrays 2210 §8.2 - Open
Linear search
Search an array for a value with a found flag — 2210 §7's standard method.
O LevelASArrays 2210 §7 - Open
One pass of a bubble sort
Compare neighbours and swap: the decision inside the loop with three process boxes.
O LevelASArrays 2210 §7 - Open
Calling a procedure
The main chart uses the subroutine symbol; the procedure gets its own chart tab.
O LevelASSubroutines 2210 §8.1 - Open
A function with RETURN
A function's chart ends with a RETURN terminator instead of Stop.
ASSubroutines 9618 §11.3 - Open
Library system
Top module with three sub-modules, parameters in and out, and an iteration mark on the loan loop.
ASStructure charts (9618 §12.2) 9618 §12.2 - Open
Quiz program
Selection and iteration marks: a question loop with a check inside it.
ASStructure charts (9618 §12.2) 9618 §12.2 - Open
Payroll
A wider chart: four modules at the second level, two of them with children.
ASStructure charts (9618 §12.2) 9618 §12.2 - Open
Turnstile
Two states, two events — the textbook state machine, with its transition table.
ASState-transition diagrams (9618 §12.2) 9618 §12.2 - Open
Traffic light
A cycle of states driven by a timer event.
ASState-transition diagrams (9618 §12.2) 9618 §12.2 - Open
Vending machine
States for money inserted; events for coins, choose and cancel; actions on some arrows.
ASState-transition diagrams (9618 §12.2) 9618 §12.2 - Open
Login attempts
A machine that locks the account after three wrong passwords.
ASState-transition diagrams (9618 §12.2) 9618 §12.2
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.