Oxford, Cambridge and RSA (OCR) GCSE Computer Science Paper 2 Practice

Get more with Examzify Plus

Remove ads, unlock favorites, save progress, and access premium tools across devices.

FavoritesSave progressAd-free
From $9.99Learn more

1 / 400

What is the known term for a variable that can only be accessed within its own function or block?

Global variable

Immutable variable

Local variable

A local variable is one that is declared within a specific function or block of code and can only be accessed and used within that same function or block. This means that local variables are not visible outside of their defining context, which helps to prevent accidental interference with variables in other functions or the global scope. This encapsulation is important for maintaining modularity and reducing errors in larger programs.

For instance, if a function defines a variable to hold a temporary value, that variable won't affect or be affected by variables outside of that function, thus allowing for safer and cleaner code.

Get further explanation with Examzify DeepDiveBeta

Reference variable

Next Question
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy