Logic gates are electronic components that apply Boolean rules to binary inputs and produce a binary output. The seven gates differ in the input conditions that produce output (true) or (false).
How Each Logic Gate Works
A truth table lists every possible input combination and the resulting output. Most gates take two inputs, conventionally labelled A and B; NOT takes only one input.
| Gate | Output is when... |
|---|---|
| AND | Both inputs are . |
| OR | At least one input is . |
| NOT | The input is inverted: becomes , and becomes . |
| NAND | It is not the case that both inputs are . It is the inverse of AND. |
| NOR | Neither input is . It is the inverse of OR. |
| XOR | Exactly one input is ; the inputs must differ. |
| XNOR | Both inputs are the same. It is the inverse of XOR. |
NAND and NOR are known as universal gates because circuits made only from NAND gates, or only from NOR gates, can reproduce every other Boolean operation. Logic gates are combined to form larger circuits. For example, a half-adder uses XOR to produce a sum bit and AND to produce a carry bit. An inversion circle on a circuit symbol means that the associated input or output is negated, which helps identify NAND, NOR, and NOT operations.
The complete two-input truth table is:
| A | B | AND | OR | NAND | NOR | XOR | XNOR |
|---|---|---|---|---|---|---|---|
A common misconception is that XOR means “one or both.” XOR means exactly one, whereas OR includes the case where both inputs are .
IB Exam Technique
For A1.2 Data representation and computer logic, be prepared to complete truth tables and evaluate multi-gate circuits. Work through a circuit one gate at a time, record each intermediate output, and apply NOT operations carefully. Check that a two-input truth table contains all four possible input combinations.