Skip to topic
    ← Back to course topics

    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.

    Read the Data types study guideFull revision notes for AQA GCSE Computer Science

    Your focus

    1. Describe the kind of value each listed data type stores.
    2. Select an appropriate data type for a given value or scenario.
    3. 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
    1. 1Day 1-2: Memorise the 5 primitive data types and their definitions, noting differences between Character and String.
    2. 2Day 3-4: Practice identifying data types for real-world scenarios (e.g. flight booking systems, supermarket checkouts).
    3. 3Day 5-6: Master explicit type casting functions across Python and AQA pseudo-code (e.g. INT, REAL, STRING, CHAR).
    4. 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)
    State

    Give the exact name of the data type (e.g. 'Boolean' or 'Real') without explanation or justification.

    Explain

    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)
    Pitfall: Choosing an integer data type for telephone numbers or postal codes instead of a string.
    ❌ Weak Answer (Loses Marks):Telephone number should be an integer because it consists only of numbers.
    Example improved answer:Telephone number must be stored as a string because it can contain leading zeros (which would be removed by an integer type) and may include spaces or formatting characters like '+'. No arithmetic calculations are performed on it.
    Examiner Tip: Always check if the numeric sequence requires leading zeros or arithmetic. If it needs leading zeros or symbols, state string to secure both marks.
    Pitfall: Confusing character and string types, especially when denoting single-character inputs or single-digit codes.
    ❌ Weak Answer (Loses Marks):A student's middle initial is stored as a string because it is text.
    Example improved answer:A student's middle initial should be stored as a character because it consists of exactly one alphanumeric symbol, minimising memory allocation compared to a dynamic string.
    Examiner Tip: Use 'character' when the data is strictly a single character in length; reserve 'string' for zero or more characters.
    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. 1.Step 1: Identify the nature of Student ID ('ST092') - contains letters and digits, so it must be a String.
    2. 2.Step 2: Identify Age (15) - a whole number representing count/years, so it is an Integer.
    3. 3.Step 3: Identify Attendance Percentage (94.5) - contains a fractional decimal part, so it is a Real (or Float).
    4. 4.Step 4: Identify Medical Form Returned (True) - binary state taking only True or False, so it is a Boolean.
    5. 5.Step 5: Justify Attendance Percentage - it requires fractional/decimal precision which cannot be stored in an Integer.
    Final Answer: Student ID: String; Age: Integer; Attendance Percentage: Real (Float); Medical Form Returned: Boolean. Attendance Percentage requires Real because it stores numbers with fractional/decimal parts.

    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. 1.Step 1: Identify default input type - the 'input()' function returns data as a String by default.
    2. 2.Step 2: Determine result of '+' on strings - the '+' operator performs concatenation rather than arithmetic addition.
    3. 3.Step 3: State current output - concatenating '12' and '8' produces '128'.
    4. 4.Step 4: Apply casting - wrap the inputs in 'STRING_TO_INT' (or 'int()') before addition to treat them as integers.
    5. 5.Step 5: Construct corrected code - 'total = STRING_TO_INT(num1) + STRING_TO_INT(num2)'.
    Final Answer: Output is '128' because the '+' operator concatenates the string inputs. Corrected pseudo-code: 'total = STRING_TO_INT(num1) + STRING_TO_INT(num2)' (or casting at the point of input).
    Active Recall Memory Test
    What are the five primitive data types recognised in AQA GCSE Computer Science?
    Key Fact: Integer, Real (Float), Boolean, Character, String.
    Why must a UK mobile phone number (e.g. '07123456789') be stored as a String rather than an Integer?
    Key Fact: An integer strips the leading zero ('0') and cannot store spaces, plus telephone numbers are not used in arithmetic.
    What is the process of converting a variable from one data type to another called?
    Key Fact: Type casting (or type conversion).
    How does a character data type differ from a string data type?
    Key Fact: A character stores exactly one alphanumeric symbol, whereas a string stores a sequence of zero or more characters.
    Frequently Asked Questions
    Can I write 'Float' instead of 'Real' in an AQA exam?
    Yes, AQA accepts both 'Real' and 'Float' interchangeably on mark schemes. However, you should avoid colloquial terms such as 'decimal' or 'number', as these will not earn marks.
    Why does data typing matter if Python does not make you declare types?
    Although Python uses dynamic typing, it still enforces types behind the scenes. Attempting to concatenate a string and an integer causes a 'TypeError', so programmers must understand data types to cast values properly and allocate memory efficiently.
    How much memory does each data type typically take?
    In general theoretical terms, a Boolean requires 1 bit (often stored in 1 byte), a Character takes 1 byte (under standard 7/8-bit ASCII), an Integer typically uses 2 or 4 bytes, and Reals often use 4 or 8 bytes. Strings vary depending on length because they are sequences of characters.
    What is the difference between implicit and explicit casting?
    Explicit casting is when a programmer manually uses a function like 'int()' or 'STRING_TO_INT()' to convert a type. Implicit casting (or type coercion) is when the programming language automatically converts compatible types, such as converting an integer to a float during mixed arithmetic.