Pearson Edexcel · GCSE · Computer Science

    Course version: Pearson-GCSE-Computer-Science · Version from Mar 2026

    Data types and structures

    Master the fundamental building blocks of programming! This topic covers how computers store, access, and manipulate data using primitive types and complex structures like arrays and records. Essential for writing robust code and scoring high marks in practical exams.

    • 5 min read
    • 3 worked examples
    • 5 practice questions
    • 6 key terms

    Study Notes

    Overview

    Welcome to one of the most fundamental topics in GCSE Computer Science: Data Types and Structures. At its core, programming is all about taking data, processing it, and outputting a result. But before a computer can process data, it needs to know what kind of data it's dealing with. Is it a number? A word? A simple true or false?

    This is why data types matter. They tell the computer how much memory to allocate and what operations are permitted. If you try to multiply two words together, your program will crash. Understanding primitive data types (integers, reals, booleans, chars) and structured types (strings, arrays, records) is crucial not just for passing your theory exam, but for writing working code in your practical assessments.

    Examiners frequently test this topic by asking you to identify appropriate data types for given scenarios, spot errors in array indexing, or manipulate strings to extract specific information. Let's dive in.

    Key Concepts

    Concept 1: Primitive Data Types

    Primitive data types are the basic building blocks. They cannot be broken down into simpler types.

    • Integer: A whole number with no fractional part. Use integers for counting things, like a player's score, age in years, or the number of items in a basket.
    • Real (or Float): A number that includes a decimal point. Use reals for measurements, prices, or precise calculations like averages.
    • Boolean: A type that can hold only one of two values: TRUE or FALSE. Use booleans for flags or switches, like checking if a user is logged in or if a game is over.
    • Character (Char): A single alphanumeric symbol, enclosed in quotes. It can be a letter ('A'), a number ('7'), or a symbol ('!').

    Examiner Tip: Remember that storing the number 7 as a character '7' means you cannot perform mathematical operations on it. It is treated as text, not a value.

    Primitive Data Types ReferenceOpen full-size image (opens in a new tab)

    Concept 2: Strings and String Manipulation

    A String is a sequence of characters. It is a structured data type because it is built from multiple primitive char types.

    In your exam, you will be expected to know how to manipulate strings using built-in functions. The exact syntax will depend on your exam board's Programming Language Subset (PLS), but the concepts are universal:

    • Length: Finding how many characters are in a string. E.g., len("Hello") is 5.
    • Substring: Extracting a portion of a string. E.g., getting the first three letters.
    • Concatenation: Joining two strings together. E.g., "Hello" + "World" becomes "HelloWorld".
    • Case Conversion: Changing text to upper or lower case. E.g., "abc".upper() becomes "ABC".

    String Manipulation FunctionsOpen full-size image (opens in a new tab)

    Concept 3: Arrays (1D and 2D)

    An Array is a structured data type that allows you to store multiple items of the same data type under a single identifier (variable name).

    Instead of having five variables (score1, score2, score3, etc.), you have one array (scores) and access individual items using an index.

    CRITICAL RULE: In almost all modern programming languages (and GCSE specifications), array indexing is zero-based. This means the first element is at index 0, not index 1.

    • 1D Arrays: Like a single list or row. Accessed with one index: scores[2].
    • 2D Arrays: Like a grid or table with rows and columns. Accessed with two indices: grid[row][column]. A helpful mnemonic is RC Cola (Row, then Column).

    Understanding Array IndexingOpen full-size image (opens in a new tab)

    Concept 4: Records

    While arrays store multiple items of the same data type, a Record stores multiple related items of different data types under one name.

    Think of a record as a row in a database table. A Student record might contain:

    • Name (String)
    • Age (Integer)
    • TargetGrade (Char)
    • IsEnrolled (Boolean)

    This is much more efficient for representing real-world entities than using separate variables or arrays.

    Concept 5: Variables vs Constants

    Both are named memory locations used to store data, but they behave differently:

    • Variable: The value stored can change while the program is running (e.g., a player's score).
    • Constant: The value is set when the program is written and cannot be changed while it is running (e.g., PI = 3.14159 or MAX_LIVES = 3). Using constants makes code easier to update and prevents accidental changes to important values.

    Listen to the Revision Podcast

    Need to recap while on the go? Listen to our comprehensive audio guide covering all these concepts, common mistakes, and a quick-fire quiz.

    Check what you remember

    Read the wording for your board, then hide it and explain Data Type in your own words. Rough notes are fine. This is a self-check, with no mark or grade.

    Reference: Pearson Edexcel

    A classification that dictates what kind of data a variable can hold and what operations can be performed on it.
    Pearson Edexcel

    Interactive Diagrams

    2 interactive diagrams to visualise key concepts

    Conceptual Flow Outline

    Data Types
    ➔Primitive Types
    ➔Structured Types
    Primitive Types
    ➔Integer (Whole numbers)
    ➔Real / Float (Decimals)
    ➔Boolean (True/False)
    ➔Char (Single symbol)
    Structured Types
    ➔String (Text)
    ➔Array (Same types)
    ➔Record (Mixed types)

    Classification of Data Types

    Conceptual Flow Outline

    String: 'Hello'
    ➔Length
    ➔Substring(0,2)
    ➔Upper()
    Length
    ➔5
    Substring(0,2)
    ➔'He'
    Upper()
    ➔'HELLO'

    Common String Manipulation Functions

    Worked Examples

    3 worked examples — open one to explore the question and available guidance.

    Practice Questions

    Try the question, then reveal an answer plan or example response

    Q1

    A programmer needs to store the exact weight of a parcel in kilograms. State the most appropriate data type.

    1 mark
    foundation

    Hint: Weight usually involves fractions of a kilogram, like 2.5kg.

    Q2

    Explain why a String is a more appropriate data type than an Integer for storing a bank account number (e.g., '01234567').

    2 marks
    standard

    Hint: Think about what happens to leading zeros in mathematics.

    Q3

    An array is declared as: colours = ["Red", "Green", "Blue", "Yellow"]. Write a statement to output the word "Blue".

    1 mark
    standard

    Hint: Remember zero-based indexing.

    Q4

    Compare the use of an Array with the use of a Record for storing data.

    4 marks
    challenging

    Hint: Focus on what types of data each structure can hold and how you access that data.

    Q5

    A variable password stores the string "Pa55w0rd". Evaluate the expression: password.length > 8 AND password.substring(0,2) == "Pa"

    3 marks
    challenging

    Hint: Break it down into two parts. Evaluate the length first, then the substring, then apply the AND operator.

    Ready to test yourself interactively?

    Active recall beats reading alone. Answer questions on Data types and structures with instant AI scoring and mark scheme guidance.

    Start interactive practice

    A week of Premium from your first lesson · Then the free plan continues · No card, no charge

    Exam technique

    How to turn what you know into marks

    How to approach the question

    When asked to choose a data type, always ask yourself: 'What operations do I need to perform on this data?' If you need to do maths, it must be an Integer or Real. If you just need to display it, it could be a String.

    How to structure your answer

    For 'State' questions, just give the data type. For 'Explain why' questions, give the data type (1 mark) and the reason based on the data properties (1 mark).

    Timing

    Approximately 1 minute per mark. A 4-mark data types question should take about 4 minutes.

    Common pitfalls

    • Forgetting that array indices start at 0 (zero-based indexing).
    • Confusing the index of an array element with the actual value stored at that index.
    • Suggesting 'Number' or 'Text' as data types. You must use the specific terms: Integer, Real, String, Char.
    • Thinking that a phone number (e.g., '07700 900123') should be an Integer. It should be a String because it contains a space, starts with a leading zero (which maths operations would remove), and you don't do arithmetic on phone numbers.

    What the command words want

    Compare
    Identify similarities and differences. (e.g., 'Both arrays and records store multiple items, BUT arrays store items of the same type whereas records can store items of different types').
    Explain
    Say WHY you chose something. (e.g., 'A String should be used for a phone number BECAUSE it contains spaces and leading zeros').
    Describe
    Set out characteristics. (e.g., 'An array is a data structure that stores multiple items of the same data type under a single identifier').
    Evaluate
    Not commonly used for this specific topic.
    Calculate
    Show your working if asked for array indices or string lengths.
    State/Give
    Provide the specific technical term (e.g., 'Boolean'). No explanation needed.
    Watch or listen (optional)
    🎙 Podcast Episode
    Data types and structures
    0:00-0:00

    Test your understanding of Data types and structures

    Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.

    Take topic quiz

    A week of Premium from your first lesson · Then the free plan continues · No card, no charge

    More Computer Science Study Guides

    View all

    Algorithms

    Pearson Edexcel
    GCSE

    Master the logic behind every computer program. This topic covers how to design, trace, and evaluate algorithms using sequence, selection, and iteration, plus the essential searching and sorting techniques you'll need for your exam.

    Binary

    Pearson Edexcel
    GCSE

    Mastering binary is essential for understanding how computers store and process all data. This topic covers converting between number bases, performing binary arithmetic, understanding shifts, and recognizing overflow — key skills that frequently appear in exams and form the foundation of computer science.

    Constructs

    Pearson Edexcel
    GCSE

    Master the fundamental building blocks of all software: Sequence, Selection, and Iteration. This topic is the core of Computer Science and tests your ability to think like a real programmer, enabling you to read, trace, and write code confidently for the exam.

    Cybersecurity

    Pearson Edexcel
    GCSE

    Master the critical threats to digital systems and the methods used to protect them. This high-yield GCSE Computer Science topic explores malware, social engineering, and the technical defences essential for earning top marks.

    Data

    Pearson Edexcel
    GCSE

    Master the language of computers. This topic covers how binary underpins everything from text and images to sound and data compression, ensuring you can secure crucial calculation marks in your exam.

    Data storage and compression

    Pearson Edexcel
    GCSE

    Master the fundamentals of binary data storage and the critical importance of compression. This topic is calculation-heavy and frequently tested, requiring you to confidently convert between binary units and understand the trade-offs between lossless and lossy compression methods.