Subroutines — GCSE Computer Science Revision
Revise Subroutines for GCSE Computer Science. Step-by-step explanation, worked examples, common mistakes and exam-style practice aligned to AQA, Edexcel, OCR, WJEC, Eduqas, CCEA, Cambridge International (CIE), SQA, IB, AP.
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
- Practice is aligned to major specifications (AQA, Edexcel, OCR, WJEC, Eduqas, CCEA, Cambridge International (CIE), SQA, IB, AP).
- Free plan
- Sign up free to use tutor paths and feedback on your answers. Free access is 3 days uncapped, then 30 min practice/day. Pricing
- What makes it different
- Syllabus-shaped practice and progress tracking—not generic AI answers.
Topic has curated content entry with explanation, mistakes, and worked example. [auto-gate:promote; score=70.6]
Next in this topic area
Next step: Arrays & Lists
Continue in the same course — structured practice and explanations on StudyVector.
Go to Arrays & ListsWhat 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 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
Jump into adaptive, exam-style questions for Subroutines. Free to start; sign in to save progress.
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
Exam-style questions for Subroutines with mark-scheme style solutions and timing practice. Aligned to AQA, Edexcel, OCR, WJEC, Eduqas, CCEA, Cambridge International (CIE), SQA, IB, AP specifications.
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 tutorFree full access to Subroutines
Sign up in 30 seconds to unlock step-by-step explanations, exam-style practice, instant feedback and on-demand coaching — completely free, no card required.
Try a practice question
Unlock Subroutines practice questions
Get instant feedback, step-by-step help and exam-style practice — free, no card needed.
Start Free — No Card NeededAlready have an account? Log in
Step-by-step method
Step-by-step explanation
4 steps · Worked method for Subroutines
Core concept
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 l…
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.