Logic puzzles for kids: switches, AND and OR
Two switches in a row make an AND; side by side they make an OR. Computers are built from exactly these. Try it:
Two switches and a lamp.
Look at which switches are on and off. Will the lamp light?
How it works
A switch is on (1) or off (0). With two switches in a row, the lamp lights only if the first AND the second are on. Side by side, it lights if one OR the other is on.
Computer chips use tiny switches called gates. An AND gate gives 1 only when both inputs are 1. An OR gate gives 1 when at least one input is 1. A NOT gate flips 1 to 0 and 0 to 1.
A puzzle with the answer
The numbers at the top travel down the wires into the gates. What comes out at the "?"
Answer: 1. NOT flips its input: 1 becomes 0 and 0 becomes 1. OR gives 1 when at least one input is 1. Step by step: the NOT gate takes B = 1 and gives 0; then the OR gate takes A = 1 and the NOT output (0) and gives 1.
Show the working
- Read the numbers at the top: A is 1, B is 1.
- Follow the wires through the gates in order: the NOT gate gets 1, and NOT flips its input: 1 becomes 0 and 0 becomes 1, so it gives 0; then the OR gate gets 1 and 0, and OR gives 1 when at least one input is 1, so it gives 1.
- The last gate sends its number to the ?. Answer: 1.
Questions
What is a logic gate?
A tiny switch circuit that takes 1s and 0s in and gives a 1 or a 0 out, following a simple rule like AND or OR.
Why do computers use 1 and 0?
A wire is either on or off, and two states are easy to build reliably, so everything is stored and worked out with 1s and 0s.