Myths about teaching can hold you back
Learn why
These resources will be removed by the end of the Spring Term 2026.
Start using our brand new teaching resources now. Designed by teachers and subject experts, with real classrooms in mind.
The older resources below were created for lockdown learning during the pandemic and are not designed for classroom teaching.
Lesson details
Key learning points
- In this lesson, we will learn about the scope of variables. When a variable is initialised within a subroutine it cannot be easily accessed and modified by other subroutines. This lesson will teach us about the different levels of scope and show us how to access variables that are initialised within subroutines.
Licence
This content is made available by Oak National Academy Limited and its partners and licensed under Oak’s terms & conditions (Collection 1), except where otherwise stated.
3 Questions
Q1.What will be the return value based on the function call to_the_power(3,2)?
What will be the return value based on the function call to_the_power(3,2)?

12
3
6
Q2.What will be the return value based on the function call find_highest(12,9)?
What will be the return value based on the function call find_highest(12,9)?

3
9
No return value
Q3.What will be the return value based on the function call multiple(30,3)?
What will be the return value based on the function call multiple(30,3)?

No
5 Questions
Q1.On which line is the global variable number assigned?
On which line is the global variable number assigned?

1
2
6
Q2.On which line is the local variable number assigned?
On which line is the local variable number assigned?

1
5
6
Q3.What value will line 8 output when this program is executed?
What value will line 8 output when this program is executed?

10
5
There will be no output
Q4.What will happen when this program is executed?
What will happen when this program is executed?

An error message because the global variable number is not defined
It will output 10
It will output 5
Q5.On which line of code does constant declaration occur?
On which line of code does constant declaration occur?

1
2
4