Skip to content
2210 · 0478Paper 2 · Algorithms, Programming and Logic§8.1, §8.2, §8.3

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.

Statometer97BankerNext Paper 294%
Marks a paper49.5 · 66%Rank#1 of 10 · #1 on P2Trend · last 12Oct/Nov 24 · 23: 33 marksFeb/Mar 25 · 22: 45 marksMay/Jun 25 · 21: 45 marksMay/Jun 25 · 22: 56 marksMay/Jun 25 · 23: 59 marksOct/Nov 25 · 21: 58 marksOct/Nov 25 · 22: 51 marksOct/Nov 25 · 23: 64 marksFeb/Mar 26 · 22: 49 marksMay/Jun 26 · 21: 51 marksMay/Jun 26 · 22: 56 marksMay/Jun 26 · 23: 48 marks
9 in 10 chance in the next paper

Everything for this topic — study hub

O Level / IGCSE · 2210 · 0478 · Paper 2

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

97BANKER
Banker#1 of 10 in O Level / IGCSE#1 on Paper 2 Rising

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
49.5 / 75
66% of Paper 2 · fair share 25%
Appeared in
25 / 25
Paper 2 sittings 20232026
Last set
May/Jun 2026
0478/23 · Q10 · 15 marks · 11-series streak
Marks in each of the last 12 Paper 2 sittingsOct/Nov 24May/Jun 26
Oct/Nov 24 · 23: 33 marksFeb/Mar 25 · 22: 45 marksMay/Jun 25 · 21: 45 marksMay/Jun 25 · 22: 56 marksMay/Jun 25 · 23: 59 marksOct/Nov 25 · 21: 58 marksOct/Nov 25 · 22: 51 marksOct/Nov 25 · 23: 64 marksFeb/Mar 26 · 22: 49 marksMay/Jun 26 · 21: 51 marksMay/Jun 26 · 22: 56 marksMay/Jun 26 · 23: 48 marks

