Local and global variables (Edexcel GCSE Computer Science): Quizzes

📚Quizzes
Local and global variables
Sign up to keep practising.Create a free account to play more quizzes and track your progress.

Practise the questions

12 questions from this quiz

Show

What does 'scope' refer to in programming?

Where a variable can be accessed

What is a local scope?

Area within a single subprogram

Where can a local variable be accessed?

Only within its subprogram

What happens to a local variable after its subprogram finishes running?

It disappears

What is global scope?

Covers the entire program

Where can global variables be accessed from?

Main program and all subprograms

How long do global variables exist?

For the entire program duration

When a program encounters a variable name, which scope is checked first?

Local scope

Can variables with the same name exist in different scopes?

Yes, without interfering

What is a key benefit of local variables?

Prevent accidental changes

How do you identify if a variable is local or global?

Where it is declared

If 'total' is global and also declared locally in a function, which is used inside the function?

The local version

Join 100,000+ GCSE students studying Quizzes with us.

Select your subjects, and get access to A+ resources today.