Skip to content
Tactiverge
  1. Stage 1
  2. Stage 2 (this one)
  3. Stage 3
  4. Stage 4
  5. Stage 5
  6. Stage 6
  7. Stage 7
  8. Stage 8
  9. Stage 9
  10. Stage 10
  11. Stage 11
  12. Stage 12
  13. Stage 13
  14. Stage 14
  15. Stage 15

Explanation

A logic gate takes one or two bits in and gives one bit out by a fixed rule. AND gives 1 only if both inputs are 1. OR gives 1 if either is. NOT flips its input. XOR gives 1 when the inputs differ.

In a real chip each gate is a handful of transistors acting as switches. Here gates are ideal: they switch instantly and every wire is exactly 0 or 1. NAND (NOT-AND) is special: any other gate, and so any computer, can be built from NAND gates alone.

Pick a gate, flip its inputs

AB
AND
Y0
Truth table for AND
ABY
000
010
100
111

Check yourself

Marked instantly in your browser. Use the interactive above to work it out.

  1. 1. What does XOR output when both inputs are 1?
  2. 2. Which gate gives 0 only when every input is 1?