Subroutines, Local and Global Variables (AQA A-Level Computer Science): Quizzes
📚Quizzes
Practise the questions
10 questions from this quiz
ShowHide
Practise the questions
10 questions from this quiz
What is a subroutine in programming?
What is a subroutine in programming?
A self-contained code block for tasks
Why are subroutines easier to test and debug?
Why are subroutines easier to test and debug?
They are self-contained code blocks
What distinguishes a function from other subroutines?
What distinguishes a function from other subroutines?
A function returns a value
What is the difference between a parameter and an argument?
What is the difference between a parameter and an argument?
Parameter is placeholder; argument is value
Where can a local variable be accessed?
Where can a local variable be accessed?
Only within its specific subroutine
What happens to local variables when a subroutine finishes executing?
What happens to local variables when a subroutine finishes executing?
They are removed from memory
When should you use a global variable?
When should you use a global variable?
When it needs program-wide accessibility
How do you declare a global variable in Python?
How do you declare a global variable in Python?
Use the global keyword
What are catch blocks used for in exception handling?
What are catch blocks used for in exception handling?
Triggered in response to specific errors
What happens immediately after an exception is thrown?
What happens immediately after an exception is thrown?
The current state is saved in memory
