Writing Exam-Style Programs
Aligned to the AQA 8525 specification
- Level
- Intermediate
- Reading time
- 6 min
- Published
- 9 June 2026
- Updated
- 1 July 2026
On this page
Key takeaways
- Paper 1 questions combine variables, selection, iteration, arrays and subroutines in one program, so this lesson shows how to integrate concepts you already know rather than introducing new ones.
- Always plan before writing using inputs, processing, outputs (IPO), then list the constructs you need; this avoids reaching the end and realising you forgot validation or used the wrong loop type.
- Use a FOR loop when the number of iterations is known in advance and a WHILE loop when you repeat until a condition changes, such as validating input until it is acceptable.
- Verify a finished program with a trace table, using a test case that exercises the validation (an invalid input followed by a valid one) and checks each output branch.
- Use a FUNCTION when a value needs to be returned and a SUBROUTINE for actions; a SUBROUTINE cannot return a value with RETURN.
Want more lessons like this one?
Generate lessons on anything you study. Free account, no card needed.
Frequently asked questions
Plan before you write. Start by listing the inputs, processing and outputs (IPO), then identify the programming constructs you need, such as arrays, loops and functions. Build the solution piece by piece, then verify it with a trace table before you stop writing.
Use a FOR loop when you know the exact number of iterations in advance, for example collecting 5 scores. Use a WHILE loop when you repeat until a condition changes, such as validating input by asking again until the value is acceptable. Match the loop type to the problem.
Common errors include uninitialised variables, missing ENDIF, ENDWHILE or NEXT, using the wrong loop type, array index errors, missing input validation, using a SUBROUTINE where a value must be returned, and vague identifier names like x or temp.
Generate revision on any topic you study
Type any topic you're studying and Aicademy generates a complete lesson, quiz, and flashcard set, personalised to your level.
Lessons on anything
Structured, level-matched lessons on any topic you study
Practice quizzes
Find out what you actually know before the exam does
Flashcard sets
Lock in key concepts with instant revision cards
Ask Aica
Stuck on something? Get a clear explanation, any time
Logic Gates to Circuits: Worked Practice
Related lessons
9 min
8 min
8 min
9 min
9 min
9 min