9618 Paper 4 Practical: what it tests and how to prepare

9618 · Published 2026-11-13

How this was made: Written by AI and checked by AI, including Anthropic's Claude, against the official Cambridge 9618 syllabus (2027–2029, version 2); every code example was run. It may contain mistakes and we revise it when errors are found — spot one? Email [email protected].

Paper 4 is the practical programming paper of Cambridge International AS & A Level Computer Science (9618). It is taken at A Level only, alongside Paper 3. This guide follows the 9618 syllabus for exams in 2027, 2028 and 2029 (version 2). If you sit the exam in 2026, check your own syllabus year with your teacher, because details can change between syllabus editions.

The paper at a glance

The evidence document: no evidence, no marks

Cambridge supplies an evidence document, saved with your centre number, name and candidate number. At each stage you copy your program code, or a screenshot of its output, into that document. The syllabus is blunt: if there is no evidence of work in the evidence document, the work receives no marks. Save regularly. When a task asks for a test run, paste a screenshot that clearly shows the input and the output.

What it tests

Paper 4 assesses syllabus sections 19 and 20, except low-level and declarative programming. In practice that means:

Binary search

def binary_search(items, target):
    low, high = 0, len(items) - 1
    while low <= high:
        mid = (low + high) // 2
        if items[mid] == target:
            return mid
        if items[mid] < target:
            low = mid + 1
        else:
            high = mid - 1
    return -1

scores = [12, 19, 27, 34, 45, 58, 63, 71]
print(binary_search(scores, 45))   # 4
print(binary_search(scores, 50))   # -1

It only works on sorted data. Each comparison halves the part of the list still to be searched, so for n items it needs about log2(n) comparisons: O(log n), against O(n) for a linear search.

Insertion sort

def insertion_sort(items):
    for i in range(1, len(items)):
        current = items[i]
        j = i - 1
        while j >= 0 and items[j] > current:
            items[j + 1] = items[j]
            j -= 1
        items[j + 1] = current
    return items

print(insertion_sort([34, 12, 58, 19, 27]))   # [12, 19, 27, 34, 58]

How long it takes depends on the starting order: an already-sorted list needs one pass with no shifts, and a reversed list needs the most.

A stack class, with exception handling

One example that covers several syllabus points at once: a class, private attributes, a getter, and exceptions raised and handled.

class Stack:
    def __init__(self, size):
        self.__items = [None] * size   # private attribute: encapsulation
        self.__top = -1                # -1 means the stack is empty

    def push(self, item):
        if self.__top == len(self.__items) - 1:
            raise OverflowError("Stack is full")
        self.__top += 1
        self.__items[self.__top] = item

    def pop(self):
        if self.__top == -1:
            raise IndexError("Stack is empty")
        item = self.__items[self.__top]
        self.__top -= 1
        return item

    def get_top(self):                 # getter
        return self.__top

s = Stack(2)
s.push("A")
s.push("B")
try:
    s.push("C")
except OverflowError as error:
    print(error)                       # Stack is full
print(s.pop(), s.pop())                # B A

Reading records from a file

def load_scores(filename):
    records = []
    try:
        with open(filename, "r") as file:
            for line in file:
                name, score = line.strip().split(",")
                records.append((name, int(score)))
    except FileNotFoundError:
        print("File not found:", filename)
    except ValueError:
        print("Bad record in", filename)
    return records

# scores.txt holds the lines  Ayesha,72  and  Bilal,58
print(load_scores("scores.txt"))       # [('Ayesha', 72), ('Bilal', 58)]
print(load_scores("missing.txt"))      # File not found: missing.txt, then []

The exception handlers stop a missing file or a badly formed line from crashing the program, and the function still returns a result either way.

Recursion

def factorial(n):
    if n == 0:                         # base case
        return 1
    return n * factorial(n - 1)        # recursive call moves towards the base case

print(factorial(5))                    # 120

Every recursive routine needs a base case that stops it, and each call must move towards that base case. Each call waits on the stack until the one it made returns; the syllabus calls this unwinding.

How to prepare

  1. Choose one language and use it for all your practice. The paper doesn't reward switching languages.
  2. Practise without the internet. In the exam you won't be able to look up how to open a file or define a class.
  3. Write each data type from memory until it's routine: a stack and a queue in an array, a linked list with a free list, a binary tree with left and right pointers.
  4. Practise timed: 2 hours 30 minutes for 75 marks is about two minutes per mark.
  5. Practise the evidence step too. Copy your code and a screenshot of your test into a document after every task.

Practise it on CodeArc

Questions

Which programming languages can I use in 9618 Paper 4?

Java (console mode), Visual Basic .NET (console mode, not Visual Basic 6.0 or earlier) or Python (console mode).

How long is 9618 Paper 4 and how much is it worth?

2 hours 30 minutes and 75 marks. It is worth 25% of the A Level and is not part of the AS Level.

Is low-level or declarative programming in Paper 4?

No. Paper 4 assesses sections 19 and 20 of the syllabus except low-level and declarative programming. Those are assessed in theory on Paper 3.