What the papers say

  • Set in 25 of 25 Paper 2 sittings on the current syllabus — treat it as certain.
  • Worth about 49.5 marks a paper (66% of Paper 2, 2.6× 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.
  • Rising: about 44.5 marks a paper in the earlier years, 52.5 in the latest.
  • Lives on “Write” and “Explain” — 56% 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.
  • 45% of its questions are set out as code, pseudocode or a table to complete.
  • Most of its marks (88%) 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 (47%) and §8.3 File handling the least (1%).
  • It is examined as a mix: AO2 50%, AO3 31%, AO1 20% — you must apply it to the scenario or the given data — a definition alone will not score.
  • The examiner has commented on 218 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 mk58
  • 5–6 mk69
  • 7–9 mk65
  • 10+ mk124

Average 9.3 marks a question · 42% with a figure or table · 45% 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 2SyllabusMeasured
AO1 Knowledge & understanding20%27%
AO2 Apply to a context60%51%
AO3 Evaluate & judge20%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 paper14.4 marks25/25 sittings May/Jun 2026

    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
    14.4
    19% of the paper · 34% of the topic
    Asked in
    25 / 25
    Paper 2 sittings · 190 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 14.4 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.3 → 16.4 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: AO2 43%, AO3 36%, AO1 21% — you must apply it to the scenario or the given data — a definition alone will not score.
    Last 12 sittings Rising
    Oct/Nov 24 · 23: 15 marksFeb/Mar 25 · 22: 17.5 marksMay/Jun 25 · 21: 6 marksMay/Jun 25 · 22: 11.5 marksMay/Jun 25 · 23: 20.5 marksOct/Nov 25 · 21: 3 marksOct/Nov 25 · 22: 29 marksOct/Nov 25 · 23: 10.5 marksFeb/Mar 26 · 22: 25.5 marksMay/Jun 26 · 21: 7.5 marksMay/Jun 26 · 22: 25 marksMay/Jun 26 · 23: 17 marks

    Assessment objectives

    • AO1 Knowledge & understanding
    • AO2 Apply to a context
    • AO3 Evaluate & judge
    • Write56%
    • Explain38%
    • Identify25%
    • Describe25%
  • 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 paper21.1 marks25/25 sittings May/Jun 2026

    Asked in nearly every paper — the bullet to know cold.

    Next Paper 2
    94%
    9 in 10
    Marks a paper
    21.1
    28% of the paper · 47% of the topic
    Asked in
    25 / 25
    Paper 2 sittings · 214 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 21.1 marks a paper (28% of Paper 2; 47% 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: 19.1 → 22 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 · 0478/21 · Q11.
    • It is examined mostly as AO2 (Apply to a context, 57%), the rest AO3 (28%) — you must apply it to the scenario or the given data — a definition alone will not score.
    Last 12 sittings Rising
    Oct/Nov 24 · 23: 3 marksFeb/Mar 25 · 22: 22.5 marksMay/Jun 25 · 21: 19.5 marksMay/Jun 25 · 22: 23.5 marksMay/Jun 25 · 23: 20 marksOct/Nov 25 · 21: 46 marksOct/Nov 25 · 22: 14.5 marksOct/Nov 25 · 23: 21.5 marksFeb/Mar 26 · 22: 17 marksMay/Jun 26 · 21: 23.5 marksMay/Jun 26 · 22: 18.5 marksMay/Jun 26 · 23: 21.5 marks

    Assessment objectives

    • AO1 Knowledge & understanding
    • AO2 Apply to a context
    • AO3 Evaluate & judge
    • Write59%
    • Explain36%
    • Describe25%
    • State24%
  • 8.1Procedures, functions and parameters; local and global variables; library routines (MOD, DIV, ROUND, RANDOM); writing maintainable programs#6 of 19 on Paper 2Banker · 7884% next paper5.1 marks22/25 sittings May/Jun 2026

    Asked in nearly every paper — the bullet to know cold.

    Next Paper 2
    84%
    8 in 10
    Marks a paper
    5.1
    7% of the paper · 7% of the topic
    Asked in
    22 / 25
    Paper 2 sittings · 59 questions
    Last asked
    May/Jun 2026
    0478/23 · Q9 · 6 marks · 11-series streak
    • Asked in 22 of 25 Paper 2 sittings — nearly every paper.
    • About 5.1 marks a paper (7% 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.
    • 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 47%, AO2 29%, AO3 24% — definitions and descriptions in syllabus words score.
    Last 12 sittings Steady
    Oct/Nov 24 · 23: 3 marksFeb/Mar 25 · 22: 1 marksMay/Jun 25 · 21: 12 marksMay/Jun 25 · 22: 15 marksMay/Jun 25 · 23: 3.5 marksOct/Nov 25 · 21: 5 marksOct/Nov 25 · 22: 0 marksOct/Nov 25 · 23: 7.5 marksFeb/Mar 26 · 22: 1 marksMay/Jun 26 · 21: 3.5 marksMay/Jun 26 · 22: 6 marksMay/Jun 26 · 23: 7 marks

    Assessment objectives

    • AO1 Knowledge & understanding
    • AO2 Apply to a context
    • AO3 Evaluate & judge
    • Write31%
    • State22%
    • Explain22%
    • Complete20%
  • 8.2Arrays#3 of 19 on Paper 2Banker · 8779% next paper6.5 marks20/25 sittings May/Jun 2026

    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
    79%
    8 in 10
    Marks a paper
    6.5
    9% of the paper · 11% of the topic
    Asked in
    20 / 25
    Paper 2 sittings · 83 questions
    Last asked
    May/Jun 2026
    0478/23 · Q4 · 2.5 marks · 11-series streak
    • Asked in 20 of 25 Paper 2 sittings — about 8 papers in 10.
    • About 6.5 marks a paper (9% 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.
    • 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 as a mix: AO2 49%, AO3 43% — you must apply it to the scenario or the given data — a definition alone will not score.
    Last 12 sittings Steady
    Oct/Nov 24 · 23: 12 marksFeb/Mar 25 · 22: 1 marksMay/Jun 25 · 21: 7.5 marksMay/Jun 25 · 22: 6 marksMay/Jun 25 · 23: 12 marksOct/Nov 25 · 21: 0 marksOct/Nov 25 · 22: 6.5 marksOct/Nov 25 · 23: 17 marksFeb/Mar 26 · 22: 3.5 marksMay/Jun 26 · 21: 13.5 marksMay/Jun 26 · 22: 2.5 marksMay/Jun 26 · 23: 2.5 marks

    Assessment objectives

    • AO1 Knowledge & understanding
    • AO2 Apply to a context
    • AO3 Evaluate & judge
    • Write74%
    • Explain55%
    • Describe41%
    • Identify31%
  • 8.3File handling#18 of 19 on Paper 2Occasional · 2843% next paper1.3 marks10/25 sittings May/Jun 2026

    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
    43%
    2 in 4
    Marks a paper
    1.3
    2% of the paper · 1% of the topic
    Asked in
    10 / 25
    Paper 2 sittings · 12 questions
    Last asked
    May/Jun 2026
    2210/22 · Q7 · 3 marks
    • Asked in 10 of 25 Paper 2 sittings — roughly one paper in 3.
    • About 1.3 marks a paper (2% of Paper 2; 1% 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: 5 in Oct/Nov 2024 · 0478/21 · Q8.
    • It is examined almost entirely as AO2 (Apply to a context, 81%) — you must apply it to the scenario or the given data — a definition alone will not score.
    Last 12 sittings Steady
    Oct/Nov 24 · 23: 0 marksFeb/Mar 25 · 22: 1 marksMay/Jun 25 · 21: 0 marksMay/Jun 25 · 22: 0 marksMay/Jun 25 · 23: 0 marksOct/Nov 25 · 21: 4 marksOct/Nov 25 · 22: 0 marksOct/Nov 25 · 23: 2.5 marksFeb/Mar 26 · 22: 0 marksMay/Jun 26 · 21: 3 marksMay/Jun 26 · 22: 3 marksMay/Jun 26 · 23: 0 marks

    Assessment objectives

    • AO1 Knowledge & understanding
    • AO2 Apply to a context
    • AO3 Evaluate & judge
    • Write67%
    • Explain25%
    • State17%
    • Circle8%

5% 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

1011121314151617181920212223242526

Grey years are the previous syllabus (20102022, 185 questions) — history, not counted in the rates.

By exam series

  • Feb/Mar4/4 · 46.8 mk
  • May/Jun12/12 · 51.4 mk
  • Oct/Nov9/9 · 44.6 mk

What you need to know5syllabus §8.1, §8.2, §8.3

  1. 8.1Programming conceptsvariables, constants and data types; input and output; sequence, selection (IF, CASE) and iteration (count-controlled, pre-condition and post-condition loops)
  2. 8.1Totalling, counting and string handling (length, substring, upper, lower); arithmetic, relational and logical operators; nested statements
  3. 8.1Procedures, functions and parameters; local and global variables; library routines (MOD, DIV, ROUND, RANDOM); writing maintainable programs
  4. 8.2Arraysdeclaring and using 1D and 2D arrays; variables as indexes; reading and writing array values with (nested) iteration
  5. 8.3File handlingwhy programs store data in files; opening, closing, reading and writing single items of data and lines of text

Video lectures52ZAK's YouTube channel · play here

  • O Level202529 views

  • O LevelAS20232.0K views

  • O LevelAS2023456 views

  • O LevelAS2023116 views

  • O Level20232.3K views

  • O Level2023559 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
Arrays, records & text filesAn array holds many values of ONE type under one name. A record groups DIFFERENT types. A text filekeeps data permanently.1D array — DECLARE Marks : ARRAY[1:5] OF INTEGER[1]72[2]58[3]91[4]64[5]80Marks[3] ← 91 · FOR i ← 1 TO 5 … NEXT i2D array — DECLARE Grid : ARRAY[1:3, 1:4] OF CHAR......X.....row 1row 2row 3col 1col 2col 3col 4Grid[2, 3] ← 'X' // [row, column]Walk it with nested loops: FOR Row … FOR Col … NEXT Col … NEXT RowRecord (composite type)TYPE StudentRec DECLARE Name : STRING DECLARE Mark : INTEGER DECLARE Passed : BOOLEANENDTYPEDECLARE S : StudentRecS.Mark ← 72Text fileOPENFILE "marks.txt" FOR READ // or WRITE / APPENDWHILE NOT EOF("marks.txt") READFILE "marks.txt", Line OUTPUT LineENDWHILECLOSEFILE "marks.txt"WRITEFILE "marks.txt", "Ali,72" // needs FOR WRITEcswithzak.com

Arrays, records & text files

ASO Level

Browse all infographics →

Key terms17use these exact words in the exam

variableconstantINTEGERREALCHARSTRINGBOOLEANIFCASEFORWHILEREPEATprocedurefunctionparameterarrayfile handling

Dotted terms are defined in the glossary.

Code help4referenced to the Cambridge pseudocode guide

Procedure and function with parameters

pseudocode 9618 §8.1–8.2 Run in Playground
PROCEDURE Greet(Name : STRING)
OUTPUT "Hello ", Name
ENDPROCEDURE
 
FUNCTION Area(W : REAL, H : REAL) RETURNS REAL
RETURN W * H
ENDFUNCTION
 
CALL Greet("Zak")
OUTPUT "Area = ", Area(3.5, 2.0)

String handling: count vowels & reverse

pseudocode Run in Playground
DECLARE S, R, Ch : STRING
DECLARE i, V : INTEGER
S "Computer Science"
V 0
R ""
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" THEN
V V + 1
ENDIF
R Ch & R
NEXT i
OUTPUT "Vowels: ", V
OUTPUT "Reversed: ", R

2D array: seating plan

pseudocode Run in Playground
DECLARE Seat : ARRAY[1:3, 1:4] OF STRING
DECLARE R, C : INTEGER
FOR R 1 TO 3
FOR C 1 TO 4
Seat[R, C] "-"
NEXT C
NEXT R
Seat[2, 3] "ZAK"
FOR R 1 TO 3
OUTPUT Seat[R, 1], " ", Seat[R, 2], " ", Seat[R, 3], " ", Seat[R, 4]
NEXT R

Write then read a text file

pseudocode 9618 §9.1 Run in Playground
DECLARE Line : STRING
OPENFILE "scores.txt" FOR WRITE
WRITEFILE "scores.txt", "Ali,87"
WRITEFILE "scores.txt", "Sara,92"
CLOSEFILE "scores.txt"
OPENFILE "scores.txt" FOR READ
WHILE NOT EOF("scores.txt") DO
READFILE "scores.txt", Line
OUTPUT Line
ENDWHILE
CLOSEFILE "scores.txt"

Playground examples55runnable 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
  • 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
  • 2210 string routines

    LENGTH, SUBSTRING(start, length), UCASE and LCASE on whole strings — the O Level set.

    O LevelPseudocodeString handling 2210 §8.1
    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
  • Fill a 1D array with INPUT, output it backwards

    Arrays are indexed from 1; a FOR loop visits every element.

    O LevelASPseudocodeArrays §3.1–3.2
    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).

    O LevelASPseudocodeArrays §3.1–3.2, §7.1
    Run
  • Parallel arrays — names and marks

    Two arrays share an index: Names[i] belongs with Marks[i].

    O LevelASPseudocodeArrays §3.2
    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
  • 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
  • Text file — write then read to EOF

    OPENFILE FOR WRITE creates the file; FOR READ plus a WHILE NOT EOF loop reads every line.

    O LevelASPseudocodeFile handling §9.1
    Run
  • APPEND to a file & count its lines

    WRITE starts a new file; APPEND adds after the existing data.

    O LevelASPseudocodeFile handling §9.1
    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.

    O LevelPseudocodeExam-style tasks 2210 §7–8
    Run
  • O Level Section B — cinema booking

    Ticket types with CASE, quantities, a running total and a group discount.

    O LevelPseudocodeExam-style tasks 2210 §7–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
  • Lists — the Python array

    Create, index, change, append, and loop. Remember index 0. len() gives the size.

    O LevelASPythonArrays §3.1–3.2 ↔ Python
    Run
  • 2D list — seating plan

    A list of lists. seat[row][col]. Build it with a comprehension so each row is a separate list.

    O LevelASPythonArrays §3.1 ↔ 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
  • 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.

    O LevelASPythonFile handling §9.1 ↔ Python
    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.

    O LevelPythonExam-style tasks 2210 §8
    Run

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

  • Swap two values

    Three assignments with a temporary variable — order matters.

    O LevelASSequence & I/O 2210 §8.1
    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
  • Leap year

    Compound condition with AND / OR in one decision box.

    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
  • Times table

    Count-controlled loop with a calculation in the body.

    O LevelLoops 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
  • Countdown with STEP −1

    A FOR loop that counts down — the decision becomes >=.

    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
  • Length check on a password

    LENGTH() inside the decision box; loop until 8 or more characters.

    O LevelASValidation & rejection loops 2210 §8.1
    Open
  • Fill an array of 5 names

    The loop counter doubles as the array index.

    O LevelASArrays 2210 §8.2
    Open
  • Calling a procedure

    The main chart uses the subroutine symbol; the procedure gets its own chart tab.

    O LevelASSubroutines 2210 §8.1
    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