{"base":{"id":"alphys-9-06","subject":"Physics","title":"Logic gates and truth tables","slug":"logic-gates","scene":"mix3","steps":[{"use":"alphys","mode":"logic","gate":"and","actions":[{"id":"a","label":"Input A"},{"id":"b","label":"Input B"}],"eyebrow":"Digital signals","title":"AND gate","body":"Digital circuits use two levels: 1 (high) and 0 (low). A logic gate gives an output that depends on its inputs according to a rule. AND gives 1 only when A and B are both 1: Q = A·B. Tap A and B."},{"use":"alphys","mode":"logic","gate":"or","actions":[{"id":"a","label":"Input A"},{"id":"b","label":"Input B"}],"eyebrow":"OR and NOT","title":"Either, or the opposite","body":"OR gives 1 when at least one input is 1: Q = A + B. NOT (inverter) has one input and gives the opposite: Q = Ā. These three are the basic gates."},{"use":"alphys","mode":"logic","gate":"nand","actions":[{"id":"a","label":"Input A"},{"id":"b","label":"Input B"}],"eyebrow":"NAND and NOR","title":"Universal gates","body":"NAND = NOT AND and NOR = NOT OR, shown by a small circle at the output. Any logic circuit can be built from NAND gates alone (or NOR gates alone), which makes them cheap building blocks."},{"use":"alphys","mode":"logic","gate":"xor","actions":[{"id":"a","label":"Input A"},{"id":"b","label":"Input B"}],"eyebrow":"XOR and XNOR","title":"Different or same","body":"Exclusive-OR gives 1 when the inputs are different: Q = A ⊕ B = A·B̄ + Ā·B. XNOR gives 1 when they are the same. XOR is used to add binary digits."},{"mode":"quiz","use":"alphys","look":"logic","gate":"nand","eyebrow":"Check yourself","title":"Logic gates","body":"Check the truth table.","question":"Which gate gives 0 only when both inputs are 1?","options":["NOR","NAND","AND"],"answer":1,"right":"Right.","wrong":"NOT of AND."}],"more":[{"type":"cards","id":"detail","eyebrow":"The ideas in detail","title":"Logic gates in detail","items":[{"tag":"Algebra","title":"Boolean expressions","body":"Write · for AND, + for OR and a bar for NOT. Useful rules: A·1 = A, A + 0 = A, A·Ā = 0, A + Ā = 1, and De Morgan's laws (A·B)‾ = Ā + B̄, (A + B)‾ = Ā·B̄."},{"tag":"Tables","title":"Truth tables","body":"A gate with n inputs has 2ⁿ rows. List inputs in binary order (00, 01, 10, 11) and work out the output for each."},{"tag":"Practical","title":"Investigating gates","body":"Use a logic IC with switches on the inputs and an LED (with resistor) on the output to confirm each truth table."}]},{"type":"cards","id":"ideas","eyebrow":"Popular idea vs physics","title":"Common mix-ups","items":[{"tag":"Popular idea","title":"OR means one or the other but not both","body":"That is XOR; OR is also 1 when both inputs are 1."},{"tag":"Popular idea","title":"A NAND gate is an AND gate with an inverted input","body":"The output is inverted, not the input."}]},{"type":"quiz","id":"quiz","eyebrow":"Go further","title":"Thirty questions: easy, medium, hard","questions":[{"level":"easy","question":"An AND gate gives 1 when…","options":["any input is 1","all inputs are 1","all inputs are 0"],"answer":1,"right":"Correct.","wrong":"Look at the idea again."},{"level":"easy","question":"An OR gate gives 1 when…","options":["both inputs are 0","only both are 1","at least one input is 1"],"answer":2,"right":"Correct.","wrong":"Look at the idea again."},{"level":"easy","question":"A NOT gate…","options":["adds inputs","stores data","inverts its input"],"answer":2,"right":"Correct.","wrong":"Look at the idea again."},{"level":"easy","question":"A NAND gate is…","options":["AND followed by NOT","OR followed by NOT","NOT followed by AND"],"answer":0,"right":"Correct.","wrong":"Look at the idea again."},{"level":"easy","question":"A NOR gate gives 1 only when…","options":["all inputs are 1","all inputs are 0","one input is 1"],"answer":1,"right":"Correct.","wrong":"Look at the idea again."},{"level":"easy","question":"XOR gives 1 when…","options":["the inputs are different","the inputs are the same","both are 1"],"answer":0,"right":"Correct.","wrong":"Look at the idea again."},{"level":"easy","question":"A truth table lists…","options":["outputs for every combination of inputs","only one input","the gate's cost"],"answer":0,"right":"Correct.","wrong":"Look at the idea again."},{"level":"easy","question":"A 2-input gate has how many rows in its truth table?","options":["2","4","8"],"answer":1,"right":"Correct: 2².","wrong":"Look at the idea again."},{"level":"easy","question":"Boolean A·B means…","options":["A AND B","A OR B","NOT A"],"answer":0,"right":"Correct.","wrong":"Look at the idea again."},{"level":"easy","question":"Boolean A + B means…","options":["A AND B","A XOR B","A OR B"],"answer":2,"right":"Correct.","wrong":"Look at the idea again."},{"level":"medium","question":"NAND with inputs A = 1, B = 1:","options":["1","0","undefined"],"answer":1,"right":"Correct.","wrong":"Look at the idea again."},{"level":"medium","question":"NOR with A = 0, B = 1:","options":["0","1","undefined"],"answer":0,"right":"Correct.","wrong":"Look at the idea again."},{"level":"medium","question":"A NAND gate with both inputs joined acts as…","options":["AND","OR","NOT"],"answer":2,"right":"Correct.","wrong":"Look at the idea again."},{"level":"medium","question":"NAND and NOR are called universal gates because…","options":["they are cheapest","they have 3 inputs","any logic function can be built from either alone"],"answer":2,"right":"Correct.","wrong":"Look at the idea again."},{"level":"medium","question":"De Morgan: NOT(A·B) = …","options":["Ā·B̄","Ā + B̄","A + B"],"answer":1,"right":"Correct.","wrong":"Look at the idea again."},{"level":"medium","question":"De Morgan: NOT(A + B) = …","options":["Ā + B̄","Ā·B̄","A·B"],"answer":1,"right":"Correct.","wrong":"Look at the idea again."},{"level":"medium","question":"A 3-input gate truth table has…","options":["8 rows","6 rows","3 rows"],"answer":0,"right":"Correct.","wrong":"Look at the idea again."},{"level":"medium","question":"A car alarm sounds if a door is open (D = 1) AND the alarm is set (S = 1). Gate:","options":["AND","OR","NOR"],"answer":0,"right":"Correct.","wrong":"Look at the idea again."},{"level":"medium","question":"A light turns on if either of two switches is pressed. Gate:","options":["AND","NAND","OR"],"answer":2,"right":"Correct.","wrong":"Look at the idea again."},{"level":"medium","question":"In logic circuits, \"1\" usually means…","options":["high voltage (e.g. 5 V)","0 V","negative voltage"],"answer":0,"right":"Correct.","wrong":"Look at the idea again."},{"level":"hard","question":"How many NAND gates make an OR gate?","options":["2","3","4"],"answer":1,"right":"Correct: invert each input, then NAND.","wrong":"De Morgan."},{"level":"hard","question":"How many NAND gates make an AND gate?","options":["1","2","3"],"answer":1,"right":"Correct: NAND then NOT (NAND).","wrong":"Look at the idea again."},{"level":"hard","question":"Output of (A + B)·C̄ for A = 0, B = 1, C = 0:","options":["0","undefined","1"],"answer":2,"right":"Correct: 1 · 1.","wrong":"Look at the idea again."},{"level":"hard","question":"Simplify A + A·B:","options":["B","A·B","A"],"answer":2,"right":"Correct: absorption.","wrong":"Look at the idea again."},{"level":"hard","question":"XOR can be written as…","options":["A·B̄ + Ā·B","A·B + Ā·B̄","A + B"],"answer":0,"right":"Correct.","wrong":"The second option is XNOR."},{"level":"hard","question":"A half adder's sum and carry outputs come from…","options":["OR and NOT","NAND and NOR","XOR and AND"],"answer":2,"right":"Correct.","wrong":"Look at the idea again."},{"level":"hard","question":"Adding binary 1 + 1 with a half adder gives…","options":["sum 1, carry 0","sum 1, carry 1","sum 0, carry 1"],"answer":2,"right":"Correct: 10₂ = 2.","wrong":"Look at the idea again."},{"level":"hard","question":"A greenhouse fan runs if it is hot (H = 1) OR humid (W = 1), but NOT at night (N = 1). Expression:","options":["H·W·N","(H + W)·N̄","(H + W) + N"],"answer":1,"right":"Correct.","wrong":"Look at the idea again."},{"level":"hard","question":"A gate outputs 0 only when both inputs are 1. It is…","options":["NAND","NOR","XOR"],"answer":0,"right":"Correct.","wrong":"Look at the idea again."},{"level":"hard","question":"Two NOT gates in series give…","options":["the original signal (buffer)","its inverse","always 0"],"answer":0,"right":"Correct.","wrong":"Look at the idea again."}]},{"type":"keywords","id":"words","title":"Key words","items":[{"word":"Logic gate","meaning":"Circuit giving a digital output from digital inputs"},{"word":"Truth table","meaning":"List of outputs for every combination of inputs"},{"word":"Boolean expression","meaning":"Algebraic form of a logic function"},{"word":"Universal gate","meaning":"NAND or NOR, from which any circuit can be made"}]},{"type":"checklist","id":"check","title":"I can…","items":["draw the symbols and truth tables of the seven gates","write Boolean expressions for gates","explain why NAND and NOR are universal"]},{"type":"sources","id":"sources","title":"Sources","items":["NIE Sri Lanka, G.C.E. (A/L) Physics syllabus, implemented from 2017 (competency level 9.4).","HyperPhysics (Georgia State University): Logic gates.","NIE G.C.E. (A/L) Physics practical guidance and teachers' guide (scope of the practicals only; no text copied)."]}]},"overlay":null}