AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Logic gates and decisions

Week 25 · Unit 7.5: Living with AI · 3 lessons
1

Gates make decisions

Computing 7: Unit 7.5, pp. 150–181
GoalExplain what a logic gate is and use an AND gate and its truth table.
New words
logic gate · a tiny part of a circuit that takes one or two inputs and gives one outputBoolean value · a value that is only true or false, written as 1 or 0truth table · a table that lists every possible input and the output for eachAND gate · a gate whose output is 1 only when both of its inputs are 1
Explanation

Digital devices make decisions with logic gates. Electricity is either on or off, so it is perfect for binary: on is 1 (true) and off is 0 (false). A logic gate takes one or two inputs and gives one output. Inputs are often named A and B, and the output Z. The gate type decides the output. An AND gate gives 1 only when input A and input B are both 1. In every other case it gives 0. A truth table lists all the input patterns and the output for each. Logic gates are found in lifts, washing machines, traffic lights and phone chargers.

ABA and B
111
100
010
000
Worked examples
A: pitch dry?B: ten players?Z: match on?Meaning
000wet and too few: no match
010wet: no match
100too few players: no match
111dry and enough players: match on
A school football match goes ahead only if the pitch is dry (A) AND at least ten players have come (B). Write 1 for yes and 0 for no. The match is only on when both are yes.
A gate is drawn as a box with the inputs on the left and the output on the right. The real symbol is a special shape for each gate, but a labelled box works for planning.
A: break timeB: switch onZ: bell rings
100
111
A school bell rings only if the clock says break time (A) AND the bell switch is on (B). With A = 1 and B = 0 the output is 0, so the bell stays quiet, even though it is break time.
Class activity

Gate game (no computer): make two cards, A and B, with 1 on one side and 0 on the other. Write the rule ‘Z = 1 only if A = 1 and B = 1’. Your partner turns the cards in secret, shows them and you call the output of an AND gate. Do eight rounds and write the results in a truth table. Then think of a real decision that needs two things, such as ‘I can go cycling if the bike is ready AND an adult is with me’. Write it as A, B and Z. If you have a computer or tablet, an adult can help you check your truth table with a spreadsheet.

Practice
1
Cover the table at the top of the lesson. Now complete the truth table for an AND gate from memory.
ABZ
00?
01?
10?
11?
2
A greenhouse door unlocks if the code is right (A) AND the card is valid (B). A = 1 and B = 0. Is the door unlocked? Explain.
3
Write one decision of your own that works like an AND gate. Name A, B and Z.
4
True or false: an AND gate gives 1 when at least one input is 1. Explain.