Exam-style question
Try this first
A programmer is developing a game that frequently needs to check if a specific number is divisible by 7. Describe the value of creating a subprogram for this check, rather than writing the division logic directly each time it is needed. [3 marks].
Answer and explanation
Concise answer
Creating a subprogram for the 'is divisible by 7' check offers significant value.
Why this is correct
1 mark for explaining code reusability by writing the logic once. 1 mark for explaining improved readability through a named function/encapsulation. 1 mark for explaining easier maintenance or debugging because changes/fixes are in one place.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
