GCSE

Pseudocode & Exam Reference Language (ERL) — Complete GCSE & A Level Guide

Master pseudocode and Exam Reference Language for GCSE and A Level Computer Science. Covers AQA pseudocode, OCR ERL, sequences, selection, iteration, arrays, functions, and common exam patterns.

Gareth Edgell

Gareth Edgell

Head of CS · Senior Examiner · 15+ years tutoring

pseudocodeERLexam reference languageAQAOCRprogrammingalgorithms

Pseudocode is one of the most misunderstood parts of GCSE and A Level Computer Science exams. Students who know Python well often lose marks because they write Python instead of pseudocode — and the examiner can’t give full credit.

This guide covers both AQA pseudocode and OCR’s Exam Reference Language (ERL), the two most common formats used in UK Computer Science exams.


Why pseudocode matters in exams

Exam boards use pseudocode (or ERL) rather than a specific programming language because:

  1. Exam fairness — students may be using Python, C#, VB, or other languages
  2. Clarity — pseudocode strips away language-specific syntax so the algorithm logic is clear
  3. Flexibility — pseudocode can express ideas that are awkward in specific languages

In AQA Paper 1 and OCR J277 Component 02, you will be asked to:

  • Read and trace pseudocode
  • Write pseudocode solutions to problems
  • Identify errors in pseudocode

You will lose marks if you write Python when the question asks for pseudocode.


AQA Pseudocode

Variables and assignment

name ← 'Alice'
age ← 17
score ← 0.0
isValid ← TRUE

The assignment arrow () replaces =. In an AQA exam you may write either, but is the official format.

Input and output

name ← USERINPUT
OUTPUT 'Hello, ', name

USERINPUT reads from the keyboard. OUTPUT displays to the screen. No brackets or parentheses needed.

Arithmetic and string operations

total ← price * quantity
remainder ← total MOD 3        # modulus (remainder)
quotient ← total DIV 3         # integer division
result ← total ^ 2             # power / exponent

# String operations
length ← LEN(name)             # length of string
upper ← name.upper             # uppercase
lower ← name.lower             # lowercase
sub ← name.substring(0, 3)     # characters 0, 1, 2
combined ← first + ' ' + last  # concatenation

Selection (IF statements)

IF score >= 70 THEN
  OUTPUT 'Distinction'
ELSEIF score >= 50 THEN
  OUTPUT 'Pass'
ELSE
  OUTPUT 'Fail'
ENDIF

Every IF block must end with ENDIF. The ELSEIF keyword (one word) is used for additional conditions.

Switch / case

SWITCH day:
  CASE 'Mon':
    OUTPUT 'Monday'
  CASE 'Tue':
    OUTPUT 'Tuesday'
  DEFAULT:
    OUTPUT 'Unknown day'
ENDSWITCH

Iteration: FOR loops

FOR i ← 0 TO 9
  OUTPUT i
NEXT i

AQA FOR loops are inclusive on both ends. FOR i ← 0 TO 9 iterates 10 times (0, 1, 2, …, 9).

# Counting down
FOR i ← 10 TO 1 STEP -1
  OUTPUT i
NEXT i

Iteration: WHILE loops

count ← 0
WHILE count < 10 DO
  OUTPUT count
  count ← count + 1
ENDWHILE

Iteration: REPEAT…UNTIL (do-while)

REPEAT
  answer ← USERINPUT
UNTIL answer = 'quit'

REPEAT…UNTIL always executes at least once. The condition is checked after the body.

Arrays

# Creating arrays
scores ← [85, 72, 91, 64, 78]
names ← ['Alice', 'Bob', 'Charlie']

# 2D array (3 rows, 4 columns)
grid ← [[0,0,0,0], [0,0,0,0], [0,0,0,0]]

# Accessing elements (0-indexed)
first ← scores[0]       # 85
grid[1][2] ← 7          # set row 1, col 2 to 7

Subroutines (procedures and functions)

# Procedure (no return value)
SUBROUTINE greet(name)
  OUTPUT 'Hello, ', name
ENDSUBROUTINE

# Function (returns a value)
SUBROUTINE square(n)
  RETURN n * n
ENDSUBROUTINE

# Calling subroutines
greet('Alice')
result ← square(5)

File handling

myFile ← OPENREAD('data.txt')
WHILE NOT myFile.endOfFile()
  line ← myFile.readLine()
  OUTPUT line
ENDWHILE
myFile.close()

# Writing to a file
myFile ← OPENWRITE('output.txt')
myFile.writeLine('Hello')
myFile.close()

OCR Exam Reference Language (ERL)

