Uni-Sine
UK examsGCSE

AQA GCSE Computer Science pseudo-code (8525): every command with examples

Paper resets in

Formula sheet

The card below opens today's Computer Science paper with the language reference in the drawer, so you practise reading code the way the paper gives it. The tables follow, in our own layout. We read AQA's 2024 guidance, which AQA says may be updated, so check its latest version before you rely on anything here. AQA describes it as a resource to help you prepare, and does not say it is printed in the paper.

Formula sheet

GCSE Computer Science

Open formula sheet

Comments, variables and constants

Constant names are always written in capitals.

ConceptKeywords and symbolsExample
Comment## a note
Assignmentname ← expressionb ← a + 1
ConstantCONSTANT NAME ← valueCONSTANT CLASS_SIZE ← 23

Operators

The / symbol is used for division. Use DIV for integer division.

ConceptKeywords and symbolsExample
Arithmetic+ - * /a + b * c
Integer divisionDIV9 DIV 5 is 1
RemainderMOD9 MOD 5 is 4
Relational< > = ≠ ≤ ≥qty ≠ 7
BooleanAND OR NOTNOT (a < b)

Iteration

The loop counter exists only inside the FOR loop. If STEP is left out it is 1. An array item cannot be changed through FOR-IN.

ConceptKeywords and symbolsExample
Repeat untilREPEAT ... UNTIL conditionREPEAT ... UNTIL a = 4
WhileWHILE condition ... ENDWHILEWHILE a < 4
Count controlledFOR a ← 1 TO 3 [STEP n] ... ENDFORFOR a ← 5 TO 1 STEP -2
Each characterFOR char IN string ... ENDFORFOR char IN message
Each array elementFOR item IN array ... ENDFORFOR prime IN primes

Selection

IF statements can be nested inside the THEN part, the ELSE part or both.

ConceptKeywords and symbolsExample
IfIF condition THEN ... ENDIFIF a = 1 THEN
If elseIF ... THEN ... ELSE ... ENDIFIF (a MOD 2) = 0 THEN
Else ifIF ... ELSE IF ... ELSE ... ENDIFELSE IF a = 2 THEN

Arrays and records

Exam questions start indexing at 0 unless a question says otherwise.

ConceptKeywords and symbolsExample
Arrayname ← [a, b, c]primes ← [2, 3, 5]
Read an elementname[i]primes[0]
Update an elementname[i] ← valueprimes[2] ← 7
Two dimensionsname[i][j]table[3][1]
LengthLEN(name)LEN(primes)
RecordRECORD name ... ENDRECORDRECORD Car
Field of a recordvariable.fieldmyCar.model ← "Fiesta"

Subroutines

A subroutine with RETURN is a function. One without is a procedure.

ConceptKeywords and symbolsExample
DefineSUBROUTINE name(parameters) ... ENDSUBROUTINESUBROUTINE add(a, b)
Return a valueRETURN expressionRETURN result
Call a procedurename(parameters)showAdd(2, 3)
Call a functionvariable ← name(parameters)answer ← add(2, 3)

Strings, conversion, input and output

The end position in SUBSTRING is included. RANDOM_INT includes both ends.

ConceptKeywords and symbolsExample
LengthLEN(string)LEN('keyboard') is 8
Position of a characterPOSITION(string, char)POSITION('keyboard', 'b')
SubstringSUBSTRING(start, end, string)SUBSTRING(1, 4, 'keyboard')
Concatenation+'key' + 'board'
String to numberSTRING_TO_INT STRING_TO_REALSTRING_TO_INT('16')
Number to stringINT_TO_STRING REAL_TO_STRINGINT_TO_STRING(16)
Character codesCHAR_TO_CODE CODE_TO_CHARCHAR_TO_CODE('a') is 97
InputUSERINPUTa ← USERINPUT
OutputOUTPUT value, valueOUTPUT a, g
Random integerRANDOM_INT(low, high)RANDOM_INT(1, 6)

Reading AQA pseudo-code

Read the code from the top, one line at a time, and keep a table of the variables. The ← arrow means "becomes". Trace this short program:

total ← 0
FOR n ← 2 TO 10 STEP 4
    total ← total + n
ENDFOR
OUTPUT total

The loop runs for n = 2, 6 and 10, because 14 is past the limit. The total goes 2, then 8, then 18, so the program outputs 18.

ntotal
22
68
1018

