Skip to content
9618Paper 2 · Fundamental Problem-solving and Programming Skills§10.1, §10.2, §10.3, §10.4

10. Data Types and Structures

Data types, records, arrays (1D/2D), files, and how ADTs are implemented with arrays.

Statometer92BankerNext Paper 295%
Marks a paper40.2 · 54%Rank#1 of 12 · #1 on P2Trend · last 12Oct/Nov 24 · 21: 44 marksOct/Nov 24 · 22: 34 marksOct/Nov 24 · 23: 26 marksMay/Jun 25 · 21: 49 marksMay/Jun 25 · 22: 59 marksMay/Jun 25 · 23: 34 marksOct/Nov 25 · 21: 46 marksOct/Nov 25 · 22: 46 marksOct/Nov 25 · 23: 39 marksMay/Jun 26 · 21: 30 marksMay/Jun 26 · 22: 43 marksMay/Jun 26 · 23: 41 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 4 syllabus bullets

Banker · #1 of 12 in AS Level · recomputed with every new session

92BANKER
Banker#1 of 12 in AS Level#1 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
40.2 / 75
54% 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: 44 marksOct/Nov 24 · 22: 34 marksOct/Nov 24 · 23: 26 marksMay/Jun 25 · 21: 49 marksMay/Jun 25 · 22: 59 marksMay/Jun 25 · 23: 34 marksOct/Nov 25 · 21: 46 marksOct/Nov 25 · 22: 46 marksOct/Nov 25 · 23: 39 marksMay/Jun 26 · 21: 30 marksMay/Jun 26 · 22: 43 marksMay/Jun 26 · 23: 41 marks

