AQA · GCSE · Computer Science

    Course version: 8525 · Version from Sept 2020

    Boolean logic: XOR.

    XOR (exclusive OR) is a two-input logic operation whose output is 1 only when the inputs differ.

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

    • Point 5 of 16

    Study notes

    From the checked teaching notes for this specification point.

    The idea

    XOR (exclusive OR) is a two-input logic operation whose output is 1 only when the inputs differ. With inputs A and B, the output is 1 for A=0, B=1 and for A=1, B=0; it is 0 for A=0, B=0 and for A=1, B=1. A reliable method is to write the four input combinations in order (00, 01, 10, 11) and test each: count the number of 1s; XOR gives 1 when that count is exactly one, whereas OR gives 1 whenever at least one input is 1. So OR and XOR agree except for the 11 row, where OR gives 1 and XOR gives 0. The Boolean expression is A XOR B, sometimes written with the symbol ⊕. Recognise the gate's distinctive shape and be able to state its output for any given pair of inputs.

    What earns the marks

    • XOR outputs 1 only when exactly one input is 1 (the inputs differ).
    • For inputs 0 and 0 the XOR output is 0.
    • For inputs 0 and 1 the XOR output is 1.
    • For inputs 1 and 0 the XOR output is 1.
    • For inputs 1 and 1 the XOR output is 0, which distinguishes XOR from OR.
    • XOR can be expressed as A XOR B (or A ⊕ B).

    Common mistakes and how to put them right

    • Confusing XOR with OR: the learner says 1 XOR 1 gives 1. Correction: XOR gives 0 when both inputs are 1 because the inputs do not differ.

    • Treating XOR as AND: the learner says 0 XOR 1 gives 0. Correction: XOR gives 1 whenever exactly one input is 1, so 0 XOR 1 gives 1.

    • Assuming XOR needs more than two inputs.

      Put it right: Apply the two-input rule to A and B directly.

    • Reading the gate symbol wrongly.

      Put it right: The XOR symbol has an extra curved line before the OR shape.

    Exam tips

    • Write out the four input pairs 00, 01, 10, 11 and evaluate each before choosing an option.
    • Use the test 'do the inputs differ?' to decide XOR output quickly.
    • Check the 11 row specifically, since that is where XOR and OR differ.

    Try the lesson

    The start of the Boolean logic: XOR. lesson, made from checked teaching notes for this specification point.

    Have a go first

    A two-input XOR gate receives the inputs A = 1 and B = 1. What is the output Q?

    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 Boolean logic: XOR.

    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