You are viewing a free preview of this lesson.
Subscribe to unlock all 4 lessons in this course and every other course on LearningBro.
Component 02 is the applied paper of OCR A-Level Computer Science. Where Paper 1 asks you to know things, Paper 2 asks you to do things: read unfamiliar code, trace it precisely, find and fix faults, write algorithms by hand, and design a complete solution to a scenario you have never seen before. The marks here are won by fluency — the kind that only comes from writing pseudocode and tracing by hand, repeatedly, away from an IDE that would otherwise do your thinking for you. This lesson maps what the paper assesses, how each question style is marked, the trace-table and design techniques that recur, and a fully worked Specimen Question with banded Mid-band → Stronger → Top-band model answers so you can see exactly what separates a partial solution from a full-mark one.
The underlying content — the algorithms themselves, the data structures, the programming constructs — is taught in the Algorithms, Data Structures, Programming Techniques and Computational Thinking courses. This lesson is the technique layer on top: turning that knowledge into marks under exam conditions.
This lesson covers the assessment of Component 02, "Algorithms and Programming" (H446/02), drawing on specification sections 2.1 to 2.3:
These sections are cumulative: a single design question can require computational-thinking decomposition (2.1), a programming technique such as recursion (2.2) and a standard algorithm such as a binary search over a sorted structure (2.3). Revise them as one connected discipline, not three silos.
| AO | What it credits | Where it dominates on Paper 2 | What a strong answer looks like |
|---|---|---|---|
| AO1 — knowledge and understanding | Recall and explanation of constructs, algorithms and their properties | Short "describe how this algorithm works" parts; complexity recall | Correct named steps and complexities |
| AO2 — application | Applying programming/algorithmic knowledge to a given scenario | Tracing, fault-finding, and writing code for the stated problem | Code that solves this problem, not a memorised template |
| AO3 — analysis | Designing, refining and evaluating solutions and their efficiency | Extended design questions; "compare these two algorithms" | A justified design or a weighed, quantified comparison |
Key Point: Paper 2 is the most AO2/AO3-heavy of the three components. You cannot pass it on recall alone — the bulk of the marks require you to produce something correct (a trace, a fix, an algorithm) or to judge something (which algorithm, which structure, and why). That is why hand-practice matters more here than anywhere else in the course.
Paper 2 is a written exam, 2 hours 30 minutes, 140 marks, 40% of the A-Level, with no choice of questions. Questions are scenario-driven and structured, often building a single context across several parts — for example introducing a data set, asking you to trace an operation on it, then to extend or redesign the operation. Later parts carry the higher tariffs and the design/evaluation demand.
| Section | Topic area assessed | Sibling course |
|---|---|---|
| 2.1 | Computational thinking: abstraction, decomposition, thinking ahead/procedurally/logically | Computational Thinking |
| 2.2 | Programming constructs, structured programming, recursion, OOP, program design | Programming Techniques |
| 2.3 | Standard algorithms, traversals, pathfinding, complexity and comparison | Algorithms; Data Structures |
You are given pseudocode and asked for the output, a completed trace table, or the code's purpose. The technique is below; the discriminator is not skipping a row and checking the loop condition at the right point.
Write pseudocode (or a named language) to solve a stated problem. Marks come from correct logic, appropriate constructs, handling of edge cases, and readability. Meaningful identifiers and OCR-consistent syntax make your logic legible to the marker — illegible logic cannot be credited.
Code is given containing logic and/or syntax faults. You must identify the fault (often by line) and give the correction. Stating "there is an error on line 4" without the fix earns at most half the marks; you must say what it should be.
Compare on time complexity, space complexity, suitability for the data, and practical trade-offs. State the Big O and explain it in plain terms, and address both algorithms with comparative connectives.
The highest-tariff questions: design a complete algorithm and/or data-structure solution for a scenario, frequently with a justification of your choices. The banded Specimen Question below is exactly this type.
Abstraction, decomposition, pattern recognition and "thinking ahead" applied to a scenario — e.g. "describe how decomposition could be applied to building this system." The marks turn on applying the concept to the named scenario rather than reciting its definition: a top answer names the actual sub-problems the system decomposes into (input validation, storage, the core calculation, output formatting), whereas a weak answer just states that "decomposition means breaking a problem into smaller parts" without grounding it in the question. Treat these as miniature AO2 questions, not AO1 recall.
The reference language appears on the paper, so you need not memorise it — but fluency saves time and prevents misreads. The core constructs:
// assignment and output
x = 5
name = "Alice"
print("Hello " + name)
// selection
if condition then
// statements
elseif condition then
// statements
else
// statements
endif
// iteration
for i = 0 to 9
print(i)
next i
while condition
// statements
endwhile
do
// statements
until condition
Arrays are zero-indexed and accessed with square brackets; functions return a value, procedures do not:
array names[5]
names[0] = "Alice"
for i = 0 to names.length - 1
print(names[i])
next i
procedure greet(name)
print("Hello " + name)
endprocedure
function add(a, b)
return a + b
endfunction
String and file operations you should recognise:
x = "Hello"
x.length // 5
x.substring(0, 3) // "Hel" (start index, length)
ASC("A") // 65
CHR(65) // "A"
myFile = openRead("data.txt")
line = myFile.readLine()
myFile.close()
Exam Tip: When you write an answer you may use the OCR reference language or any consistent high-level language — but be consistent. Mixing OCR
endifwith Python indentation in the same answer signals a shaky grasp of syntax and can obscure the logic the marker is trying to credit.
Candidates often ask whether to answer write-an-algorithm questions in OCR pseudocode or in the language they program in (frequently Python). Either is acceptable, and the mark scheme credits correct logic expressed clearly — but the choice has practical consequences worth thinking about before the exam, not during it.
| Choice | Advantage | Risk to manage |
|---|---|---|
| OCR reference pseudocode | Matches the question style; explicit endif/next/endwhile make block boundaries unambiguous on paper | You must recall the conventions precisely |
| Your own language (e.g. Python) | You write it fluently and are less likely to invent syntax | Hand-written indentation is easy to misalign; a missing colon or block edge can obscure the logic |
The pragmatic advice is to decide your default in advance and practise it. If you choose a real language, be scrupulous about indentation on paper, because the marker reads the structure from the layout; if you choose pseudocode, drill the block-closing keywords so you never strand an if without an endif. Whichever you pick, the cardinal rule is consistency within a single answer — a hybrid that is neither valid pseudocode nor valid Python forces the marker to guess your intent, and guesses do not earn marks.
Tracing is examined in almost every series, and a disciplined method eliminates the careless slips that cost most candidates their marks.
while tests before the body; a do...until tests after the body. This is the single most common trace error.x = 10
y = 3
while x > 0
x = x - y
y = y + 1
print(x)
endwhile
| x | y | x > 0? | Output |
|---|---|---|---|
| 10 | 3 | ||
| 7 | 4 | true | 7 |
| 3 | 5 | true | 3 |
| -2 | 6 | true | -2 |
| false |
Output: 7, 3, -2. Note the final row: the loop body runs while x is still positive at the top of the loop, so the iteration that drives x to -2 still executes and prints, and only then does the next condition check fail.
These appear constantly; you must know each one's mechanism, complexity, and best use. (Full derivations live in the Algorithms and Data Structures courses.)
| Algorithm | Mechanism in one line | Time (worst) | Time (best) | Space |
|---|---|---|---|---|
| Bubble sort | Swap adjacent out-of-order pairs each pass | O(n²) | O(n) with flag | O(1) |
| Insertion sort | Insert each item into a growing sorted prefix | O(n²) | O(n) | O(1) |
| Merge sort | Divide, recursively sort halves, merge | O(n log n) | O(n log n) | O(n) |
| Quick sort | Partition around a pivot, recurse | O(n²) | O(n log n) | O(log n) |
| Linear search | Check each element in turn | O(n) | O(1) | O(1) |
| Binary search | Halve a sorted range each step | O(log n) | O(1) | O(1) |
For trees you must perform and recognise the traversals: pre-order (Root-Left-Right), in-order (Left-Root-Right — yields a BST in ascending order), post-order (Left-Right-Root), and breadth-first (level by level, using a queue).
Exam Tip: If asked to "show each pass" of a sort, you must show the array state after every complete pass, not just the first and last — the intermediate states are where the marks are. And always say why an algorithm suits the data: binary search is faster, but only if the data is already sorted.
A frequent format gives a small array and asks you to show the list after each pass. For the list [5, 1, 4, 2] sorting ascending, a pass compares adjacent pairs left-to-right and swaps any out of order:
| After pass | Array state | Largest element settled |
|---|---|---|
| Start | 5, 1, 4, 2 | — |
| Pass 1 | 1, 4, 2, 5 | 5 reaches the end |
| Pass 2 | 1, 2, 4, 5 | 4 settled |
| Pass 3 | 1, 2, 4, 5 | no swaps — list is sorted |
The marks here are for showing every intermediate state correctly and for recognising that, with an optimisation flag, pass 3 makes no swaps and the algorithm can terminate early — which is exactly the case that gives bubble sort its O(n) best case. Candidates who jump straight from the start state to the sorted result forfeit the per-pass marks even when the final answer is right.
Recursion questions defeat candidates who try to hold the unwinding in their head. The reliable method is to draw the call stack frame by frame. Take a factorial:
function factorial(n)
if n <= 1 then
return 1
else
return n * factorial(n - 1)
endif
endfunction
Evaluating factorial(4), push each call until the base case, then pop returning the products:
| Stack frame | Returns |
|---|---|
| factorial(4) → 4 * factorial(3) | waits |
| factorial(3) → 3 * factorial(2) | waits |
| factorial(2) → 2 * factorial(1) | waits |
| factorial(1) | 1 (base case) |
| factorial(2) | 2 * 1 = 2 |
| factorial(3) | 3 * 2 = 6 |
| factorial(4) | 4 * 6 = 24 |
Subscribe to continue reading
Get full access to this lesson and all 4 lessons in this course.