What is a variable in programming? Choose the best definition and example.

Study for the End of Year 8 Computer Science Test. Prepare with flashcards and multiple choice questions, each with hints and explanations. Get ready for your exam!

Multiple Choice

What is a variable in programming? Choose the best definition and example.

Explanation:
A variable is a named container in memory that holds a value you can read and change as a program runs. The name lets you refer to that storage location, and the value is what’s stored there. The example age = 12 shows this clearly: the name is age, it stores the value 12, and you can later assign a new value (e.g., age = 20) to update it. This combination—a name, a storage location, and a value that can be changed—is what makes something a variable. A constant would be a fixed value that doesn’t change, which is why the other descriptions don’t fit as well.

A variable is a named container in memory that holds a value you can read and change as a program runs. The name lets you refer to that storage location, and the value is what’s stored there. The example age = 12 shows this clearly: the name is age, it stores the value 12, and you can later assign a new value (e.g., age = 20) to update it. This combination—a name, a storage location, and a value that can be changed—is what makes something a variable. A constant would be a fixed value that doesn’t change, which is why the other descriptions don’t fit as well.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy