Exam-style question
Try this first
Explain two advantages of using subroutines in a program.
Model answer
What a good answer should say
- Subroutines can reduce duplication because a set of instructions is written once in a named block and called whenever it is needed.
- They can also improve readability because a meaningful name identifies the purpose of the block, making the main program easier to understand.
- Separating code into named blocks can additionally make the program easier to maintain, since changes to that operation can be made in one place.
Explanation
Why this works
Credit should be given for two clearly explained advantages. Suitable points include reducing repeated code, improving readability, making a program easier to maintain, and allowing a block of code to be used whenever it is needed.
Common mistake
No common mistake is linked to this question yet.