What the papers say

  • Set in 33 of 33 Paper 2 sittings on the current syllabus — treat it as certain.
  • Worth about 40.2 marks a paper (54% of Paper 2, 2.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 38.8 marks a paper year on year.
  • Lives on “Write” and “Complete” — 89% 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.
  • 79% of its questions are set out as code, pseudocode or a table to complete.
  • Most of its marks (60%) come in extended questions of 12+ marks — plan the answer before writing.
  • Its biggest question so far: 35 marks (Oct/Nov 2023 · 9618/23 · Q7).
  • Inside the topic, §10.1 Data types and records carries the most marks (38%) and §10.3 Files the least (14%).
  • It is examined mostly as AO3 (Design, program & evaluate, 60%), the rest AO2 (41%) — you must build it — write the pseudocode or program, design the structure.
  • The examiner has commented on 71 of its questions — read “What the examiner said” before you practise.

Command words

Share of questions using the word (a question can use several). What each wants →

Question shapes

  • ≤ 6 mk20
  • 7–9 mk26
  • 10–12 mk28
  • 13–15 mk11
  • 16+ mk29

Average 11.6 marks a question · 42% with a figure or table · 79% 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.

  • 10.1Data types and records#3 of 14 on Paper 2Banker · 9793% next paper12.4 marks32/33 sittings May/Jun 2026

    Asked in nearly every paper — the bullet to know cold.Syllabus: choosing INTEGER, REAL, CHAR, STRING, BOOLEAN, DATE; defining a record structure and reading from / writing to its fields

    Next Paper 2
    93%
    9 in 10
    Marks a paper
    12.4
    17% of the paper · 38% of the topic
    Asked in
    32 / 33
    Paper 2 sittings · 70 questions
    Last asked
    May/Jun 2026
    9618/23 · Q8 · 8 marks · 11-series streak
    • Asked in 32 of 33 Paper 2 sittings — nearly every paper.
    • About 12.4 marks a paper (17% of Paper 2; 38% of the topic's marks across its 4 bullets).
    • Last asked May/Jun 2026 · 9618/23 · Q8 (8 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: 17 in Oct/Nov 2023 · 9618/23 · Q7.
    • It is examined mostly as AO3 (Design, program & evaluate, 75%), the rest AO2 (26%) — you must build it — write the pseudocode or program, design the structure.
    Last 12 sittings Steady
    Oct/Nov 24 · 21: 21.5 marksOct/Nov 24 · 22: 11 marksOct/Nov 24 · 23: 7 marksMay/Jun 25 · 21: 20 marksMay/Jun 25 · 22: 10 marksMay/Jun 25 · 23: 15 marksOct/Nov 25 · 21: 14.5 marksOct/Nov 25 · 22: 12.5 marksOct/Nov 25 · 23: 14.5 marksMay/Jun 26 · 21: 5 marksMay/Jun 26 · 22: 4 marksMay/Jun 26 · 23: 8 marks

    Assessment objectives

    • AO1 Knowledge & understanding
    • AO2 Apply & analyse
    • AO3 Design, program & evaluate
    • Write70%
    • Complete43%
    • State29%
    • Explain27%
  • 10.2Arrays#4 of 14 on Paper 2Banker · 9485% next paper11.9 marks28/33 sittings May/Jun 2026

    Asked in nearly every paper — the bullet to know cold.Syllabus: index, upper and lower bounds; choosing a 1D or 2D array; pseudocode for arrays; bubble sort and linear search on an array

    Next Paper 2
    85%
    8 in 10
    Marks a paper
    11.9
    16% of the paper · 31% of the topic
    Asked in
    28 / 33
    Paper 2 sittings · 65 questions
    Last asked
    May/Jun 2026
    9618/23 · Q8 · 8 marks · 11-series streak
    • Asked in 28 of 33 Paper 2 sittings — about 8 papers in 10.
    • About 11.9 marks a paper (16% of Paper 2; 31% of the topic's marks across its 4 bullets).
    • Last asked May/Jun 2026 · 9618/23 · Q8 (8 marks) — in the most recent series.
    • Asked in each of the last 11 series.
    • Rising: 8.1 → 13.5 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 in May/Jun 2026 · 9618/21 · Q9.
    • It is examined mostly as AO3 (Design, program & evaluate, 74%), the rest AO2 (26%) — you must build it — write the pseudocode or program, design the structure.
    Last 12 sittings Rising
    Oct/Nov 24 · 21: 4 marksOct/Nov 24 · 22: 17 marksOct/Nov 24 · 23: 11 marksMay/Jun 25 · 21: 4 marksMay/Jun 25 · 22: 21.5 marksMay/Jun 25 · 23: 0.5 marksOct/Nov 25 · 21: 31.5 marksOct/Nov 25 · 22: 25 marksOct/Nov 25 · 23: 16 marksMay/Jun 26 · 21: 17 marksMay/Jun 26 · 22: 14 marksMay/Jun 26 · 23: 16 marks

    Assessment objectives

    • AO1 Knowledge & understanding
    • AO2 Apply & analyse
    • AO3 Design, program & evaluate
    • Write65%
    • Complete43%
    • State28%
    • Explain25%
  • 10.3Files#7 of 14 on Paper 2Core · 6371% next paper4.7 marks25/33 sittings May/Jun 2026

    A regular earner inside the topic — most papers touch it.Syllabus: why files are needed; pseudocode to read from and write to text files of one or more lines

    Next Paper 2
    71%
    7 in 10
    Marks a paper
    4.7
    6% of the paper · 14% of the topic
    Asked in
    25 / 33
    Paper 2 sittings · 32 questions
    Last asked
    May/Jun 2026
    9618/22 · Q3 · 6 marks · 11-series streak
    • Asked in 25 of 33 Paper 2 sittings — about 8 papers in 10.
    • About 4.7 marks a paper (6% of Paper 2; 14% of the topic's marks across its 4 bullets).
    • Last asked May/Jun 2026 · 9618/22 · Q3 (6 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: 13 in May/Jun 2024 · 9618/22 · Q8.
    • It is examined mostly as AO3 (Design, program & evaluate, 51%), the rest AO2 (49%) — you must build it — write the pseudocode or program, design the structure.
    Last 12 sittings Steady
    Oct/Nov 24 · 21: 9.5 marksOct/Nov 24 · 22: 2 marksOct/Nov 24 · 23: 0 marksMay/Jun 25 · 21: 8 marksMay/Jun 25 · 22: 4 marksMay/Jun 25 · 23: 5 marksOct/Nov 25 · 21: 0 marksOct/Nov 25 · 22: 7.5 marksOct/Nov 25 · 23: 4 marksMay/Jun 26 · 21: 0 marksMay/Jun 26 · 22: 6 marksMay/Jun 26 · 23: 0 marks

    Assessment objectives

    • AO1 Knowledge & understanding
    • AO2 Apply & analyse
    • AO3 Design, program & evaluate
    • Write72%
    • Explain38%
    • Describe38%
    • Complete34%
  • 10.4Introduction to abstract data types#6 of 14 on Paper 2Core · 6771% next paper5.2 marks24/33 sittings May/Jun 2026

    A regular earner inside the topic — most papers touch it.Syllabus: stacks, queues and linked lists: features, when to use each, adding/editing/deleting data, and how each is implemented with arrays

    Next Paper 2
    71%
    7 in 10
    Marks a paper
    5.2
    7% of the paper · 16% of the topic
    Asked in
    24 / 33
    Paper 2 sittings · 25 questions
    Last asked
    May/Jun 2026
    9618/23 · Q6 · 13 marks · 11-series streak
    • Asked in 24 of 33 Paper 2 sittings — about 7 papers in 10.
    • About 5.2 marks a paper (7% of Paper 2; 16% of the topic's marks across its 4 bullets).
    • Last asked May/Jun 2026 · 9618/23 · Q6 (13 marks) — in the most recent series.
    • Asked in each of the last 11 series.
    • Usually “Complete” or “Describe”: you must produce something — code, a diagram, a table — practise doing it, not reading it.
    • Biggest chunk of marks so far: 13 in May/Jun 2026 · 9618/23 · Q6.
    • It is examined almost entirely as AO2 (Apply & analyse, 91%) — you must apply it to the given data or scenario — work it out, trace it, explain it in context.
    Last 12 sittings Steady
    Oct/Nov 24 · 21: 0 marksOct/Nov 24 · 22: 3 marksOct/Nov 24 · 23: 7 marksMay/Jun 25 · 21: 7 marksMay/Jun 25 · 22: 2.5 marksMay/Jun 25 · 23: 7.5 marksOct/Nov 25 · 21: 0 marksOct/Nov 25 · 22: 0 marksOct/Nov 25 · 23: 2.5 marksMay/Jun 26 · 21: 8 marksMay/Jun 26 · 22: 9 marksMay/Jun 26 · 23: 13 marks

    Assessment objectives

    • AO1 Knowledge & understanding
    • AO2 Apply & analyse
    • AO3 Design, program & evaluate
    • Complete72%
    • Describe48%
    • Explain28%
    • State24%

17% 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 · 37.3 mk
  • Oct/Nov15/15 · 43.3 mk

What you need to know4syllabus §10.1, §10.2, §10.3, §10.4

  1. 10.1Data types and recordschoosing INTEGER, REAL, CHAR, STRING, BOOLEAN, DATE; defining a record structure and reading from / writing to its fields
  2. 10.2Arraysindex, upper and lower bounds; choosing a 1D or 2D array; pseudocode for arrays; bubble sort and linear search on an array
  3. 10.3Fileswhy files are needed; pseudocode to read from and write to text files of one or more lines
  4. 10.4Introduction to abstract data typesstacks, queues and linked lists: features, when to use each, adding/editing/deleting data, and how each is implemented with arrays

Video lectures42ZAK's YouTube channel · play here

  • ASA22024642 views

  • ASA22024293 views

  • ASA22024291 views

  • O LevelAS2023561 views

  • ASA29618 Paper 320215.4K views

  • AS20213.3K views

Infographics3draw these the way the examiner expects · download as PNG

Bubble sort — one pass, step by stepCompare each pair of neighbours; swap if out of order. After pass 1 the biggest is last; after pass n−1everything is sorted.5381compare 5 and 3 → 5 > 3, swap3581compare 5 and 8 → in order, no swap3581compare 8 and 1 → 8 > 1, swap3518end of pass 1: the largest value is now lastPass 2 → 3 1 5 8 · Pass 3 → 1 3 5 8. Each pass needs one fewer comparison. Stop early if a pass makes no swaps.FOR i ← 1 TO N - 1 FOR j ← 1 TO N - i IF A[j] > A[j+1] THEN Temp ← A[j] A[j] ← A[j+1] A[j+1] ← Temp ENDIF NEXT jNEXT iFlag version: REPEAT … Swapped ← FALSE… set TRUE on any swap … UNTIL NOT SwappedLinear search (the other standard algorithm)Found ← FALSE : i ← 1 : WHILE i ≤ N AND NOT Found → IF A[i] = Target THEN Found ← TRUE ELSE i ← i + 1Works on unsorted data; checks every item in the worst case. Binary search (AS) needs sorted data and halves the list each time.Totalling: Total ← Total + Value · Counting: Count ← Count + 1 when true · Max/min: compare with the current bestcswithzak.com

Bubble sort & linear search

O LevelAS
Stack · Queue · Linked listKnow the pointers each one needs and what happens on add/remove.STACK (LIFO)739← TopPointerBasePointerPUSH adds at top, POP removes from top.Check full (overflow), empty (underflow).Used for: recursion, interrupts, undo.QUEUE (FIFO)4816FrontRearEnqueue at rear, dequeue at front.Circular queue wraps around with MOD.Used for: print jobs, keyboard buffer, BFS.LINKED LIST1225320StartPointer → node 1 · each node = data + pointer to next · free list holds unused nodesInsert/delete = change pointers only (no shifting). Traversal must start from the head.cswithzak.com

Stack, queue & linked list

ASA2
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 terms9use these exact words in the exam

recordarrayindextext fileOPENFILEREADFILEWRITEFILEEOFpointer

Dotted terms are defined in the glossary.

Code help2referenced to the Cambridge pseudocode guide

Linked list with parallel arrays

pseudocode §3, §4 Run in Playground
DECLARE Data : ARRAY[1:5] OF INTEGER
DECLARE Link : ARRAY[1:5] OF INTEGER
DECLARE Start, Free, P, Node : INTEGER
// initial free list 1→2→3→4→5
FOR Node 1 TO 4
Link[Node] Node + 1
NEXT Node
Link[5] 0
Start 0
Free 1
PROCEDURE AddToFront(V : INTEGER)
DECLARE N : INTEGER
N Free
Free Link[Free]
Data[N] V
Link[N] Start
Start N
ENDPROCEDURE
CALL AddToFront(30)
CALL AddToFront(20)
CALL AddToFront(10)
P Start
WHILE P <> 0
OUTPUT Data[P]
P Link[P]
ENDWHILE

Record type + array of records + file

pseudocode §4.1–4.2, §9.1 Run in Playground
TYPE Student
DECLARE Name : STRING
DECLARE Mark : INTEGER
ENDTYPE
DECLARE Group : ARRAY[1:3] OF Student
DECLARE i : INTEGER
Group[1].Name "Ali"
Group[1].Mark 71
Group[2].Name "Sara"
Group[2].Mark 88
Group[3].Name "Omar"
Group[3].Mark 64
OPENFILE "class.txt" FOR WRITE
FOR i 1 TO 3
WRITEFILE "class.txt", Group[i].Name & "," & NUM_TO_STR(Group[i].Mark)
NEXT i
CLOSEFILE "class.txt"
OUTPUT "Saved — see Files panel"

Playground examples26runnable programs for this topic

  • 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
  • Whole-array copy & reversed copy

    Backup ← Original copies every element at once (same size and type). A reversed copy needs a loop.

    ASA2PseudocodeArrays §3.2
    Run
  • Parallel arrays — names and marks

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

    O LevelASPseudocodeArrays §3.2
    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
  • Sort parallel arrays — a leaderboard

    Sort marks descending and swap the names at the same time so they stay matched.

    ASPseudocodeSorting 9618 §9.2, §10.2
    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
  • Search a file for a record

    Each line is name,mark. Stop reading as soon as the name is found.

    ASPseudocodeFile handling §9.1
    Run
  • Save records to a text file and load them back

    Write each record as one delimited line, then parse the lines back into an array of records.

    ASA2PseudocodeFile handling §4.1, §9.1
    Run
  • A record type

    TYPE … ENDTYPE groups fields of different types under one name; access them with a dot.

    ASA2PseudocodeRecords & user-defined types §4.1
    Run
  • Array of records — a class register

    Register[i].Mark: index the array, then pick the field.

    ASA2PseudocodeRecords & user-defined types §4.2
    Run
  • Records with DATE fields & whole-record copy

    The guide's StudentRecord: Pupil2 ← Pupil1 copies every field; arrays of records are updated in a loop.

    A2PseudocodeRecords & user-defined types §4.1–4.2
    Run
  • Stack — push, pop, overflow & underflow

    LIFO with an array and a Top pointer. Watch what happens on the 4th pop.

    ASA2PseudocodeStacks, queues, lists & trees 9618 §10.4, §19.1
    Run
  • Linear queue — enqueue & dequeue

    FIFO with Front and Rear pointers. Notice the space at the front is never reused.

    ASA2PseudocodeStacks, queues, lists & trees 9618 §10.4, §19.1
    Run
  • Linked list in arrays with a free list

    Insert at the front, delete by value, traverse — using Data/Pointer records, StartPointer and FreePointer.

    ASA2PseudocodeStacks, queues, lists & trees 9618 §10.4, §19.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
  • 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
  • Frequency count with a list and a dictionary

    Count dice rolls two ways: a list indexed by value, and a dictionary (the ADT the exam calls a dictionary).

    ASA2PythonArrays §3 ↔ 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
  • Read until end of file, count and total

    readline() returns '' at EOF — the Python version of WHILE NOT EOF. Also readlines().

    ASPythonFile handling §9.1 ↔ Python
    Run
  • Records in a file — CSV with the csv module

    A list of dictionaries written and read back as CSV, the way Paper 4 file-handling questions expect.

    A2PythonFile handling §9 ↔ Python
    Run
  • Records — dataclass and dictionary

    TYPE … ENDTYPE becomes a dataclass (or a dict). An array of records is a list of them.

    ASPythonRecords & user-defined types §4.1 ↔ Python
    Run
  • Enumerated type with Enum

    TYPE Season = (Spring, Summer, …) in Python: an Enum with an order.

    ASPythonRecords & user-defined types §4.1 ↔ Python
    Run
  • Stack and queue with a list

    append/pop give a stack; append/pop(0) a queue. Watch the order things come out.

    ASA2PythonStacks, queues, lists & trees §10 ADT ↔ Python
    Run

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