Subroutines are the fundamental units of modular programming, enabling the encapsulation of code into named blocks (procedures and functions) to promote reusability, maintainability, and abstraction. Candidates must distinguish between procedures, which execute a sequence of actions, and functions, which return a value to the calling statement, while demonstrating precise control over data flow via parameters and arguments. A critical component of assessment is the mastery of variable scope, specifically the distinction between local and global variables and the implications of 'shadowing' within the execution stack. High-level responses will further differentiate between passing parameters by value and by reference, explaining the impact on memory and original data integrity.
Key skills and knowledge for this topic
Key points examiners look for in your answers
Expert advice for maximising your marks
Pitfalls to avoid in your exam answers
Essential terms to know
How questions on this topic are typically asked
Related required practicals
Practice questions tailored to this topic