Dividing, strings and a function

23 DIV 5 is 4 and 23 MOD 5 is 3, because 23 = 4 × 5 + 3. In SUBSTRING(1, 4, 'keyboard') the characters at positions 1, 2, 3 and 4 are taken, which gives 'eybo': position 0 is k, and the end position is included. This function returns a value, so it is a function:

SUBROUTINE isEven(n)
    IF (n MOD 2) = 0 THEN
        RETURN True
    ELSE
        RETURN False
    ENDIF
ENDSUBROUTINE

OUTPUT isEven(17)

17 MOD 2 is 1, so the condition is false and the program outputs False.

What the pseudo-code guide does not give you

  • Which structure to use. It lists WHILE, REPEAT-UNTIL and FOR loops. Choosing the right one for a question is yours to do.
  • Algorithms. Searching, sorting and the other algorithms in the specification are not written out. You need to know how they work.
  • Flowcharts and trace tables. Those skills sit outside the pseudo-code guide.
  • Your own programming language. It does not cover Python or any other language you use for programming tasks.
  • Errors. It does not say what a syntax error or a logic error looks like, so learn to spot both.

How to use it in the exam

  1. Read the whole program once before you trace it.
  2. Make a table with a column for each variable and one row for each pass of a loop.
  3. Remember that arrays and strings start at index 0 unless the question says otherwise.
  4. Check boundaries: a FOR loop to 3 includes 3, and SUBSTRING includes its end position.
  5. Write your own answers clearly and consistently: AQA says that is the only direction.

AQA pseudo-code and other boards' languages

OCR uses its own Exam Reference Language in J277 papers, with keywords such as endif, next and MOD, and Pearson Edexcel uses a subset of Python. Use the one your board names. Read our OCR Exam Reference Language guide for the OCR version. For the boards, papers and grade boundaries, see our GCSE Computer Science guide.

Use the sheet with today's paper

Uni-Sine publishes a free daily paper for GCSE Computer Science. It is a short timed paper of 8 questions worth 25 to 35 marks, not a full AQA paper, and it is not written by AQA. Open the reference, set a timer and write your trace table at the top of each answer. After marking, look at any question where you used the wrong loop or the wrong index.

Common mistakes

  • Off by one in a FOR loop. FOR a ← 1 TO 3 runs 3 times, and includes 3.
  • Mixing up DIV and MOD. DIV is the whole number quotient and MOD is the remainder.
  • Counting from 1. Array and string positions start at 0 unless a question says so.
  • Forgetting the end keyword. Every IF has an ENDIF, and every WHILE has an ENDWHILE.
  • Reading ← as equals. ← assigns a value. = compares two values.
  • Ignoring that SUBSTRING includes its end. SUBSTRING(1, 4, text) takes four characters.

Exam answers

The answers and a worked mark scheme come with today's paper once it is marked. Sit the paper with the sheet open beside you, mark it, and the worked answers show which line of the sheet each question wanted. We do not publish official or past paper answers.

Common questions

What is the AQA pseudo-code?
It is the consistent style of pseudo-code AQA uses in all its GCSE Computer Science assessment material where students are given pseudo-code, described in AQA's "Notes and guidance: Pseudo-code".
Do I have to write my answers in AQA pseudo-code?
No. AQA says students do not have to use this style, though they are free to. Their code only has to be clear, consistent and unambiguous.
Do exam questions count from 0 or 1?
AQA says exam paper questions assume that indexing for arrays and strings starts at 0 unless a question states otherwise.
What is the difference between DIV and MOD?
DIV gives the whole number quotient and MOD gives the remainder. 23 DIV 5 is 4 and 23 MOD 5 is 3.
What makes a subroutine a function in AQA pseudo-code?
It contains a RETURN. A subroutine without RETURN is a procedure.

Revision cards

Say the answer first, then flip the card to check it.

Where to go next

  • Solve it

    Code Editor

    Write and run code right in your browser

    Open the tool
  • Learn it

    Programming Languages

    Compiled vs interpreted, paradigms and the evolution of how we talk to machines

    Start the course
  • Test it

    GCSE Computer Science

    A new exam-style paper every day, with instant marking and a mark scheme

    Start today's paper
Read next
UK · GCSEAQA GCSE Computer Science (8525): papers and boundariesAQA GCSE Computer Science 8525 explained: two papers, what each covers, programming languages, worked examples and June 2026 grade boundaries.