Logic gates and Boolean algebra
Electronics · 82 questions and templates for IIT JAM Physics, in order from warm-up to top rank. Check each answer, then read the full solution.
New to this topic? Read the lesson first: Logic gates and Boolean algebra.
Loading questions… (they need JavaScript; nothing you type is sent anywhere)
Written questions with solutions
The same questions as a list, so you can print them or read without the practice box. Templates (fresh numbers) appear only in the practice box above.
-
MCQWarm-up
The binary number equals, in decimal,Answer and solution
Answer: C
Weights from the right are : .Why people get this wrong: comes from reading the bits in the wrong order ().
-
MCQWarm-up
A two-input gate gives output 1 only when both inputs are 0. It is- NAND
- OR
- XNOR
- NOR
Answer and solution
Answer: D
OR gives 1 if any input is 1, so NOR (OR then NOT) gives 1 only when no input is 1, i.e. both are 0. XNOR also gives 1 for inputs 00, but it gives 1 for 11 as well.Why people get this wrong: XNOR is 1 for 00 too, but not ONLY for 00.
-
NATWarm-up
When the decimal number is written in binary, the number of 1s in it is ______.Answer and solution
Answer: 4
, so , which has four 1s. Check by repeated division by 2: remainders read from the last one up.Why people get this wrong: Reading the remainders from the first one down gives the bits reversed; here the count of 1s is the same, but the number is not.
-
MCQWarm-up
The Boolean expression simplifies toAnswer and solution
Answer: A
Factor out : , since in Boolean algebra. This is the absorption law: if is 1 the expression is 1, and if is 0 both terms are 0.Why people get this wrong: Ordinary algebra has no rule , so it seems nothing simplifies.
-
MCQWarm-up
Which expression equals (exclusive OR)?Answer and solution
Answer: B
XOR is 1 exactly when the inputs differ: (term ) or (term ). So . The expression is its complement, XNOR.Why people get this wrong: (OR) differs from XOR only in the row , the row people forget.
-
MCQWarm-up
Which pair of gates are each "universal", meaning any logic function can be built from that gate alone?- AND and OR
- NAND and NOR
- XOR and XNOR
- NOT and AND
Answer and solution
Answer: B
With NAND alone: NOT = NAND(, ); AND = NOT of NAND; OR = NAND(, ) by De Morgan. NOR works the same way with the roles of AND and OR swapped. AND and OR cannot make NOT; XOR cannot make AND.Why people get this wrong: NOT plus AND is also a complete set, but it is two gates, not one universal gate.
-
MCQWarm-up
The smallest number of bits that can represent every whole number from to in plain binary isAnswer and solution
Answer: B
bits cover to . is too small; . So bits ().Why people get this wrong: Choosing 8 because data usually comes in whole bytes: 7 bits already reach 127.
-
NATStandard
The hexadecimal number equals ______ in decimal.Answer and solution
Answer: 47
, so .Why people get this wrong: Treating F as 6 (the sixth letter) or reading 2F as .
-
MCQStandard
By De Morgan's theorem, equalsAnswer and solution
Answer: C
"Break the bar and change the sign": and . Check: is 0 only when both are 0, which is exactly when .Why people get this wrong: breaks the bar but forgets to change OR into AND; it equals NAND, not NOR.
-
NATStandard
The number is stored in 8-bit two's complement form. Read as an unsigned binary number, that 8-bit pattern equals ______ in decimal.Answer and solution
Answer: 236
. Invert every bit: ; add 1: . As an unsigned number this is , which is , as it must be.Why people get this wrong: Stopping after inverting (one's complement) gives .
-
MSQStandard
Which of the following expressions are equal to ?Answer and solution
Answer: A, B, D
. . . But , which is 1 when .Why people get this wrong: looks like the absorption law, but the bar on makes it .
-
MCQStandard
The smallest number of two-input NAND gates needed to make a two-input XOR gate isAnswer and solution
Answer: B
Let (gate 1). Gate 2: ; gate 3: ; gate 4: NAND of those two. Gate 4 gives . Four gates; it cannot be done with three.Why people get this wrong: Building XOR from its SOP form with NANDs and separate inverters takes 5; sharing saves one.
-
MCQStandard
A half adder adds two bits and . Its sum and carry are- ,
- ,
- ,
- ,
Answer and solution
Answer: D
Binary addition: , , . The sum bit is 1 when exactly one input is 1 (XOR); the carry is 1 only when both are 1 (AND).Why people get this wrong: Using OR for the sum fails in the row , where the sum bit must be 0.
-
NATStandard
The complete truth table of a Boolean function of 5 input variables has ______ rows.Answer and solution
Answer: 32
Each input is 0 or 1, so there are combinations, one row each.Why people get this wrong: swaps base and exponent.
-
MCQStandard
Both inputs of a two-input NAND gate are tied together and driven by . The output is- always
- always
Answer and solution
Answer: A
: the NAND becomes an inverter. The same works for NOR: .Why people get this wrong: Tying the inputs of AND or OR gives back ; the bar in NAND makes it .
-
MSQStandard
Which statements about the two-input NOR gate are correct?- It is a universal gate.
- Its output is 1 only when both inputs are 0.
- It is equivalent to an OR gate followed by a NOT gate.
- With both inputs tied to its output is .
Answer and solution
Answer: A, B, C
NOR : an OR followed by NOT, 1 only for inputs 00, and universal (it can make NOT, OR and AND). With both inputs tied together, , an inverter, not .Why people get this wrong: Tied inputs turn NOR into NOT.
-
MCQStandard
The decimal number in BCD (8421 code) isAnswer and solution
Answer: D
BCD codes each decimal digit separately in four bits: and , so .Why people get this wrong: is the plain binary of 59, not BCD.
-
MSQStandard
Which of these identities hold in Boolean algebra?Answer and solution
Answer: A, B, C
(idempotence) and have no ordinary-algebra version. is the distributive law of OR over AND: expand the right side to . The last one is wrong: ; try , which gives 0 on the left and 1 on the right.Why people get this wrong: OR distributes over AND in Boolean algebra, although addition does not distribute over multiplication in ordinary algebra.
-
NATStandard
A memory chip stores KB, organised as one byte per address ( KB bytes). The number of address lines it needs is ______.Answer and solution
Answer: 12
KB addresses, and address lines select locations. So lines. The data lines carry the byte itself and are not part of the count.Why people get this wrong: Counting bits (, giving 15) instead of addressable words.
-
MCQStandard
In excess-3 code, the decimal digit is written asAnswer and solution
Answer: D
Excess-3 adds to each decimal digit and writes the result in 4-bit binary: . The code is self-complementing: the 9's complement of a digit is obtained by inverting its bits (, ).Why people get this wrong: is plain BCD; subtracts 3 instead of adding.
-
MCQExam level
The expression simplifies toAnswer and solution
Answer: C
, so . In the truth table is 0 only for , which is OR.Why people get this wrong: Two of the three terms are the XOR terms, which tempts people to answer XOR; the extra term fills the last row.
-
MCQExam level
With as the most significant bit, the function simplifies toAnswer and solution
Answer: B
The minterms are : in every one , while and take all four values. So . On a K-map the four cells form one group of four.Why people get this wrong: Grouping only pairs gives , which is still .
-
MSQExam level
Let . Which expressions are equal to ?- the complement of XNOR
Answer and solution
Answer: A, B, C
De Morgan on each factor: and . So , which is also the complement of XNOR. It differs from at , where .Why people get this wrong: The product of sums is a valid way to write XOR; it is not OR.
-
NATExam level
In 4-bit two's complement arithmetic, is done by adding the two's complement of to (with read as an unsigned 4-bit number). Keeping 4 bits and reading the result as a two's complement number, the answer in decimal is ______.Answer and solution
Answer: -3
Two's complement of : invert to , add 1: . Add: . The top bit is 1, so the result is negative: invert to , add 1, giving . The result is , which matches .Why people get this wrong: Reading as unsigned gives 13; the top bit marks a negative number.
-
MCQExam level
The carry output of a full adder with inputs , and carry-in isAnswer and solution
Answer: A
A carry comes out when at least two of the three inputs are 1. Either and are both 1 (), or exactly one of them is 1 and the carry-in is 1 (). This equals the majority function . is the sum bit.Why people get this wrong: misses the case .
-
NATExam level
A multiplexer selects one of data inputs. The number of select lines it needs is ______.Answer and solution
Answer: 5
select lines can address inputs. , so 5 select lines.Why people get this wrong: Thinking one select line per input (32) or .
-
MCQExam level
A 4-to-1 multiplexer with select lines has its data inputs set to , , , . As a function of and , its output is- the complement of
Answer and solution
Answer: C
The output copies where : , , , . That is 1 exactly when the select bits differ: . A multiplexer can make any function of its select lines by tying its data inputs to the truth table.Why people get this wrong: OR differs only in the row , where this output is 0.
-
NATExam level
A 4-bit ripple counter is driven by a kHz clock. The frequency of the square wave at the output of its last flip-flop is ______ kHz.Answer and solution
Answer: 1 kHz (±0.001)
Each toggling flip-flop divides the frequency by 2, so four of them divide by : kHz.Why people get this wrong: Dividing by 4 (one per flip-flop, not two) gives 4 kHz.
-
MCQExam level
An edge-triggered JK flip-flop has . At each active clock edge its output- holds its value
- resets to 0
- sets to 1
- toggles
Answer and solution
Answer: D
JK flip-flop: holds, sets, resets, toggles (). The characteristic equation gives when .Why people get this wrong: In an SR flip-flop the equivalent input is forbidden; the JK was designed to make it useful.
-
MSQExam level
With as the most significant bit, consider . Which statements are correct?- is 1 whenever at least two inputs are 1.
- is the sum output of a full adder.
Answer and solution
Answer: A, B, C
The minterms are exactly the rows with two or more 1s: the majority function, . The maxterms are the remaining rows , so the POS form is . The majority function is the CARRY of a full adder; the sum is (minterms 1, 2, 4, 7).Why people get this wrong: Carry and sum are easily swapped: the sum is the odd-parity function, the carry the majority function.