GCSE Computer Science Revision — Subroutines
Revise Subroutines for GCSE Computer Science with a topic explanation, worked example and common mistakes. Check the board notes for specification differences.
At a glance
- What StudyVector is
- An exam-practice platform with board-aligned questions, explanations, and adaptive next steps.
- This topic
- Subroutines in GCSE Computer Science: explanation, examples, and practice links on this page.
- Who it’s for
- Students revising GCSE Computer Science for UK exams.
- Exam boards
- Check your course page and the topic board notes for supported specifications.
- Free plan
- Sign up free to use tutor paths and feedback on your answers. Free access is Free daily revision · No card required. Pricing
- What makes it different
- Syllabus-shaped practice and progress tracking—not generic AI answers.
This page includes a topic explanation and a worked example. Check your course for current practice coverage.
Next in this topic area
Next step: Arrays & Lists
Continue in the same course — structured practice and explanations on StudyVector.
Go to Arrays & ListsTopic explanation
What is Subroutines?
A subroutine is a named block of code that performs a specific task and can be called from other parts of the program. Using subroutines (also known as functions or procedures) helps to break down a large program into smaller, more manageable, and reusable chunks. This makes the code easier to read, test, and debug, following the DRY (Don't Repeat Yourself) principle.
Board notes: A fundamental concept for AQA, Edexcel, and OCR. You will be expected to write your own subroutines (both functions and procedures) and understand the concepts of parameters, arguments, and local variables.
Step-by-step explanationWorked examples
Worked example
A function to add two numbers in Python: `def add_numbers(num1, num2): return num1 + num2`. Here, `num1` and `num2` are parameters. You can call this from your main program like this: `sum_result = add_numbers(5, 10)`. The `sum_result` variable will now hold the value 15.
Practise this topic
Start with low-focus cards for Subroutines, then move into full exam-style practice when you want the heavier session.
Common mistakes
- 1Confusing functions and procedures. A function returns a value (e.g., a calculation result), while a procedure just performs a task (e.g., printing to the screen).
- 2Getting the scope of variables wrong. Variables defined inside a subroutine are local and can only be used within it, whereas global variables can be accessed from anywhere but are generally bad practice.
- 3Forgetting to call the subroutine. Just defining a subroutine doesn't make it run; you have to explicitly call it by its name in your main program.
Subroutines exam questions
Check the available question sets for Subroutines. Use your course and exam board to confirm which practice is relevant.
Subroutines exam questionsGet help with Subroutines
Get a personalised explanation for Subroutines from the StudyVector tutor. Ask follow-up questions and work through problems with step-by-step support.
Open tutorSave your progress in Subroutines
Start a free account for low-focus question cards, feedback and Play routes across available topics. Free daily limits apply; no card required.
Continue your revision
A public question for Subroutines is still being reviewed. Your course page shows the topics currently available for practice.
Continue with Subroutines
Create a free account to keep your course choice and save your practice progress.
Start free low-focus cardsAlready have an account? Log in
Frequently asked questions
What are parameters and arguments in a subroutine?
Parameters are the variables listed in the subroutine's definition that act as placeholders for the data it will receive. Arguments are the actual values that are passed into the subroutine when it is called.
Why is using subroutines good programming practice?
Subroutines make code more modular and reusable. They reduce code duplication, make the program easier to understand and debug, and allow programmers to work on different parts of a program independently.