Skip to content
9618Paper 2 · Fundamental Problem-solving and Programming Skills§11.1, §11.2, §11.3

11. Programming

Programming basics, constructs, structured programming — procedures, functions, parameters by value/reference, scope.

Statometer90BankerNext Paper 295%
Marks a paper57.3 · 76%Rank#2 of 12 · #2 on P2Trend · last 12Oct/Nov 24 · 21: 65 marksOct/Nov 24 · 22: 75 marksOct/Nov 24 · 23: 58 marksMay/Jun 25 · 21: 60 marksMay/Jun 25 · 22: 35 marksMay/Jun 25 · 23: 70 marksOct/Nov 25 · 21: 61 marksOct/Nov 25 · 22: 60 marksOct/Nov 25 · 23: 67 marksMay/Jun 26 · 21: 62 marksMay/Jun 26 · 22: 55 marksMay/Jun 26 · 23: 47 marks
9 in 10 chance in the next paper

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

90BANKER
Banker#2 of 12 in AS Level#2 on Paper 2 Steady

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 20212026
Last set
May/Jun 2026
9618/23 · Q8 · 19 marks · 11-series streak
Marks in each of the last 12 Paper 2 sittingsOct/Nov 24May/Jun 26
Oct/Nov 24 · 21: 65 marksOct/Nov 24 · 22: 75 marksOct/Nov 24 · 23: 58 marksMay/Jun 25 · 21: 60 marksMay/Jun 25 · 22: 35 marksMay/Jun 25 · 23: 70 marksOct/Nov 25 · 21: 61 marksOct/Nov 25 · 22: 60 marksOct/Nov 25 · 23: 67 marksMay/Jun 26 · 21: 62 marksMay/Jun 26 · 22: 55 marksMay/Jun 26 · 23: 47 marks

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 2SyllabusMeasured
AO1 Knowledge & understanding0%0%
AO2 Apply & analyse40%46%
AO3 Design, program & evaluate60%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 2026

    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 Steady
    Oct/Nov 24 · 21: 8 marksOct/Nov 24 · 22: 5 marksOct/Nov 24 · 23: 7.5 marksMay/Jun 25 · 21: 7 marksMay/Jun 25 · 22: 4 marksMay/Jun 25 · 23: 7 marksOct/Nov 25 · 21: 8 marksOct/Nov 25 · 22: 8.5 marksOct/Nov 25 · 23: 9.5 marksMay/Jun 26 · 21: 17 marksMay/Jun 26 · 22: 0 marksMay/Jun 26 · 23: 15 marks

    Assessment objectives

    • 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 2026

    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 Rising
    Oct/Nov 24 · 21: 21.5 marksOct/Nov 24 · 22: 48.5 marksOct/Nov 24 · 23: 46.5 marksMay/Jun 25 · 21: 42.5 marksMay/Jun 25 · 22: 22 marksMay/Jun 25 · 23: 36.5 marksOct/Nov 25 · 21: 44.5 marksOct/Nov 25 · 22: 34.5 marksOct/Nov 25 · 23: 28 marksMay/Jun 26 · 21: 32 marksMay/Jun 26 · 22: 36 marksMay/Jun 26 · 23: 27 marks

    Assessment objectives

    • 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 2026

    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 Steady
    Oct/Nov 24 · 21: 30.5 marksOct/Nov 24 · 22: 19.5 marksOct/Nov 24 · 23: 2 marksMay/Jun 25 · 21: 10.5 marksMay/Jun 25 · 22: 9 marksMay/Jun 25 · 23: 23.5 marksOct/Nov 25 · 21: 7.5 marksOct/Nov 25 · 22: 17 marksOct/Nov 25 · 23: 29.5 marksMay/Jun 26 · 21: 9 marksMay/Jun 26 · 22: 16 marksMay/Jun 26 · 23: 2 marks

    Assessment objectives

    • 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

212223242526

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

  1. 11.1Programming basicspseudocode from a flowchart or structured English; constants, variables, assignment; arithmetic and logical expressions; input/output; built-in functions and library routines
  2. 11.2ConstructsIF (with ELSE and nesting), CASE, count-controlled, pre-condition and post-condition loops, and justifying the choice of loop
  3. 11.3Structured programmingdefining 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 loopCount-controlled: you know how many times. Pre-condition: may run 0 times. Post-condition: must run atleast once.Count-controlledFOR … NEXTFOR i ← 1 TO 5 OUTPUT iNEXT iFOR i ← 10 TO 0 STEP -2• known number of repetitions• loop variable set automatically• STEP changes the incrementPre-conditionWHILE … ENDWHILETotal ← 0INPUT NWHILE N <> -1 Total ← Total + N INPUT NENDWHILE• condition tested BEFORE each pass• may run 0 times• sentinel value ends the loopPost-conditionREPEAT … UNTILREPEAT INPUT MarkUNTIL Mark >= 0 AND Mark <= 100// validation loop• condition tested AFTER each pass• always runs at least once• perfect for input validationSelection remindersIF x > 0 THEN … ELSE … ENDIF · CASE OF Choice 1 : … 2 : … OTHERWISE … ENDCASEClose every construct: NEXT · ENDWHILE · UNTIL · ENDIF · ENDCASE. One ENDIF per IF. Indent the body. ← assigns, = compares.Nested loops: the inner loop runs fully for each outer pass (2D array: FOR Row … FOR Col … NEXT Col … NEXT Row).cswithzak.com

