Home / Courses / IIT JAM Physics / Practice / Logic gates and Boolean algebra

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.

  1. MCQWarm-up

    The binary number (1011)2 equals, in decimal,
    1. 13
    2. 9
    3. 11
    4. 1011
    Answer and solution

    Answer: C

    Weights from the right are 1,2,4,8: 1×8+0×4+1×2+1×1=11.

    Why people get this wrong: 13 comes from reading the bits in the wrong order (1101).

  2. MCQWarm-up

    A two-input gate gives output 1 only when both inputs are 0. It is
    1. NAND
    2. OR
    3. XNOR
    4. 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.

  3. NATWarm-up

    When the decimal number 45 is written in binary, the number of 1s in it is ______.
    Answer and solution

    Answer: 4

    45=32+8+4+1, so 45=(101101)2, which has four 1s. Check by repeated division by 2: remainders 1,0,1,1,0,1 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.

  4. MCQWarm-up

    The Boolean expression A+AB simplifies to
    1. A
    2. B
    3. AB
    4. A+B
    Answer and solution

    Answer: A

    Factor out A: A+AB=A(1+B)=A⋅1=A, since 1+B=1 in Boolean algebra. This is the absorption law: if A is 1 the expression is 1, and if A is 0 both terms are 0.

    Why people get this wrong: Ordinary algebra has no rule 1+B=1, so it seems nothing simplifies.

  5. MCQWarm-up

    Which expression equals A⊕︎B (exclusive OR)?
    1. AB+A‾B‾
    2. A‾B+AB‾
    3. A+B
    4. A‾+B‾
    Answer and solution

    Answer: B

    XOR is 1 exactly when the inputs differ: A=0,B=1 (term A‾B) or A=1,B=0 (term AB‾). So A⊕︎B=A‾B+AB‾. The expression AB+A‾B‾ is its complement, XNOR.

    Why people get this wrong: A+B (OR) differs from XOR only in the row A=B=1, the row people forget.

  6. MCQWarm-up

    Which pair of gates are each "universal", meaning any logic function can be built from that gate alone?
    1. AND and OR
    2. NAND and NOR
    3. XOR and XNOR
    4. NOT and AND
    Answer and solution

    Answer: B

    With NAND alone: NOT A = NAND(A, A); AND = NOT of NAND; OR = NAND(A‾, B‾) 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.

  7. MCQWarm-up

    The smallest number of bits that can represent every whole number from 0 to 100 in plain binary is
    1. 6
    2. 7
    3. 8
    4. 10
    Answer and solution

    Answer: B

    n bits cover 0 to 2n−1. 26−1=63 is too small; 27−1=127≥100. So 7 bits (100=11001002).

    Why people get this wrong: Choosing 8 because data usually comes in whole bytes: 7 bits already reach 127.

  8. NATStandard

    The hexadecimal number (2F)16 equals ______ in decimal.
    Answer and solution

    Answer: 47

    F=15, so (2F)16=2×16+15=47.

    Why people get this wrong: Treating F as 6 (the sixth letter) or reading 2F as 2×10+15.

  9. MCQStandard

    By De Morgan's theorem, A+B equals
    1. A‾+B‾
    2. AB
    3. A‾B‾
    4. AB‾+A‾B
    Answer and solution

    Answer: C

    "Break the bar and change the sign": A+B=A‾B‾ and AB=A‾+B‾. Check: A+B is 0 only when both are 0, which is exactly when A‾B‾=1.

    Why people get this wrong: A‾+B‾ breaks the bar but forgets to change OR into AND; it equals NAND, not NOR.

  10. NATStandard

    The number −20 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

    20=00010100. Invert every bit: 11101011; add 1: 11101100. As an unsigned number this is 128+64+32+8+4=236, which is 28−20, as it must be.

    Why people get this wrong: Stopping after inverting (one's complement) gives 235.

  11. MSQStandard

    Which of the following expressions are equal to A?
    1. A+AB
    2. A(A+B)
    3. A+A‾B
    4. AB+AB‾
    Answer and solution

    Answer: A, B, D

    A+AB=A(1+B)=A. A(A+B)=A+AB=A. AB+AB‾=A(B+B‾)=A. But A+A‾B=(A+A‾)(A+B)=A+B, which is 1 when A=0,B=1.

    Why people get this wrong: A+A‾B looks like the absorption law, but the bar on A makes it A+B.

  12. MCQStandard

    The smallest number of two-input NAND gates needed to make a two-input XOR gate is
    1. 3
    2. 4
    3. 5
    4. 2
    Answer and solution

    Answer: B

    Let N=AB (gate 1). Gate 2: AN; gate 3: BN; gate 4: NAND of those two. Gate 4 gives AN+BN=(A+B)AB=(A+B)(A‾+B‾)=AB‾+A‾B=A⊕︎B. 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 AB saves one.

  13. MCQStandard

    A half adder adds two bits A and B. Its sum S and carry C are
    1. S=A+B, C=AB
    2. S=AB, C=A⊕︎B
    3. S=A⊕︎B, C=A+B
    4. S=A⊕︎B, C=AB
    Answer and solution

    Answer: D

    Binary addition: 0+0=00, 0+1=1+0=01, 1+1=10. 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 1+1, where the sum bit must be 0.

  14. 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 25=32 combinations, one row each.

    Why people get this wrong: 52=25 swaps base and exponent.

  15. MCQStandard

    Both inputs of a two-input NAND gate are tied together and driven by A. The output is
    1. A‾
    2. A
    3. always 1
    4. always 0
    Answer and solution

    Answer: A

    A⋅A=A‾: the NAND becomes an inverter. The same works for NOR: A+A=A‾.

    Why people get this wrong: Tying the inputs of AND or OR gives back A; the bar in NAND makes it A‾.

  16. MSQStandard

    Which statements about the two-input NOR gate are correct?
    1. It is a universal gate.
    2. Its output is 1 only when both inputs are 0.
    3. It is equivalent to an OR gate followed by a NOT gate.
    4. With both inputs tied to A its output is A.
    Answer and solution

    Answer: A, B, C

    NOR =A+B: an OR followed by NOT, 1 only for inputs 00, and universal (it can make NOT, OR and AND). With both inputs tied together, A+A=A‾, an inverter, not A.

    Why people get this wrong: Tied inputs turn NOR into NOT.

  17. MCQStandard

    The decimal number 59 in BCD (8421 code) is
    1. 00111011
    2. 10010101
    3. 01011010
    4. 01011001
    Answer and solution

    Answer: D

    BCD codes each decimal digit separately in four bits: 5=0101 and 9=1001, so 59=01011001.

    Why people get this wrong: 00111011 is the plain binary of 59, not BCD.

  18. MSQStandard

    Which of these identities hold in Boolean algebra?
    1. A+A=A
    2. A+1=1
    3. A+BC=(A+B)(A+C)
    4. A(B+C)=AB+C
    Answer and solution

    Answer: A, B, C

    A+A=A (idempotence) and A+1=1 have no ordinary-algebra version. A+BC=(A+B)(A+C) is the distributive law of OR over AND: expand the right side to A+AC+AB+BC=A+BC. The last one is wrong: A(B+C)=AB+AC; try A=0,C=1, 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.

  19. NATStandard

    A memory chip stores 4 KB, organised as one byte per address (1 KB =1024 bytes). The number of address lines it needs is ______.
    Answer and solution

    Answer: 12

    4 KB =4×1024=4096=212 addresses, and n address lines select 2n locations. So 12 lines. The 8 data lines carry the byte itself and are not part of the count.

    Why people get this wrong: Counting bits (4096×8=215, giving 15) instead of addressable words.

  20. MCQStandard

    In excess-3 code, the decimal digit 5 is written as
    1. 0101
    2. 0010
    3. 0111
    4. 1000
    Answer and solution

    Answer: D

    Excess-3 adds 3 to each decimal digit and writes the result in 4-bit binary: 5+3=8=1000. The code is self-complementing: the 9's complement of a digit is obtained by inverting its bits (4→0111, 5→1000).

    Why people get this wrong: 0101 is plain BCD; 0010 subtracts 3 instead of adding.

  21. MCQExam level

    The expression Y=AB+AB‾+A‾B simplifies to
    1. AB
    2. A⊕︎B
    3. A+B
    4. 1
    Answer and solution

    Answer: C

    AB+AB‾=A(B+B‾)=A, so Y=A+A‾B=(A+A‾)(A+B)=A+B. In the truth table Y is 0 only for A=B=0, 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 AB term fills the last row.

  22. MCQExam level

    With A as the most significant bit, the function f(A,B,C)=∑m(0,2,4,6) simplifies to
    1. A‾C‾
    2. C‾
    3. C
    4. B‾
    Answer and solution

    Answer: B

    The minterms are 000,010,100,110: in every one C=0, while A and B take all four values. So f=C‾. On a K-map the four cells form one group of four.

    Why people get this wrong: Grouping only pairs gives A‾C‾+AC‾, which is still C‾.

  23. MSQExam level

    Let Y=AB⋅A‾B‾. Which expressions are equal to Y?
    1. A⊕︎B
    2. (A+B)(A‾+B‾)
    3. the complement of A XNOR B
    4. A+B
    Answer and solution

    Answer: A, B, C

    De Morgan on each factor: AB=A‾+B‾ and A‾B‾=A+B. So Y=(A+B)(A‾+B‾)=AB‾+A‾B=A⊕︎B, which is also the complement of XNOR. It differs from A+B at A=B=1, where Y=0.

    Why people get this wrong: The product of sums (A+B)(A‾+B‾) is a valid way to write XOR; it is not OR.

  24. NATExam level

    In 4-bit two's complement arithmetic, 0110−1001 is done by adding the two's complement of 1001 to 0110 (with 1001 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 1001: invert to 0110, add 1: 0111. Add: 0110+0111=1101. The top bit is 1, so the result is negative: invert 1101 to 0010, add 1, giving 0011=3. The result is −3, which matches 6−9.

    Why people get this wrong: Reading 1101 as unsigned gives 13; the top bit marks a negative number.

  25. MCQExam level

    The carry output of a full adder with inputs A, B and carry-in C is
    1. AB+C(A⊕︎B)
    2. A⊕︎B⊕︎C
    3. AB+BC
    4. A+B+C
    Answer and solution

    Answer: A

    A carry comes out when at least two of the three inputs are 1. Either A and B are both 1 (AB), or exactly one of them is 1 and the carry-in is 1 (C(A⊕︎B)). This equals the majority function AB+BC+CA. A⊕︎B⊕︎C is the sum bit.

    Why people get this wrong: AB+BC misses the case A=C=1,B=0.

  26. NATExam level

    A multiplexer selects one of 32 data inputs. The number of select lines it needs is ______.
    Answer and solution

    Answer: 5

    n select lines can address 2n inputs. 25=32, so 5 select lines.

    Why people get this wrong: Thinking one select line per input (32) or 32/2=16.

  27. MCQExam level

    A 4-to-1 multiplexer with select lines S1S0 has its data inputs set to I0=0, I1=1, I2=1, I3=0. As a function of S1 and S0, its output is
    1. S1S0
    2. S1+S0
    3. S1⊕︎S0
    4. the complement of S1⊕︎S0
    Answer and solution

    Answer: C

    The output copies Ik where k=(S1S0)2: 00→0, 01→1, 10→1, 11→0. That is 1 exactly when the select bits differ: S1⊕︎S0. 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 11, where this output is 0.

  28. NATExam level

    A 4-bit ripple counter is driven by a 16 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 24=16: 16/16=1 kHz.

    Why people get this wrong: Dividing by 4 (one per flip-flop, not two) gives 4 kHz.

  29. MCQExam level

    An edge-triggered JK flip-flop has J=K=1. At each active clock edge its output
    1. holds its value
    2. resets to 0
    3. sets to 1
    4. toggles
    Answer and solution

    Answer: D

    JK flip-flop: J=K=0 holds, J=1,K=0 sets, J=0,K=1 resets, J=K=1 toggles (Qn+1=Q‾n). The characteristic equation Qn+1=JQ‾n+K‾Qn gives Q‾n when J=K=1.

    Why people get this wrong: In an SR flip-flop the equivalent input S=R=1 is forbidden; the JK was designed to make it useful.

  30. MSQExam level

    With A as the most significant bit, consider f(A,B,C)=∑m(3,5,6,7). Which statements are correct?
    1. f=AB+BC+CA
    2. f is 1 whenever at least two inputs are 1.
    3. f=∏M(0,1,2,4)
    4. f is the sum output of a full adder.
    Answer and solution

    Answer: A, B, C

    The minterms 011,101,110,111 are exactly the rows with two or more 1s: the majority function, AB+BC+CA. The maxterms are the remaining rows 0,1,2,4, so the POS form is ∏M(0,1,2,4). The majority function is the CARRY of a full adder; the sum is A⊕︎B⊕︎C (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.

← All topics · Timed mock test →