OCR · GCSE · Computer Science

    Course version: J277 · Version from Sept 2022

    Programming fundamentals: The common arithmetic operators

    Arithmetic operators allow a program to perform mathematical calculations with numeric values.

    Checked against the OCR J277 specification on .

    • Point 3 of 4
    • 2 key terms

    Study notes

    From the checked teaching notes for this specification point.

    The idea

    Arithmetic operators allow a program to perform mathematical calculations with numeric values. Addition, subtraction, multiplication and real division perform the familiar operations. Integer division (DIV) returns only the whole-number quotient, while modulus (MOD) returns the remainder. Exponentiation raises one value to a power. The exact symbols vary between languages, so exam questions often use OCR Reference Language. Apply standard precedence rules (BODMAS or BIDMAS): brackets first, then exponentiation, then division and multiplication, and finally addition and subtraction. Work through one operation at a time and track the data type of each result, noting that real division always produces a Real value.

    What earns the marks

    • Identify and apply addition, subtraction, multiplication and real division to numeric data types.
    • Explain that integer division (DIV) produces the whole-number quotient, for example, 10 DIV 3 equals 3.
    • Explain that modulus (MOD) produces the remainder of a division, for example, 10 MOD 3 equals 1.
    • Apply brackets and the stated order of operations (BODMAS or BIDMAS) when evaluating a compound arithmetic expression.
    • Calculate the result of exponentiation, which raises a base value to a stated power, distinguishing it from multiplication.
    • State that real division produces a Real value, whereas integer division (DIV) produces an integer quotient.

    Common mistakes and how to put them right

    • Treating modulus (MOD) as ordinary division.

      Put it right: Modulus returns the remainder after integer division, so 7 MOD 2 is 1, not 3.5.

    • Evaluating a compound expression strictly from left to right.

      Put it right: Apply standard operator precedence (BODMAS or BIDMAS) and evaluate brackets first.

    • Confusing integer division (DIV) with real division.

      Put it right: Integer division truncates the decimal part, so 5 DIV 2 is 2, whereas real division of 5 by 2 is 2.5.

    • Using the term 'float' instead of 'Real'.

      Put it right: OCR J277 uses 'Real' for this data type, so use 'Real' in answers.

    Exam tips

    • Annotate the order in which operations will be evaluated above the expression before calculating the final result.
    • For integer division and modulus questions, write out the full division with a remainder (e.g., 13 divided by 5 is 2 remainder 3) before selecting the requested DIV or MOD value.

    Try the lesson

    The start of the Programming fundamentals: The common arithmetic operators lesson, made from checked teaching notes for this specification point.

    Have a go first

    In a program, which operator is used to find the remainder after one whole number is divided by another?

    Listen

    Arithmetic operators allow a program to perform mathematical calculations with numeric values. Addition, subtraction, multiplication and real division perform the familiar operations. Integer division (DIV) returns only the whole-number quotient, while modulus (MOD) returns the remainder. Exponentiation raises one value to a power. The exact symbols vary between languages, so exam questions often use OCR Reference Language. Apply standard precedence rules (BODMAS or BIDMAS): brackets first, then exponentiation, then division and multiplication, and finally addition and subtraction. Work through one operation at a time and track the data type of each result, noting that real division always produces a Real value. A strong answer earns marks for these points. Identify and apply addition, subtraction, multiplication and real division to numeric data types. Explain that integer division (DIV) produces the whole-number quotient, for example, 10 DIV 3 equals 3. Explain that modulus (MOD) produces the remainder of a division, for example, 10 MOD 3 equals 1. Apply brackets and the stated order of operations (BODMAS or BIDMAS) when evaluating a compound arithmetic expression. A common slip: Treating modulus (MOD) as ordinary division. Instead, modulus returns the remainder after integer division, so 7 MOD 2 is 1, not 3.5. Exam tip: Annotate the order in which operations will be evaluated above the expression before calculating the final result.

    See it

    A top-down flowchart. It begins at a node labelled Start with expression, which leads to Brackets first, then Exponentiation, then Division and multiplication, then Addition and subtraction, then Track data type of each result. From that final tracking node, three branches lead out: Real division gives a Real value, Integer division (DIV) gives whole-number quotient, and Modulus (MOD) gives the remainder.
    Shows the order of operations for evaluating an arithmetic expression and the three division-related outcomes to track.

    Key words

    Say what each word means before you turn the card.

    operator precedence

    Try answering aloud or in your head before turning the card.

    integer division and modulus

    Try answering aloud or in your head before turning the card.

    See every definition
    operator precedence
    Standard rules, given as BODMAS or BIDMAS, applied in order: brackets first, then exponentiation, then division and multiplication, and finally addition and subtraction.
    integer division and modulus
    Integer division (DIV) returns only the whole-number quotient, while modulus (MOD) returns the remainder.

    Label the diagram

    Some boxes have lost their names. Pick the right name for each number.

    The diagram again, with 3 boxes numbered instead of named. A top-down flowchart. It begins at a node labelled Start with expression, which leads to Brackets first, then Exponentiation, then Division and multiplication, then Addition and subtraction, then Track data type of each result. From that final tracking node, three branches lead out: Real division gives a Real value, Integer division (DIV) gives whole-number quotient, and Modulus (MOD) gives the remainder.
    • 1Box 1

    • 2Box 2

    • 3Box 3

    0 of 3 labelled

    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 Programming fundamentals: The common arithmetic operators

    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