If you have both a membership and a day pass, will the leisure centre let you in?
At a leisure centre, the entry screen says you need a membership or a day pass. You've got both. Would the computer let you in? The answer depends on what the word 'or' means when a computer uses it.
Your program can ask a question like 'Are you a member?' The answer is either true or false. Write true as one and false as zero. A logic gate takes bits like those as inputs and produces one bit as its output.
Follow input A to the triangle. The small circle marks the flip, and the output is Q. You write this rule as NOT A. Now read the truth table: a zero goes in and a one comes out, then a one goes in and a zero comes out.
Your program checks whether a door is open. Open is one. You feed that one into a NOT gate to test whether the door is closed. What bit comes out? Pick an answer.
Each symbol has two wires in and one out. Draw AND with a flat back and a rounded front. For OR, curve the back and bring the front to a point. To draw XOR, add a second curve just behind the back of the OR symbol.
List every pair: zero zero, zero one, one zero, one one. Read down the AND column: only the last row gives one. OR gives one whenever at least one input is one. XOR gives one when exactly one input is one, so its last row is zero.
The pool shows a notice if the session is full and the waiting list is open, or if the pool is closed. Call those inputs F, W and C. For each F and W pair, do AND first. Then try C as zero, then one, to get two OR outputs.
Try the pool's rule yourself. The session is full, the waiting list is shut and the pool is closed. Work out the bracket first, then use that result with C. What do the two gates output, in order? Pick an answer.
Back at the entrance, both inputs are one. OR lets you through because at least one input is one. XOR would turn you away because it needs exactly one input to be one. The mistake to watch for is treating ordinary OR as if it meant exactly one.
Write a Boolean expression for Q. Trace the circuit: F and W enter AND, then its output and C enter OR. Put F AND W in brackets. If you're asked to make Q true when exactly one of the final gate's inputs is true, replace that OR gate with XOR.