Data types — AQA GCSE Computer Science
In AQA GCSE Computer Science, data types classify values to define the memory allocated to them and the operations that can be performed. The five core primitive types are integer, real (float), Boolean, character, and string, all of which require precise selection and casting during program execution.
Data types explained
This statement introduces the list of data types that follows in section 3.2.1, so you must both understand each type and use it appropriately.
Read the full explanation
Understanding means knowing what kind of value each type holds and how it is represented; using appropriately means selecting the right type for a given value or task. For example, a whole number such as a score suits an integer, a decimal such as a price suits a real or float, a true/false flag suits a Boolean, a single symbol suits a character, and text suits a string. In a multiple-choice question, match the value or scenario to the type whose definition fits, and reject types that would store the value incorrectly or waste memory.
Your focus
- Describe the kind of value each listed data type stores.
- Select an appropriate data type for a given value or scenario.
- Justify a type choice by reference to the value and the operations required.
Data types exam tips
Topic Overview
Data types form the foundation of data representation and algorithmic problem solving in AQA GCSE Computer Science. Every variable, constant, and data structure must hold an explicit or inferred type, which dictates how bits are stored in RAM and what operations are valid.
Understanding data types ensures programs run efficiently, prevent runtime type errors, and maintain data integrity. It links theoretical concepts of binary representation directly to practical programming and software design.
Key Concepts
- →Integer: Whole numbers (positive, negative, or zero) without fractional components, used for counting and arithmetic.
- →Real / Float: Numbers containing fractional or decimal components, stored using floating-point representation.
- →Boolean: A logical data type that can take only one of two values: True or False.
- →Character and String: A character is a single alphanumeric or control symbol; a string is a sequence of zero or more characters.
- →Type Casting: The explicit conversion of data from one type to another (e.g. converting a string representation of digits into an integer).
Marking Points
- Identifies each listed data type and the kind of value it stores, such as integer for whole numbers and Boolean for true/false.
- Selects an appropriate data type for a given value or scenario rather than an unsuitable one.
- Explains why a chosen type is appropriate, referring to the nature of the value and valid operations.
- Recognises that using an inappropriate type can cause errors or incorrect results.
Examiner Tips
- 💡Identify what the value represents before selecting a type.
- 💡Reject options that cannot store the value correctly, such as a Boolean for a price.
- 💡If asked why, link the type to the value's nature and the operations needed.
- 💡Use AQA-approved terminology: refer to numbers with decimal points as 'Real' or 'Float' rather than 'decimal' or 'fraction'.
- 💡When explaining why a field is a string, always mention two features: preventing loss of leading zeros and not requiring mathematical operations.
- 💡Check trace tables carefully when casting occurs; ensure you update variable values to match their new data type (e.g. writing '5.0' for Real instead of '5').
Common Mistakes
- Choosing a string for a value that will be used in arithmetic; correction: select a numeric type so calculations are valid.
- Treating a character and a string as interchangeable; correction: a character holds a single symbol while a string holds text of any length.
- Ignoring the purpose of the value and picking any type; correction: match the type to how the value will be stored and used.
- Believing any variable containing digits must be an integer: non-arithmetic identifiers like phone numbers, bar codes, and national insurance numbers must be strings to retain formatting and leading zeros.
- Assuming integer division returns a real number: in many languages and pseudo-code constructs, dividing integers truncates or requires explicit conversion (DIV vs /).
- Confusing single-quote characters with strings: AQA expects students to know a character is exactly one byte/symbol, whereas strings are composite collections of characters.
Revision Plan
- 1Day 1-2: Memorise the 5 primitive data types and their definitions, noting differences between Character and String.
- 2Day 3-4: Practice identifying data types for real-world scenarios (e.g. flight booking systems, supermarket checkouts).
- 3Day 5-6: Master explicit type casting functions across Python and AQA pseudo-code (e.g. INT, REAL, STRING, CHAR).
- 4Day 7: Complete past paper questions focusing on 1-mark and 2-mark data type identification and justification.
Exam Question Types
- 📋Table Completion: Given a list of variables and example values, state the most appropriate data type for each.
- 📋Justification Questions: Explain why a specific data type must be chosen over another (e.g. String vs Integer).
- 📋Code and Trace Table Analysis: Identify errors where incompatible data types are combined without casting.
Command Word Expectations (AQA)
Give the exact name of the data type (e.g. 'Boolean' or 'Real') without explanation or justification.
Identify the data type and provide reasoned points linking its characteristics (e.g. decimal precision, leading zeros) directly to the context.
How Students Lose Marks (Examiner Pitfalls)
Step-by-Step Worked Solutions
Question: A school registration system records: Student ID ('ST092'), Age (15), Attendance Percentage (94.5), and Medical Form Returned (True). State the most appropriate data type for each value and justify the choice for Attendance Percentage.
- 1.Step 1: Identify the nature of Student ID ('ST092') - contains letters and digits, so it must be a String.
- 2.Step 2: Identify Age (15) - a whole number representing count/years, so it is an Integer.
- 3.Step 3: Identify Attendance Percentage (94.5) - contains a fractional decimal part, so it is a Real (or Float).
- 4.Step 4: Identify Medical Form Returned (True) - binary state taking only True or False, so it is a Boolean.
- 5.Step 5: Justify Attendance Percentage - it requires fractional/decimal precision which cannot be stored in an Integer.
Question: An algorithm asks a user to enter two numbers: 'num1 = input()' and 'num2 = input()'. The programmer writes 'total = num1 + num2'. If the user enters '12' and '8', explain the output and write the corrected pseudo-code using casting.
- 1.Step 1: Identify default input type - the 'input()' function returns data as a String by default.
- 2.Step 2: Determine result of '+' on strings - the '+' operator performs concatenation rather than arithmetic addition.
- 3.Step 3: State current output - concatenating '12' and '8' produces '128'.
- 4.Step 4: Apply casting - wrap the inputs in 'STRING_TO_INT' (or 'int()') before addition to treat them as integers.
- 5.Step 5: Construct corrected code - 'total = STRING_TO_INT(num1) + STRING_TO_INT(num2)'.