AQA · GCSE · Computer Science
Course version: 8525 · Version from Sept 2020
Understand the concept of subroutines. Students should know that a…
Full specification wording
Structured programming and subroutines (procedures and functions): Understand the concept of subroutines. Students should know that a subroutine is a named ‘out of line’ block of code that may be executed (called) by simply writing its name in a program statement.
A subroutine is a named block of code written separately from the main program flow, described as ‘out of line’.
Checked against the AQA 8525 specification (opens in a new tab) on .
- Point 1 of 9
Study notes
From the checked teaching notes for this specification point.
The idea
A subroutine is a named block of code written separately from the main program flow, described as ‘out of line’. It is executed by a call: writing its name in a program statement, usually with brackets and any arguments, such as calculateArea(5, 3). When the call runs, control jumps to the subroutine, the code inside executes, and control returns to the statement after the call. Naming the block once and calling it many times avoids duplicating code and makes programs easier to read and maintain. Learners should recognise a call in a program listing, explain what happens when it executes, and distinguish defining a subroutine from calling it.
What earns the marks
- States that a subroutine is a named block of code.
- Explains that the block is ‘out of line’, meaning it is written separately from the main sequence of statements.
- Describes that a subroutine is executed by a call, which is writing its name in a program statement.
- Explains that control transfers to the subroutine when called and returns afterwards.
- Identifies a subroutine call within a short program listing and distinguishes it from the definition.
Common mistakes and how to put them right
Confusing the definition of a subroutine with a call to it.
Put it right: The definition contains the code, the call executes it by name.
Believing the subroutine code runs automatically without being called.
Put it right: It runs only when its name appears in a call statement.
Thinking ‘out of line’ means the code is deleted or unavailable.
Put it right: It is stored separately but still part of the program.
Exam tips
- Look for the subroutine name followed by brackets to spot a call in a listing.
- Use the phrase ‘out of line’ when explaining why the block sits apart from the main code.
- Describe the sequence: call by name, execute the block, then return to the next statement.
Try the lesson
The start of the Structured programming and subroutines (procedures and functions): Understand the concept of subroutines. Students should know that a subroutine is a named ‘out of line’ block of code that may be executed (called) by simply writing its name in a program statement. lesson, made from checked teaching notes for this specification point.
Have a go first
A programmer writes a block of code, gives it the name calculateTotal, and later runs it by writing calculateTotal() in another part of the program. What is this block of code called?
There is more to this lesson
The full lesson goes on to check your understanding and help you earn the marks. Create a free account to carry on, with your progress saved.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge
Test your understanding of Structured programming and subroutines (procedures and functions): Understand the concept of subroutines. Students should know that a subroutine is a named ‘out of line’ block of code that may be executed (called) by simply writing its name in a program statement.
Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge