AQA · GCSE · Computer Science

    Course version: 8525 · Version from Sept 2020

    Data types: string.

    A string is a sequence of characters treated as one item of data, such as a name, a postcode or a sentence.

    Checked against the AQA 8525 specification (opens in a new tab) on .

    • Point 7 of 7

    Study notes

    From the checked teaching notes for this specification point.

    The idea

    A string is a sequence of characters treated as one item of data, such as a name, a postcode or a sentence. In AQA 8525 you must recognise that a string can hold zero, one or many characters, so 'A' can be a string of length one and 'Hello' is a string of length five. Strings are stored as a series of character codes, and operations such as finding the length or joining strings work on the whole sequence. A useful test is whether the value is made of several symbols in order: if so, it is a string rather than a single character. Remember that a string may include digits and spaces, for example a postcode.

    What earns the marks

    • A string is a sequence of characters treated as a single data item.
    • A string can contain letters, digits, spaces and punctuation.
    • A string may hold zero, one or many characters, so length can vary.
    • Strings are stored as a series of character codes.
    • A string differs from a character because it can hold more than one symbol.

    Common mistakes and how to put them right

    • Believing a string must contain more than one character.

      Put it right by noting a string can hold zero or one character as well as many.

    • Thinking a string can only contain letters.

      Put it right by including digits, spaces and punctuation in a string.

    • Treating a string as a single character code.

      Put it right by explaining a string is stored as a series of character codes.

    Exam tips

    • Count the symbols to confirm a value is a string and state its length.
    • Give a realistic example such as a name or postcode to show a string in use.
    • Contrast a string with a character to make the difference clear.

    Try the lesson

    The start of the Data types: string. lesson, made from checked teaching notes for this specification point.

    Have a go first

    A program stores a learner's full name, such as Sam Patel, in one variable. Which data type is most appropriate?

    There is more to this lesson

    The full lesson goes on to check your understanding and help you earn the marks. Create a free account to carry on, with your progress saved.

    Carry on with the full lesson

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

    Test your understanding of Data types: string.

    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