Which is a named location in memory that is used to hold the value that may be modified by the program?

Homepage

  • Skip to content
  • Accessibility Help

BBC Account

Notifications

  • Home
  • News
  • Sport
  • Weather
  • iPlayer
  • Sounds
  • Bitesize
  • CBeebies
  • CBBC
  • Food
  • Home
  • News
  • Sport
  • Reel
  • Worklife
  • Travel
  • Future
  • Culture
  • TV
  • Weather
  • Sounds

More menu

Search Bitesize Search Bitesize

  • Home
  • News
  • Sport
  • Weather
  • iPlayer
  • Sounds
  • Bitesize
  • CBeebies
  • CBBC
  • Food
  • Home
  • News
  • Sport
  • Reel
  • Worklife
  • Travel
  • Future
  • Culture
  • TV
  • Weather
  • Sounds
Close menu

BITESIZE

  • Home
  • Learn
  • Support
  • Careers
    • My Bitesize

GCSE

Eduqas

Data structures and data types

Variables, constants and arrays form the basis for how data is stored within a program. They must be declared with meaningful identifier names and appropriate data types that match the data. Without the correct data structures and data types, programs will not work.

Part of

Computer Science

Computational thinking and programming

  • Revise

  • quiz

    Test

  1. previous

  2. 1
  3. 2
  4. 3
  5. 4
  6. 5
  7. 6
  8. 7
  9. 8
  10. Page4of 8
  11. next

Variables and constants

Programs usually use data in some shape or form. Data in programs is usually referred to as values.

Variables

A variable is a named memory location that holds a value. The value held in a variable can - and usually does - change as the program is running.

Variables make it easy for a programmer to use memory locations. The computer keeps track of which memory location the variable refers to. All the programmer has to do is remember the name of the identifier the variable was given.

Declaration and assignment

Most programming languages require a variable to be identified before a value is assigned to it. This is known as declaring a variable:

score is integer

This would declare a variable called score that would hold integers.

Giving a variable a value is known as assignment. A variable must be assigned a value before it can be used. For example:

set score = 0

This would assign the value 0 to the variable score.

Some programming languages, such as Python, enable variables to be declared and assigned a value in the same line of code.

Constants

A constant allows a value to be assigned an identifier name. Unlike a variable, the value assigned to a constant cannot be changed whilst the program is running.

Constants are useful because they are declared and assigned once, but can be referred to over and over again throughout the program. They are used for values that are unlikely to change, for example:

  • pi, eg constant PI = 3.142

  1. previous

  2. 1
  3. 2
  4. 3
  5. 4
  6. 5
  7. 6
  8. 7
  9. 8
  10. Page4of 8
  11. next

GCSE Subjects

  1. Art and Design
  2. Biology (Single Science)
  3. Business
  4. Chemistry (Single Science)
  5. Combined Science
  6. Computer Science
  7. Design and Technology
  8. Digital Technology (CCEA)
  9. Drama
  10. English Language
  11. English Literature
  12. French
  13. Geography
  14. German
  15. History
  16. Home Economics: Food and Nutrition (CCEA)
  17. Hospitality (CCEA)
  18. ICT
  19. Irish – Learners (CCEA)
  20. Journalism (CCEA)
  21. Learning for Life and Work (CCEA)
  22. Mandarin
  23. Maths
  24. Maths Numeracy (WJEC)
  25. Media Studies
  26. Modern Foreign Languages
  27. Moving Image Arts (CCEA)
  28. Music
  29. Physical Education
  30. Physics (Single Science)
  31. PSHE and Citizenship
  32. Religious Studies
  33. Science
  34. Sociology
  35. Spanish
  36. Welsh Second Language (WJEC)

Is named location in memory that is used to hold the value that may be modified by the program?

Answer: A variable is a named memory location that temporarily stores data that can change while the program is running.

What is a named location in the memory?

A variable is a named memory location which temporarily stores data that can change while the program is running.

Is a named location in the memory that is used to hold the value?

A buffer is a named location in the memory which stores data temporarily. A buffer is a memory location that is used to store data for a short period of time. It is used so that data can be retrieved much quicker and there is no delay when the data is being retrieved by the processor.

What are named memory locations where values can be stored during the life of a program?

A variable can be thought of as a memory location that can hold values of a specific type. The value in a variable may change during the life of the program—hence the name “variable.”