Skip to content
← Back to glossary

XOR

Learn in the textbookSets and Logical Operations

DefinitionXOR (exclusive OR, 排他的論理和) is an operation whose output is 1 only when the two inputs differ.

ExplanationWhether both inputs are 0 or both are 1, matching values give an output of 0. Applying XOR twice with the same value restores the original, and XOR is also used for purposes such as error detection.

AnalogyThe wiring of a stair light with one switch at the top and one at the bottom. Flipping either switch toggles the light on or off.

Memory hook"Exclusive" means shutting the other out: it accepts "only one" and excludes the case where both hold.

Related past-exam questions(2 questions)