OCR uses ERL for J277 (GCSE) and H446 (A Level). It is similar to AQA pseudocode but with some key differences.

Variables and assignment

name = "Alice"          // Uses = not ←
age = 17
score = 0.0
isValid = true           // lowercase boolean literals

ERL uses = for assignment and == for comparison (unlike AQA which uses = for both).

Input and output

name = input("Enter your name: ")
print("Hello, " + name)

ERL uses input() and print() — almost identical to Python.

Arithmetic

remainder = total % 3    // modulus (ERL uses % not MOD)
quotient = total // 3    // integer division (ERL uses //)
result = total ** 2      // power (ERL uses **)

Selection

if score >= 70 then
    print("Distinction")
elseif score >= 50 then
    print("Pass")
else
    print("Fail")
endif

ERL uses lowercase keywords (if, then, else, endif) and lowercase print.

Iteration: FOR loops (ERL)

for i = 0 to 9
    print(i)
next i

ERL’s FOR loop is also inclusive. Note: = 0 to 9 not ← 0 TO 9.

WHILE loops (ERL)

count = 0
while count < 10 do
    print(count)
    count = count + 1
endwhile

Procedures and functions (ERL)

procedure greet(name)
    print("Hello, " + name)
endprocedure

function square(n)
    return n * n
endfunction

greet("Alice")
result = square(5)

Arrays (ERL)

scores = [85, 72, 91, 64, 78]
first = scores[0]

# 2D array
grid = [[0,0,0,0], [0,0,0,0], [0,0,0,0]]
grid[1][2] = 7

Side-by-side comparison

FeatureAQA PseudocodeOCR ERL
Assignmentx ← 5x = 5
Comparisonx = 5x == 5
OutputOUTPUT xprint(x)
Inputx ← USERINPUTx = input(...)
FOR loopFOR i ← 0 TO 9for i = 0 to 9
WHILEWHILE ... DOwhile ... do
MODx MOD yx % y
Integer divx DIV yx // y
Powerx ^ yx ** y
FunctionSUBROUTINEfunction
BooleanTRUE/FALSEtrue/false

Common exam question patterns

Pattern 1: Trace a program

You’re given pseudocode and must complete a trace table showing the value of variables at each step.

Tip: Work through one line at a time. Don’t skip ahead. Always show the assignment before the output.

Pattern 2: Identify and fix an error

You’re given code with a bug and must identify whether it’s a:

  • Syntax error — invalid code that won’t run (e.g., wrong keyword)
  • Logic error — code runs but gives wrong output (e.g., > instead of >=)
  • Runtime error — code crashes during execution (e.g., dividing by zero)

Pattern 3: Write pseudocode for an algorithm

These are the most heavily marked questions (6–12 marks). Read the question very carefully:

  • Underline what inputs are needed
  • Underline what outputs are required
  • Plan your algorithm in plain English first
  • Then translate to pseudocode

Common algorithms you might need to write:

  • Linear search
  • Bubble sort
  • Input validation (WHILE loop with range check)
  • Totalling values in an array
  • Finding the maximum/minimum value
  • Counting how many values match a condition

Exam technique for pseudocode questions

  1. Use the correct format — AQA questions expect AQA pseudocode. OCR questions expect ERL. Don’t mix them up.
  2. Show your structure clearly — indent consistently, use ENDFOR/ENDIF/ENDWHILE
  3. Name variables clearlytotalScore is better than x
  4. Check your loop bounds — is it 0 TO 9 or 1 TO 10? (They’re not the same!)
  5. Don’t over-engineer — write the simplest correct solution, not the cleverest one

Practice: converting Python to pseudocode

A common question style gives you Python and asks you to write the equivalent pseudocode:

Python:

def factorial(n):
    result = 1
    for i in range(1, n + 1):
        result = result * i
    return result

AQA Pseudocode equivalent:

SUBROUTINE factorial(n)
  result ← 1
  FOR i ← 1 TO n
    result ← result * i
  NEXT i
  RETURN result
ENDSUBROUTINE

OCR ERL equivalent:

function factorial(n)
    result = 1
    for i = 1 to n
        result = result * i
    next i
    return result
endfunction

Pseudocode mastery comes from practice. The best approach is to take any algorithm you’ve written in Python and rewrite it in pseudocode — you’ll quickly spot where the differences matter.

For practice questions on pseudocode and algorithms, use the question bank. For one-to-one help with programming and exam technique, book a session.

Gareth Edgell

Want personalised help?

Book a 1-to-1 session with Gareth — your spec, your pace, your gaps fixed.

More GCSE articles