Skip to main content
Northern IrelandDigital TechnologySyllabus dot point

How do programs store data using variables and constants, and why does each store have a data type?

Explain how programs store data in variables and constants, describe the common data types (integer, real, Boolean, character and string), and explain why the correct data type is chosen.

A CCEA GCSE Digital Technology answer on data, variables and data types for the Programming route (Unit 4), covering variables and constants, the common data types of integer, real, Boolean, character and string, and why the correct data type is chosen.

Generated by Claude Opus 4.810 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. Variables and constants
  3. The common data types
  4. Why the data type matters
  5. Choosing data types for a program
  6. Why this matters

What this dot point is asking

Every program needs to store data while it runs, and it does so in named stores called variables and constants, each with a data type. The Programming route (Unit 4, Digital Development Concepts) expects you to explain how variables and constants store data, describe the common data types, and explain why the correct data type is chosen. This is the foundation of all the program code you read, write and design in the route.

Variables and constants

A program holds data in named stores in memory, and there are two kinds.

The difference is simply whether the value can change. Use a variable for anything that varies during the program, such as a user's input, a running total or a counter. Use a constant for a value that should stay the same throughout, such as a mathematical constant or a rate used in calculations; this also makes the program clearer and easier to change, because the value is defined in one place.

The common data types

Each store is given a data type that tells the program what kind of value it holds and how to treat it.

Knowing these lets you pick the right one for any piece of data: a count uses an integer, a measurement or price uses a real, a yes/no flag uses a Boolean, a single key press uses a character, and a name or message uses a string.

Why the data type matters

Choosing the correct data type is not just tidy; it affects whether the program works.

The data type keeps data valid (an age stored as an integer cannot accidentally hold text), uses memory sensibly (a Boolean needs far less space than a string), and lets the program calculate and compare correctly. For example, storing a price as an integer would lose the pence, so a real is needed; storing a phone number as an integer could drop a leading zero, so a string is often better. The wrong data type can cause errors or wrong results, which is why the choice is part of good design.

Choosing data types for a program

The exam often gives several items of data and asks for the best type and a reason, so the skill is matching each to its type and justifying the choice.

Why this matters

Variables, constants and data types are the building blocks of every program in the Programming route. They are examined in Unit 4 and are used in every design and piece of code you produce for the Unit 5 practical. Choosing the right store and the right data type is part of writing correct, efficient programs, so this dot point underpins the whole route.

Exam-style practice questions

Practice questions written in the style of CCEA exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

CCEA-style (Unit 4)3 marksExplain the difference between a variable and a constant, and give one example of when each would be used in a program.
Show worked answer →

A variable is a named store whose value can change while the program runs, for example a score that goes up as the player earns points (1 mark for the description, 1 mark for a valid changing example).

A constant is a named store whose value is fixed and does not change while the program runs, for example the value of Pi, or a VAT rate used in a calculation (1 mark for the description with a valid fixed example). A strong answer makes the contrast clear: the value of a variable can change, the value of a constant cannot, and constants are used for values that should stay the same throughout.

CCEA-style (Unit 4)4 marksState the most suitable data type for each of the following and justify one choice: a person's age, a price in pounds and pence, whether a user is logged in, and a person's name.
Show worked answer →

Age: integer, because it is a whole number (1 mark). Price in pounds and pence: real (decimal), because it needs a fractional part (1 mark). Whether a user is logged in: Boolean, because it is true or false (1 mark). A person's name: string, because it is text made of characters (1 mark).

A justification, for example that a price needs a real because integers cannot store the pence, secures the explanation. Choosing the right data type keeps data valid, uses memory sensibly and lets the program calculate and compare correctly, so the marks reward both the correct types and a sound reason.

Related dot points

Sources & how we know this