OCR GCSE Computer Science Paper 2 Practice 2026 - Free Practice Questions and Study Guide

Question: 1 / 400

What is a variable that is available throughout the entire program called?

Private variable

Global variable

A variable that is available throughout the entire program is referred to as a global variable. Global variables are defined outside of any specific function or block, which means they can be accessed and modified by any part of the program. This accessibility makes them particularly useful for storing information that needs to be shared across multiple functions or modules.

In contrast, private variables are only accessible within the scope or class they are defined in, preventing other parts of the program from accessing or modifying them. Local variables are restricted to the function or block where they are declared, thereby limiting their visibility and lifespan to that specific context. Static variables, on the other hand, maintain their value even after the function or block in which they are defined has finished executing, but they still don't offer global access like global variables do.

Get further explanation with Examzify DeepDiveBeta

Local variable

Static variable

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy