AQA · GCSE · Computer Science

    Course version: 8525 · Version from Sept 2020

    Data types: integer

    An integer is a whole number with no fractional or decimal part, and it may be positive, negative or zero.

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

    • Point 3 of 7

    Study notes

    From the checked teaching notes for this specification point.

    The idea

    An integer is a whole number with no fractional or decimal part, and it may be positive, negative or zero. Examples include 7, -42 and 0, while 3.5 and 0.25 are not integers because they have a fractional part. In programming, an integer data type stores whole-number values, and it is one of the general data types named in section 3.2.1. When answering a multiple-choice question, check whether the value has any decimal or fractional component: if it does not, it is a whole number and so an integer. Remember that negative whole numbers such as -8 are still integers, and zero is an integer too. Distinguish integers from real numbers, which can hold fractional values, and from strings, which hold text.

    What earns the marks

    • An integer is a whole number with no fractional or decimal part.
    • Integers can be positive, negative or zero, for example 7, -42 and 0.
    • A value such as 3.5 is not an integer because it has a fractional part; it is a real number.
    • The integer data type stores whole-number values and is one of the general data types in section 3.2.1.

    Common mistakes and how to put them right

    • Believing integers must be positive.

      Put it right: Negative whole numbers such as -42 are also integers.

    • Classifying a decimal such as 3.5 as an integer.

      Put it right: A value with a fractional part is a real number, not an integer.

    • Forgetting that zero is an integer.

      Put it right: 0 is a whole number and therefore an integer.

    Exam tips

    • Check for a decimal point or fractional part first: no fraction means the value is a whole number and so an integer.
    • Remember that both negative whole numbers and zero count as integers when selecting an option.
    • Eliminate options that describe text or fractional values before choosing the whole-number answer.

    Try the lesson

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

    Have a go first

    Which of these values is stored as an integer data type?

    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: integer

    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