{"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":{"title":"තාර්කික ද්වාර සහ සත්‍යතා වගු","steps":[{"actions":[{"label":"ප්‍රදානය A"},{"label":"ප්‍රදානය B"}],"eyebrow":"ඩිජිටල් සංඥා","title":"AND ද්වාරය","body":"ඩිජිටල් පරිපථ මට්ටම් දෙකක් පාවිච්චි කරනවා: 1 (ඉහළ) සහ 0 (පහළ). තාර්කික ද්වාරයක් නීතියකට අනුව එහි ප්‍රදාන මත රඳා පවතින ප්‍රතිදානයක් දෙනවා. A සහ B දෙකම 1 නම් විතරයි AND 1 දෙන්නේ: Q = A·B. A සහ B ඔබන්න."},{"actions":[{"label":"ප්‍රදානය A"},{"label":"ප්‍රදානය B"}],"eyebrow":"OR සහ NOT","title":"ඕනෑම එකක්, නැත්නම් ප්‍රතිවිරුද්ධය","body":"අඩුම තරමින් එක් ප්‍රදානයක් 1 නම් OR 1 දෙනවා: Q = A + B. NOT (ප්‍රතිලෝමක) එක් ප්‍රදානයක් සහිතව ප්‍රතිවිරුද්ධය දෙනවා: Q = Ā. මේ තුන මූලික ද්වාර."},{"actions":[{"label":"ප්‍රදානය A"},{"label":"ප්‍රදානය B"}],"eyebrow":"NAND සහ NOR","title":"විශ්ව ද්වාර","body":"NAND = NOT AND සහ NOR = NOT OR, ප්‍රතිදානයේ කුඩා කවයකින් පෙන්වනවා. ඕනෑම තාර්කික පරිපථයක් NAND ද්වාරවලින් පමණක් (හෝ NOR ද්වාරවලින් පමණක්) හදන්න පුළුවන්, ඒ නිසා ඒවා ලාභ ගොඩනැගිලි කොටස්."},{"actions":[{"label":"ප්‍රදානය A"},{"label":"ප්‍රදානය B"}],"eyebrow":"XOR සහ XNOR","title":"වෙනස් හෝ සමාන","body":"Exclusive-OR ප්‍රදාන වෙනස් විට 1 දෙනවා: Q = A ⊕ B = A·B̄ + Ā·B. XNOR සමාන විට 1 දෙනවා. ද්වීමය ඉලක්කම් එකතු කිරීමට XOR පාවිච්චි කරනවා."},{"eyebrow":"ඔයාම බලන්න","title":"තාර්කික ද්වාර","body":"සත්‍යතා වගුව බලන්න.","question":"ප්‍රදාන දෙකම 1 විට පමණක් 0 දෙන ද්වාරය කුමක්ද?","options":["NOR","NAND","AND"],"right":"හරි.","wrong":"AND හි NOT."}],"more":[{"eyebrow":"විස්තර","title":"තාර්කික ද්වාර විස්තරාත්මකව","items":[{"tag":"වීජ ගණිතය","title":"බූලීය ප්‍රකාශන","body":"AND සඳහා ·, OR සඳහා + සහ NOT සඳහා තීරුවක් ලියන්න. ප්‍රයෝජනවත් නීති: A·1 = A, A + 0 = A, A·Ā = 0, A + Ā = 1, සහ ඩි මෝගන් නියම (A·B)‾ = Ā + B̄, (A + B)‾ = Ā·B̄."},{"tag":"වගු","title":"සත්‍යතා වගු","body":"ප්‍රදාන n ඇති ද්වාරයකට පේළි 2ⁿ. ප්‍රදාන ද්වීමය පිළිවෙළින් (00, 01, 10, 11) ලැයිස්තු කර එක් එක් එකට ප්‍රතිදානය සොයන්න."},{"tag":"ප්‍රායෝගිකය","title":"ද්වාර පරීක්ෂා කිරීම","body":"එක් එක් සත්‍යතා වගුව තහවුරු කිරීමට ප්‍රදානවල ස්විච සහ ප්‍රතිදානයේ LED එකක් (ප්‍රතිරෝධකයක් සමඟ) ඇති තාර්කික IC එකක් පාවිච්චි කරන්න."}]},{"eyebrow":"ජනප්‍රිය අදහස සහ භෞතික විද්‍යාව","title":"නිතර පටලැවෙන දේවල්","items":[{"tag":"ජනප්‍රිය අදහස","title":"OR කියන්නේ එකක් හෝ අනික, දෙකම නෙවෙයි","body":"ඒක XOR; ප්‍රදාන දෙකම 1 විටත් OR 1."},{"tag":"ජනප්‍රිය අදහස","title":"NAND ද්වාරයක් කියන්නේ ප්‍රතිලෝම ප්‍රදානයක් ඇති AND ද්වාරයක්","body":"ප්‍රතිලෝම වෙන්නේ ප්‍රතිදානය, ප්‍රදානය නෙවෙයි."}]},{"eyebrow":"තව ඉස්සරහට","title":"ප්‍රශ්න 30ක්: පහසු, මධ්‍යම, අමාරු","questions":[{"question":"AND ද්වාරයක් 1 දෙන්නේ…","options":["ඕනෑම ප්‍රදානයක් 1 විට","සියලු ප්‍රදාන 1 විට","සියලු ප්‍රදාන 0 විට"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"OR ද්වාරයක් 1 දෙන්නේ…","options":["ප්‍රදාන දෙකම 0 විට","දෙකම 1 විට පමණක්","අවම වශයෙන් එක් ප්‍රදානයක් 1 විට"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"NOT ද්වාරයක්…","options":["ප්‍රදාන එකතු කරයි","දත්ත ගබඩා කරයි","එහි ප්‍රදානය ප්‍රතිලෝම කරයි"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"NAND ද්වාරයක්…","options":["AND පසුව NOT","OR පසුව NOT","NOT පසුව AND"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"NOR ද්වාරයක් 1 දෙන්නේ…","options":["සියලු ප්‍රදාන 1 විට","සියලු ප්‍රදාන 0 විට පමණක්","එක් ප්‍රදානයක් 1 විට"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"XOR, 1 දෙන්නේ…","options":["ප්‍රදාන වෙනස් විට","ප්‍රදාන සමාන විට","දෙකම 1 විට"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"සත්‍යතා වගුවක් ලැයිස්තුගත කරන්නේ…","options":["ප්‍රදානවල හැම සංයෝජනයකටම ප්‍රතිදාන","එක් ප්‍රදානයක් පමණක්","ද්වාරයේ පිරිවැය"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"ප්‍රදාන 2 ද්වාරයක සත්‍යතා වගුවේ පේළි කීයද?","options":["2","4","8"],"right":"හරි: 2².","wrong":"අදහස ආයෙත් බලන්න."},{"question":"බූලියානු A·B කියන්නේ…","options":["A AND B","A OR B","NOT A"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"බූලියානු A + B කියන්නේ…","options":["A AND B","A XOR B","A OR B"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"ප්‍රදාන A = 1, B = 1 සමඟ NAND:","options":["1","0","undefined"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"A = 0, B = 1 සමඟ NOR:","options":["0","1","undefined"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"ප්‍රදාන දෙකම සම්බන්ධ කළ NAND ද්වාරයක් ක්‍රියා කරන්නේ…","options":["AND ලෙස","OR ලෙස","NOT ලෙස"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"NAND සහ NOR විශ්ව ද්වාර ලෙස හඳුන්වන්නේ…","options":["ඒවා ලාභම නිසා","ඒවාට ප්‍රදාන 3 ක් ඇති නිසා","ඕනෑම තාර්කික ශ්‍රිතයක් එකකින් පමණක් ගොඩනැගිය හැකි නිසා"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"ඩි මෝගන්: NOT(A·B) = …","options":["Ā·B̄","Ā + B̄","A + B"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"ඩි මෝගන්: NOT(A + B) = …","options":["Ā + B̄","Ā·B̄","A·B"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"ප්‍රදාන 3 ද්වාර සත්‍යතා වගුවකට ඇත්තේ…","options":["පේළි 8","පේළි 6","පේළි 3"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"දොරක් විවෘත (D = 1) සහ අනතුරු ඇඟවීම සකසා ඇති (S = 1) නම් රථ අනතුරු ඇඟවීමක් නාද වේ. ද්වාරය:","options":["AND","OR","NOR"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"ස්විච දෙකෙන් එකක් එබූ විට ආලෝකයක් දැල්වේ. ද්වාරය:","options":["AND","NAND","OR"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"තාර්කික පරිපථවල \"1\" සාමාන්‍යයෙන් කියන්නේ…","options":["ඉහළ වෝල්ටීයතාව (උදා: 5 V)","0 V","ඍණ වෝල්ටීයතාව"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"OR ද්වාරයක් සෑදීමට NAND ද්වාර කීයක් ඕනේද?","options":["2","3","4"],"right":"හරි: එක් එක් ප්‍රදානය ප්‍රතිලෝම කර NAND කරන්න.","wrong":"ඩි මෝගන්."},{"question":"AND ද්වාරයක් සෑදීමට NAND ද්වාර කීයක් ඕනේද?","options":["1","2","3"],"right":"හරි: NAND පසුව NOT (NAND).","wrong":"අදහස ආයෙත් බලන්න."},{"question":"A = 0, B = 1, C = 0 සඳහා (A + B)·C̄ හි ප්‍රතිදානය:","options":["0","undefined","1"],"right":"හරි: 1 · 1.","wrong":"අදහස ආයෙත් බලන්න."},{"question":"A + A·B සරල කරන්න:","options":["B","A·B","A"],"right":"හරි: අවශෝෂණය.","wrong":"අදහස ආයෙත් බලන්න."},{"question":"XOR ලිවිය හැක්කේ…","options":["A·B̄ + Ā·B","A·B + Ā·B̄","A + B"],"right":"හරි!","wrong":"දෙවන විකල්පය XNOR."},{"question":"අර්ධ ආකලකයක එකතුව සහ රැගෙන යාම ප්‍රතිදාන එන්නේ…","options":["OR සහ NOT වලින්","NAND සහ NOR වලින්","XOR සහ AND වලින්"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"අර්ධ ආකලකයකින් ද්විමය 1 + 1 එකතු කිරීම දෙන්නේ…","options":["එකතුව 1, රැගෙන යාම 0","එකතුව 1, රැගෙන යාම 1","එකතුව 0, රැගෙන යාම 1"],"right":"හරි: 10₂ = 2.","wrong":"අදහස ආයෙත් බලන්න."},{"question":"හරිතාගාර පංකාවක් උණු (H = 1) හෝ ආර්ද්‍ර (W = 1) නම් ධාවනය වේ, නමුත් රාත්‍රියේ (N = 1) නොවේ. ප්‍රකාශනය:","options":["H·W·N","(H + W)·N̄","(H + W) + N"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"ද්වාරයක් ප්‍රදාන දෙකම 1 විට පමණක් 0 ප්‍රතිදානය කරයි. එය…","options":["NAND","NOR","XOR"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."},{"question":"ශ්‍රේණිගත NOT ද්වාර දෙකක් දෙන්නේ…","options":["මුල් සංඥාව (බෆරය)","එහි ප්‍රතිලෝමය","හැම විටම 0"],"right":"හරි!","wrong":"අදහස ආයෙත් බලන්න."}]},{"title":"ප්‍රධාන වචන","items":[{"word":"තාර්කික ද්වාරය","meaning":"ඩිජිටල් ප්‍රදානවලින් ඩිජිටල් ප්‍රතිදානයක් දෙන පරිපථය"},{"word":"සත්‍යතා වගුව","meaning":"හැම ප්‍රදාන සංයෝජනයකටම ප්‍රතිදාන ලැයිස්තුව"},{"word":"බූලීය ප්‍රකාශනය","meaning":"තාර්කික ශ්‍රිතයක වීජීය ආකාරය"},{"word":"විශ්ව ද්වාරය","meaning":"ඕනෑම පරිපථයක් හැදිය හැකි NAND හෝ NOR"}]},{"title":"මට පුළුවන්…","items":["ද්වාර හතේ සංකේත සහ සත්‍යතා වගු අඳින්න","ද්වාර සඳහා බූලීය ප්‍රකාශන ලියන්න","NAND සහ NOR විශ්ව වන්නේ ඇයි පැහැදිලි කරන්න"]},{"title":"මූලාශ්‍ර"}]}}