Three kinds of loop

O LevelAS
Procedure vs functionBoth are named subroutines with parameters. The difference: a function RETURNS a value, so you use itinside an expression.PROCEDUREPROCEDURE Greet(Name : STRING) OUTPUT "Hello ", NameENDPROCEDURECALL Greet("Ali") // stands alone• does a task (output, update an array…)• called with CALL as a statement• no RETURN value (may change BYREF parameters)FUNCTIONFUNCTION Square(N : INTEGER) RETURNS INTEGER RETURN N * NENDFUNCTIONArea ← Square(5) + 1 // used in an expression• calculates and RETURNS exactly one value• called inside an expression / assignment / OUTPUT• must declare the RETURNS type in the headerParameters & scopeParameter = value passed in via the brackets (Name, N above). Argument = the actual value used in the call (“Ali”, 5).Local: declared inside the subroutine, exists only while it runs. Global: declared at the top, visible everywhere.Why use subroutines? Reuse, easier testing, shorter main program, several people can work on it, easier maintenance.Library routines you must know: MOD, DIV, ROUND, RANDOM (2210) · LENGTH, SUBSTRING/MID, UCASE, LCASE, INT, RAND (9618).cswithzak.com

Procedure vs function

O LevelAS
BYVAL vs BYREF & scopeBYVAL passes a copy — the original is safe. BYREF passes the address — the caller's variable changes. NoBYREF in functions.BYVAL (default)PROCEDURE Inc(BYVAL N : INTEGER) N ← N + 1ENDPROCEDUREX ← 5CALL Inc(X)OUTPUT X // 5X = 5N = 5→6copy — X untouchedBYREFPROCEDURE Inc(BYREF N : INTEGER) N ← N + 1ENDPROCEDUREX ← 5CALL Inc(X)OUTPUT X // 6X = 5→6N ≡ Xsame memory cellWhen to use whichBYVAL: the subroutine only needs to read the value — safe, no side effects.BYREF: the subroutine must send a result back through the parameter (e.g. swap two values, update an array/record).A function returns its answer with RETURN, so it never needs BYREF — the 9618 guide forbids it there.ScopeDECLARE Total : INTEGER // global: seen everywherePROCEDURE P() DECLARE i : INTEGER // localLocal variables exist only while the subroutine runs andare recreated on each call. Prefer locals + parametersover globals: easier to test, reuse and debug.cswithzak.com

BYVAL vs BYREF & scope

AS

Browse all infographics →

Key terms14use these exact words in the exam

constantvariableexpressionlibrary routineIFCASEFORWHILEREPEATprocedurefunctionBYVALBYREFscope

Dotted terms are defined in the glossary.

Code help4referenced to the Cambridge pseudocode guide

Guide §8: procedures, functions, BYREF — all together

pseudocode §8.1–8.3 Run in Playground
PROCEDURE SWAP(BYREF X : INTEGER, Y : INTEGER)
DECLARE Temp : INTEGER
Temp X
X Y
Y Temp
ENDPROCEDURE
FUNCTION Max(Number1 : INTEGER, Number2 : INTEGER) RETURNS INTEGER
IF Number1 > Number2 THEN
RETURN Number1
ELSE
RETURN Number2
ENDIF
ENDFUNCTION
DECLARE A, B : INTEGER
A 3
B 9
CALL SWAP(A, B)
OUTPUT A, " ", B, " max ", Max(A, B)

Guide §5.5 string functions in one program

pseudocode §5.5 Run in Playground
DECLARE S : STRING
S "Happy Days"
OUTPUT LENGTH(S) // 10
OUTPUT RIGHT(S, 4) // "Days"
OUTPUT MID(S, 7, 3) // "Day"
OUTPUT UCASE(MID(S, 1, 1)) // 'H'
OUTPUT LCASE('W') // 'w'
OUTPUT S & "!" // concatenation

Count-controlled vs pre- vs post-condition

pseudocode §7 Run in Playground
DECLARE i, N : INTEGER
FOR i 3 TO 1 STEP -1
OUTPUT "FOR ", i
NEXT i
N 25
WHILE N > 9
N N - 9
ENDWHILE
OUTPUT "WHILE left ", N
REPEAT
N N + 5
UNTIL N >= 20
OUTPUT "REPEAT reached ", N

Nested IF and CASE (§6)

pseudocode §6 Run in Playground
DECLARE Mark : INTEGER
DECLARE Grade : CHAR
Mark 73
IF Mark >= 80 THEN
Grade 'A'
ELSE
IF Mark >= 60 THEN
Grade 'B'
ELSE
Grade 'C'
ENDIF
ENDIF
CASE OF Grade
'A' : OUTPUT "Excellent"
'B' : OUTPUT "Good"
OTHERWISE : OUTPUT "Keep going"
ENDCASE

Playground examples52runnable programs for this topic

  • 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
    Run

Flowchart Studio21draw-it-yourself tasks and worked flowcharts, run and checked box by box

  • 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
    Open

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.

Enroll nowOnline classes