Menu Close

Digital electronics: UPSC Physics Optional PYQ Solutions (1996–2024)

All 26 questions UPSC has asked on digital electronics in the Physics Optional (Paper II, Solid State Physics, Devices and Electronics) from 1996 to 2024, solved step by step – latest first.

Try them yourself first: the same questions, without solutions, are on our Solid State Physics, Devices and Electronics topic-wise PYQs page.

How we check these solutions

These are our own solutions, prepared with AI help. UPSC does not publish official answers. Every solution is checked a second way before it goes up, and says how:

  • ✓ Checked by computer the numbers or the algebra were worked out again independently in code (Python with SymPy) and agree with ours.
  • ✓ Proof checked step by step every step of the argument was checked.
  • ✓ Checked step by step for descriptive questions, every statement was checked against standard textbooks.

Spotted a mistake or a neater method? Tell us in the comments below or through Report an error.

Jump to a question (year · question number):

2024 · 8b(i) 2024 · 8b(ii) 2022 · 5e 2016 · 5b 2015 · 5d 2013 · 8b 2012 · 8b 2011 · 5f 2011 · 8b 2010 · 8c 2009 · 5e 2007 · 5c(i) 2007 · 8b 2006 · 5c(i) 2005 · 5c(i) 2004 · 8b 2004 · 8c 2003 · 5c 2002 · 5d(i) 2001 · 8a 2001 · 8b 2000 · 1d 1999 · 1d 1998 · 4b 1997 · 4b 1996 · 4a

Cover of the UPSC Prelims Topic-wise PYQ book with detailed explanations

From the Optional Province team

Preparing for Prelims too?

Our UPSC Prelims Topic-wise PYQ Book covers every Prelims question with detailed explanations, so you can see exactly where UPSC asks from. Now available as a hard copy and an eBook.

Buy Hard Copy on AmazonBuy eBook (PDF)

Download a free sample

How is digital system different from analog system? What are the principal reasons for the widespread use of digital electronics?

2024 · Paper II · Q8b(i) · 8 marks

Solution

Analog versus digital systems.

Analog Digital
Signals vary continuously and can take any value in a range (e.g. a microphone voltage) Signals take only discrete values, usually two (0 and 1, LOW and HIGH)
Information is carried by the exact value of a voltage or current Information is coded as binary numbers; only the level (0 or 1) matters
Noise and drift add directly to the signal and accumulate stage by stage Small noise does not change a 0 into a 1, so it is rejected; signals can be regenerated perfectly
Processing by amplifiers, filters, integrators Processing by logic gates, flip-flops, arithmetic circuits, processors
Accuracy limited by component tolerances Accuracy set by the number of bits, can be made as high as needed
Examples: radio receiver, audio amplifier, thermometer Computers, digital watches, mobile phones, digital TV

Reasons for the widespread use of digital electronics.

  1. Noise immunity and reliability: a signal need only be recognised as 0 or 1; it can be regenerated without loss at every stage, so it can be copied and transmitted over long distances without degradation.
  2. Accuracy and precision set by word length, not by component tolerances; results are exactly repeatable.
  3. Storage: information is easily stored in large, cheap memories (semiconductor, magnetic, optical) for any length of time.
  4. Programmability: one hardware design (a microprocessor) can do many different tasks by changing the software.
  5. Integration: digital circuits use simple, repetitive switching elements ideal for ICs; millions or billions of gates on a chip, with low cost, small size and low power (CMOS).
  6. Easy design with Boolean algebra and computer-aided tools; error detection and correction, encryption and compression are possible.
  7. Compatibility with computers and digital communication. (Analog circuits are still needed at the interfaces – sensors, amplifiers, ADC/DAC, RF.)

✓ Checked step by step We checked the comparison and the list of reasons step by step.

↑ Back to the question list

Give logic diagram, Boolean equation and truth tables of AND, OR and NOT gates. Show that NAND and NOR gates can be utilized as a Universal Gate.

2024 · Paper II · Q8b(ii) · 12 marks

Solution

ANDY = A·BORY = A + BNOTY = ĀNANDY = A·BNORY = A + BXORY = A ⊕ B
Symbols of the basic gates

Basic gates (two inputs A, B; output Y).

A B AND AB OR A+B NAND AB¯ NOR A+B¯ XOR A⊕B
0 0 0 0 1 1 0
0 1 0 1 1 0 1
1 0 0 1 1 0 1
1 1 1 1 0 0 0

NOT: Y=A‾ (A = 0 gives 1; A = 1 gives 0).

  • AND: output 1 only if all inputs are 1 (Y=A⋅B).
  • OR: output 1 if any input is 1 (Y=A+B).
  • NOT: output is the complement of the input (Y=A‾).
  • NAND (NOT-AND): Y=A⋅B¯ – output 0 only when all inputs are 1.
  • NOR (NOT-OR): Y=A+B¯ – output 1 only when all inputs are 0.

Exclusive-OR (XOR). Output 1 when the inputs are different, 0 when they are the same: Y=A⊕B=AB‾+A‾B. It can be built from AND, OR and NOT gates (two ANDs fed with AB‾ and A‾B, followed by an OR), or from four NAND gates (below). It acts as an inequality detector, a controlled inverter and a modulo-2 adder (the sum output of a half adder); its complement is XNOR (equality).

Why NAND and NOR are universal gates. Any Boolean function can be written using AND, OR and NOT. Each of these can be built from NAND gates alone, or from NOR gates alone, so either type by itself can realise any logic circuit. (This simplifies manufacture: a whole IC can be made of one kind of gate.)

NOTAĀAĀANDABA·BABA·BORABA+BABA+Bwith NAND gateswith NOR gates
NOT, AND and OR made only from NAND gates (left) and only from NOR gates (right)

With NAND gates:

  • NOT: tie the inputs together, A⋅A¯=A‾.
  • AND: NAND followed by a NAND inverter, AB¯¯=AB.
  • OR: invert each input with a NAND, then NAND them: A‾⋅B‾¯=A+B (De Morgan). This is the required OR gate using only NAND gates (three gates).

With NOR gates:

  • NOT: A+A¯=A‾.
  • OR: NOR followed by a NOR inverter, A+B¯¯=A+B.
  • AND: invert each input with a NOR, then NOR them: A‾+B‾¯=AB.

XOR using only NAND gates (four gates):

ABY₁Y₂Y₃Y = A ⊕ B1234
Exclusive-OR from four NAND gates

Y1=AB¯, Y2=AY1¯, Y3=BY1¯, Y=Y2Y3¯. Then Y=AY1+BY1=(A+B)AB¯ =(A+B)(A‾+B‾)=AB‾+A‾B.

✓ Checked step by step We checked every truth table and each NAND/NOR construction by evaluating all input combinations.

↑ Back to the question list

Why NAND and NOR gates are called universal gates? Give the logic diagram, Boolean equation and the truth table of a X–OR gate.

2022 · Paper II · Q5e · 10 marks

Solution

ANDY = A·BORY = A + BNOTY = ĀNANDY = A·BNORY = A + BXORY = A ⊕ B
Symbols of the basic gates

Basic gates (two inputs A, B; output Y).

A B AND AB OR A+B NAND AB¯ NOR A+B¯ XOR A⊕B
0 0 0 0 1 1 0
0 1 0 1 1 0 1
1 0 0 1 1 0 1
1 1 1 1 0 0 0

NOT: Y=A‾ (A = 0 gives 1; A = 1 gives 0).

  • AND: output 1 only if all inputs are 1 (Y=A⋅B).
  • OR: output 1 if any input is 1 (Y=A+B).
  • NOT: output is the complement of the input (Y=A‾).
  • NAND (NOT-AND): Y=A⋅B¯ – output 0 only when all inputs are 1.
  • NOR (NOT-OR): Y=A+B¯ – output 1 only when all inputs are 0.

Exclusive-OR (XOR). Output 1 when the inputs are different, 0 when they are the same: Y=A⊕B=AB‾+A‾B. It can be built from AND, OR and NOT gates (two ANDs fed with AB‾ and A‾B, followed by an OR), or from four NAND gates (below). It acts as an inequality detector, a controlled inverter and a modulo-2 adder (the sum output of a half adder); its complement is XNOR (equality).

Why NAND and NOR are universal gates. Any Boolean function can be written using AND, OR and NOT. Each of these can be built from NAND gates alone, or from NOR gates alone, so either type by itself can realise any logic circuit. (This simplifies manufacture: a whole IC can be made of one kind of gate.)

NOTAĀAĀANDABA·BABA·BORABA+BABA+Bwith NAND gateswith NOR gates
NOT, AND and OR made only from NAND gates (left) and only from NOR gates (right)

With NAND gates:

  • NOT: tie the inputs together, A⋅A¯=A‾.
  • AND: NAND followed by a NAND inverter, AB¯¯=AB.
  • OR: invert each input with a NAND, then NAND them: A‾⋅B‾¯=A+B (De Morgan). This is the required OR gate using only NAND gates (three gates).

With NOR gates:

  • NOT: A+A¯=A‾.
  • OR: NOR followed by a NOR inverter, A+B¯¯=A+B.
  • AND: invert each input with a NOR, then NOR them: A‾+B‾¯=AB.

XOR using only NAND gates (four gates):

ABY₁Y₂Y₃Y = A ⊕ B1234
Exclusive-OR from four NAND gates

Y1=AB¯, Y2=AY1¯, Y3=BY1¯, Y=Y2Y3¯. Then Y=AY1+BY1=(A+B)AB¯ =(A+B)(A‾+B‾)=AB‾+A‾B.

✓ Checked step by step We checked every truth table and each NAND/NOR construction by evaluating all input combinations.

↑ Back to the question list

Why are NAND and NOR gates called universal gates? Give the logic diagram, Boolean equation and the truth table of a NAND gate.

2016 · Paper II · Q5b · 10 marks

Solution

ANDY = A·BORY = A + BNOTY = ĀNANDY = A·BNORY = A + BXORY = A ⊕ B
Symbols of the basic gates

Basic gates (two inputs A, B; output Y).

A B AND AB OR A+B NAND AB¯ NOR A+B¯ XOR A⊕B
0 0 0 0 1 1 0
0 1 0 1 1 0 1
1 0 0 1 1 0 1
1 1 1 1 0 0 0

NOT: Y=A‾ (A = 0 gives 1; A = 1 gives 0).

  • AND: output 1 only if all inputs are 1 (Y=A⋅B).
  • OR: output 1 if any input is 1 (Y=A+B).
  • NOT: output is the complement of the input (Y=A‾).
  • NAND (NOT-AND): Y=A⋅B¯ – output 0 only when all inputs are 1.
  • NOR (NOT-OR): Y=A+B¯ – output 1 only when all inputs are 0.

Exclusive-OR (XOR). Output 1 when the inputs are different, 0 when they are the same: Y=A⊕B=AB‾+A‾B. It can be built from AND, OR and NOT gates (two ANDs fed with AB‾ and A‾B, followed by an OR), or from four NAND gates (below). It acts as an inequality detector, a controlled inverter and a modulo-2 adder (the sum output of a half adder); its complement is XNOR (equality).

Why NAND and NOR are universal gates. Any Boolean function can be written using AND, OR and NOT. Each of these can be built from NAND gates alone, or from NOR gates alone, so either type by itself can realise any logic circuit. (This simplifies manufacture: a whole IC can be made of one kind of gate.)

NOTAĀAĀANDABA·BABA·BORABA+BABA+Bwith NAND gateswith NOR gates
NOT, AND and OR made only from NAND gates (left) and only from NOR gates (right)

With NAND gates:

  • NOT: tie the inputs together, A⋅A¯=A‾.
  • AND: NAND followed by a NAND inverter, AB¯¯=AB.
  • OR: invert each input with a NAND, then NAND them: A‾⋅B‾¯=A+B (De Morgan). This is the required OR gate using only NAND gates (three gates).

With NOR gates:

  • NOT: A+A¯=A‾.
  • OR: NOR followed by a NOR inverter, A+B¯¯=A+B.
  • AND: invert each input with a NOR, then NOR them: A‾+B‾¯=AB.

XOR using only NAND gates (four gates):

ABY₁Y₂Y₃Y = A ⊕ B1234
Exclusive-OR from four NAND gates

Y1=AB¯, Y2=AY1¯, Y3=BY1¯, Y=Y2Y3¯. Then Y=AY1+BY1=(A+B)AB¯ =(A+B)(A‾+B‾)=AB‾+A‾B.

✓ Checked step by step We checked every truth table and each NAND/NOR construction by evaluating all input combinations.

↑ Back to the question list

Simplify the logical expression [AB‾(C+BD)+A‾B‾]C.

2015 · Paper II · Q5d · 10 marks

Solution

Y=[AB‾(C+BD)+A‾B‾]C. Expand the bracket: AB‾(C+BD)=AB‾C+AB‾BD=AB‾C, since BB‾=0. Y=(AB‾C+A‾B‾)C=AB‾C+A‾B‾C, (CC=C) =B‾C(A+A‾)=B‾C. Y=B‾C (D drops out entirely; the circuit reduces to one AND gate with an inverter on B.)

✓ Checked by computer We checked the simplification against the full truth table in code.

↑ Back to the question list

Construct a digital circuit to add three bits A, B and C and provide their sum and carry as outputs. Show appropriate Boolean expressions and truth table to justify the outputs.

2013 · Paper II · Q8b · 25 marks

Solution

Full adder. It adds three bits A, B and C (C is the carry from the previous column) and gives a sum bit S and a carry-out Co.

A B C S Co
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1

Boolean expressions (sum of products from the table): S=A‾B‾C+A‾BC‾+AB‾C‾+ABC =A⊕B⊕C (S = 1 when an odd number of inputs are 1). Co=A‾BC+AB‾C+ABC‾+ABC =AB+BC+CA=AB+C(A⊕B) (carry when at least two inputs are 1).

Circuit. Two half adders and an OR gate: the first half adder gives A⊕B and AB; the second adds C, giving S=(A⊕B)⊕C and C(A⊕B); the OR of the two carries is Co.

ABCA⊕BSCoutS = A ⊕ B ⊕ C, Cout = AB + C(A ⊕ B) = AB + BC + CA
Full adder from two half adders and an OR gate

The truth table above, obtained by evaluating these gates for all eight inputs, confirms the outputs.

✓ Checked by computer We checked the sum and carry expressions against all eight input combinations in code.

↑ Back to the question list

Explain the race problem encountered in an RS latch and how it can be avoided. Build a Mod-10 counter using JK flip-flops and explain its working.

2012 · Paper II · Q8b · 30 marks

Solution

Race problem in an RS latch. In a NOR-gate RS latch the input S=R=1 forces both Q and Q‾ to 0, which is logically inconsistent. If S and R then return to 0 simultaneously, both gates try to switch to 1 at the same moment; whichever gate is slightly faster wins, and the final state is unpredictable. This dependence on unequal propagation delays is a race (the condition is “forbidden” or “indeterminate”). In a clocked (gated) latch the same happens if S = R = 1 when the clock pulse ends.

How to avoid it.

  1. Never apply S=R=1: e.g. use a D latch/flip-flop, with R=S‾ produced by an inverter.
  2. Use a JK flip-flop, in which the outputs are fed back to the input gates so that J=K=1 makes the flip-flop toggle – a defined state.
  3. A JK flip-flop with a level-sensitive clock has its own race-around problem (it toggles repeatedly while the clock is high if the pulse is longer than the propagation delay). This is removed by edge triggering or a master–slave arrangement, so that the outputs change only once per clock pulse.

Mod-10 (decade) counter with JK flip-flops.

HIGH (1)JKQQCLRFF0JKQQCLRFF1JKQQCLRFF2JKQQCLRFF3CLKQ0Q1Q2Q3Q1Q3CLRCLRCLRCLRCLRNAND output clears all flip-flops when Q3Q2Q1Q0 = 1010 (count 10)
Mod-10 ripple counter with a NAND reset

Circuit. Four negative-edge-triggered JK flip-flops FF0–FF3 with J=K=1, so each toggles on every falling edge at its clock input. The external clock drives FF0; the output Q0 clocks FF1, Q1 clocks FF2, Q2 clocks FF3 (ripple, or asynchronous, counter). Four flip-flops alone would count 0–15 (mod-16). A two-input NAND gate fed with Q3 and Q1 drives the active-low CLEAR inputs of all four flip-flops.

Working.

Clock pulses Q3Q2Q1Q0 Count
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 → 0000 0

FF0 divides the clock by 2, FF1 by 4, and so on, so the outputs count up in binary. On the tenth pulse the state becomes 1010; this is the first state in which Q3=Q1=1, so the NAND output goes LOW and immediately clears all flip-flops to 0000 (the state 1010 lasts only a few nanoseconds). The counter therefore goes through ten states, 0 to 9, and Q3 gives one output pulse for every ten input pulses – a decade counter, used in frequency counters, digital clocks and displays (with BCD-to-seven-segment decoders).

✓ Checked step by step We checked the race condition and the counting sequence with its reset step by step.

↑ Back to the question list

Simplify the logical expression AB+A¯B¯+ABC using a Karnaugh map.

2011 · Paper II · Q5f · 10 marks

Solution

Y=AB+A‾B‾+ABC. Karnaugh map (rows A, columns BC in Gray code 00, 01, 11, 10):

B‾C‾ B‾C BC BC‾
A‾ 1 1 0 0
A 0 0 1 1

(A‾B‾ gives 1s in the two left cells of the top row; AB and ABC give 1s in the two right cells of the bottom row.)

Grouping. The two 1s of the top row form a pair (A‾B‾, C eliminated); the two 1s of the bottom row form a pair (AB, C eliminated). The term ABC is already covered. Y=AB+A‾B‾=A⊕B¯ – an XNOR (equality) function of A and B; C is irrelevant. (Algebraically, AB+ABC=AB(1+C)=AB.)

✓ Checked by computer We checked the Karnaugh-map result against the full truth table in code.

↑ Back to the question list

Simplify the logical expression (A+B¯)¯B(A+C¯) and draw the logical circuit to implement it.

2011 · Paper II · Q8b · 15 marks

Solution

Y=(A+B‾)¯⋅B⋅(A+C‾). By De Morgan, A+B‾¯=A‾B‾‾=A‾B. So Y=A‾B⋅B⋅(A+C‾)=A‾B(A+C‾), (BB=B) =A‾BA+A‾BC‾=0+A‾BC‾. Y=A‾BC‾ Circuit: invert A and C and feed A‾, B, C‾ to a three-input AND gate (Y = 1 only for A = 0, B = 1, C = 0).

ABCY = ABC
Logic circuit for Y = ĀBC̄

✓ Checked by computer We checked the simplification against the full truth table in code.

↑ Back to the question list

Why NAND and NOR gates are called universal gates? Give the logic diagram, Boolean equation and the truth table of a NAND gate. Design an OR gate using only NAND gates.

2010 · Paper II · Q8c · 15 marks

Solution

ANDY = A·BORY = A + BNOTY = ĀNANDY = A·BNORY = A + BXORY = A ⊕ B
Symbols of the basic gates

Basic gates (two inputs A, B; output Y).

A B AND AB OR A+B NAND AB¯ NOR A+B¯ XOR A⊕B
0 0 0 0 1 1 0
0 1 0 1 1 0 1
1 0 0 1 1 0 1
1 1 1 1 0 0 0

NOT: Y=A‾ (A = 0 gives 1; A = 1 gives 0).

  • AND: output 1 only if all inputs are 1 (Y=A⋅B).
  • OR: output 1 if any input is 1 (Y=A+B).
  • NOT: output is the complement of the input (Y=A‾).
  • NAND (NOT-AND): Y=A⋅B¯ – output 0 only when all inputs are 1.
  • NOR (NOT-OR): Y=A+B¯ – output 1 only when all inputs are 0.

Exclusive-OR (XOR). Output 1 when the inputs are different, 0 when they are the same: Y=A⊕B=AB‾+A‾B. It can be built from AND, OR and NOT gates (two ANDs fed with AB‾ and A‾B, followed by an OR), or from four NAND gates (below). It acts as an inequality detector, a controlled inverter and a modulo-2 adder (the sum output of a half adder); its complement is XNOR (equality).

Why NAND and NOR are universal gates. Any Boolean function can be written using AND, OR and NOT. Each of these can be built from NAND gates alone, or from NOR gates alone, so either type by itself can realise any logic circuit. (This simplifies manufacture: a whole IC can be made of one kind of gate.)

NOTAĀAĀANDABA·BABA·BORABA+BABA+Bwith NAND gateswith NOR gates
NOT, AND and OR made only from NAND gates (left) and only from NOR gates (right)

With NAND gates:

  • NOT: tie the inputs together, A⋅A¯=A‾.
  • AND: NAND followed by a NAND inverter, AB¯¯=AB.
  • OR: invert each input with a NAND, then NAND them: A‾⋅B‾¯=A+B (De Morgan). This is the required OR gate using only NAND gates (three gates).

With NOR gates:

  • NOT: A+A¯=A‾.
  • OR: NOR followed by a NOR inverter, A+B¯¯=A+B.
  • AND: invert each input with a NOR, then NOR them: A‾+B‾¯=AB.

XOR using only NAND gates (four gates):

ABY₁Y₂Y₃Y = A ⊕ B1234
Exclusive-OR from four NAND gates

Y1=AB¯, Y2=AY1¯, Y3=BY1¯, Y=Y2Y3¯. Then Y=AY1+BY1=(A+B)AB¯ =(A+B)(A‾+B‾)=AB‾+A‾B.

✓ Checked step by step We checked every truth table and each NAND/NOR construction by evaluating all input combinations.

↑ Back to the question list

Verify that the circuit shown below is an exclusive OR.

[Figure: Logic circuit of four two-input NAND gates with inputs A and B and output Y. Gate 1 has inputs A and B; its output is labelled Y1. Gate 2 (upper) has inputs A and Y1; its output is labelled Y2. Gate 3 (lower) has inputs Y1 and B; its output is labelled Y3. Gate 4 has inputs Y2 and Y3; its output is Y.]

2009 · Paper II · Q5e · 10 marks

Solution

Label the gate outputs as in the figure: Y1=AB¯, Y2=AY1¯,Y3=Y1B¯,Y=Y2Y3¯. By De Morgan, Y=Y2Y3¯=Y‾2+Y‾3=AY1+BY1. Hence Y=(A+B)AB¯ =(A+B)(A‾+B‾) =AA‾+AB‾+A‾B+BB‾ =AB‾+A‾B=A⊕B. Truth table check:

A B Y1 Y2 Y3 Y
0 0 1 1 1 0
0 1 1 1 0 1
1 0 1 0 1 1
1 1 0 1 1 0

Y is 1 exactly when the inputs differ, so the circuit is an exclusive-OR gate.

ABY₁Y₂Y₃Y = A ⊕ B1234
The four-NAND exclusive-OR

✓ Proof checked step by step We evaluated the four-NAND circuit for all four input pairs in code.

↑ Back to the question list

Simplify the equation: Y=[AB‾(C+BD)+AB¯C] using Boolean algebra Give the logic circuit for the equation before and after the simplification.

2007 · Paper II · Q5c(i) · 10 marks

Solution

Y=AB‾(C+BD)+AB¯C. Expand: AB‾(C+BD)=AB‾C+AB‾BD=AB‾C. By De Morgan AB¯=A‾+B‾: Y=AB‾C+(A‾+B‾)C =AB‾C+A‾C+B‾C. AB‾C is covered by B‾C (absorption, B‾C+AB‾C=B‾C): Y=A‾C+B‾C=(A‾+B‾)C Y=AB¯⋅C D is redundant. The original needs an inverter, three ANDs (one with three inputs), a NAND and two ORs; the simplified form needs just a NAND gate and an AND gate.

ABCDYbeforeABCY = AB·Cafter
Circuit before and after simplification

(If the second term is read as A‾B‾C instead of AB¯C, the result is Y=B‾C, as in the 2015 question.)

✓ Checked by computer We checked the simplification against the full truth table in code.

↑ Back to the question list

Give the Boolean expression and the truth table for an XOR gate. Why are NAND gates called universal gates? Realise OR and XOR gates employing only NAND gates.

2007 · Paper II · Q8b · 15 marks

Solution

ANDY = A·BORY = A + BNOTY = ĀNANDY = A·BNORY = A + BXORY = A ⊕ B
Symbols of the basic gates

Basic gates (two inputs A, B; output Y).

A B AND AB OR A+B NAND AB¯ NOR A+B¯ XOR A⊕B
0 0 0 0 1 1 0
0 1 0 1 1 0 1
1 0 0 1 1 0 1
1 1 1 1 0 0 0

NOT: Y=A‾ (A = 0 gives 1; A = 1 gives 0).

  • AND: output 1 only if all inputs are 1 (Y=A⋅B).
  • OR: output 1 if any input is 1 (Y=A+B).
  • NOT: output is the complement of the input (Y=A‾).
  • NAND (NOT-AND): Y=A⋅B¯ – output 0 only when all inputs are 1.
  • NOR (NOT-OR): Y=A+B¯ – output 1 only when all inputs are 0.

Exclusive-OR (XOR). Output 1 when the inputs are different, 0 when they are the same: Y=A⊕B=AB‾+A‾B. It can be built from AND, OR and NOT gates (two ANDs fed with AB‾ and A‾B, followed by an OR), or from four NAND gates (below). It acts as an inequality detector, a controlled inverter and a modulo-2 adder (the sum output of a half adder); its complement is XNOR (equality).

Why NAND and NOR are universal gates. Any Boolean function can be written using AND, OR and NOT. Each of these can be built from NAND gates alone, or from NOR gates alone, so either type by itself can realise any logic circuit. (This simplifies manufacture: a whole IC can be made of one kind of gate.)

NOTAĀAĀANDABA·BABA·BORABA+BABA+Bwith NAND gateswith NOR gates
NOT, AND and OR made only from NAND gates (left) and only from NOR gates (right)

With NAND gates:

  • NOT: tie the inputs together, A⋅A¯=A‾.
  • AND: NAND followed by a NAND inverter, AB¯¯=AB.
  • OR: invert each input with a NAND, then NAND them: A‾⋅B‾¯=A+B (De Morgan). This is the required OR gate using only NAND gates (three gates).

With NOR gates:

  • NOT: A+A¯=A‾.
  • OR: NOR followed by a NOR inverter, A+B¯¯=A+B.
  • AND: invert each input with a NOR, then NOR them: A‾+B‾¯=AB.

XOR using only NAND gates (four gates):

ABY₁Y₂Y₃Y = A ⊕ B1234
Exclusive-OR from four NAND gates

Y1=AB¯, Y2=AY1¯, Y3=BY1¯, Y=Y2Y3¯. Then Y=AY1+BY1=(A+B)AB¯ =(A+B)(A‾+B‾)=AB‾+A‾B.

✓ Checked step by step We checked every truth table and each NAND/NOR construction by evaluating all input combinations.

↑ Back to the question list

Cover of the UPSC Mains Topic-wise and Year-wise PYQs book (2013–2026)

From the Optional Province team

Strengthen your GS papers

Our UPSC Mains Topic-wise & Year-wise PYQ Book (2013–2026) maps every GS question to the syllabus, so you know what UPSC asks and how often. Now available as a hard copy and an eBook.

Buy Hard Copy on AmazonBuy eBook (PDF)

Download a free sample

Simplify the logical expression f=ABC+BC‾D+A‾BC by using Karnaugh map and realise f using NAND gates only.

2006 · Paper II · Q5c(i) · 10 marks

Solution

f=ABC+BC‾D+A‾BC. Karnaugh map (rows AB, columns CD, Gray code):

C‾D‾ C‾D CD CD‾
A‾B‾ 0 0 0 0
A‾B 0 1 1 1
AB 0 1 1 1
AB‾ 0 0 0 0

(ABC and A‾BC fill the CD and CD‾ columns of the B-rows; BC‾D fills the C‾D column of the B-rows.)

Groups: the quad in columns CD, CD‾ of rows A‾B, AB gives BC; the quad in columns C‾D, CD of the same rows gives BD. f=BC+BD=B(C+D) NAND-only realisation. By double complementation and De Morgan, f=BC+BD¯¯=BC¯⋅BD¯¯: two NAND gates form BC¯ and BD¯, and a third NAND combines them.

CDBf = BC + BD
NAND realisation of f = BC + BD

✓ Checked by computer We checked the Karnaugh-map result against the full truth table in code.

↑ Back to the question list

Draw the logic circuit for the following Boolean expression: Y=A+B¯+C¯ What are the ‘Y’ values for the input combinations: (1) 1, 1, 0; (2) 1, 0, 1; (3) 0, 0, 1?

2005 · Paper II · Q5c(i) · 12 marks

Solution

Y=A+B¯+C‾. Circuit: a NOR gate on A and B, an inverter on C, and an OR gate combining their outputs.

ABCY
Logic circuit for Y = (A + B)‾ + C̄
A, B, C A+B¯ C‾ Y
(1) 1, 1, 0 0 1 1
(2) 1, 0, 1 0 0 0
(3) 0, 0, 1 1 0 1

(Equivalently Y=(A+B)C¯, a NAND of (A+B) and C.)

✓ Checked by computer We evaluated the expression for the three input combinations in code.

↑ Back to the question list

Give the two forms of the De Morgan’s theorem.

2004 · Paper II · Q8b · 10 marks

Solution

De Morgan’s theorems.

  1. The complement of a product equals the sum of the complements: A⋅B¯=A‾+B‾.
  2. The complement of a sum equals the product of the complements: A+B¯=A‾⋅B‾. They extend to any number of variables: ABC⋯¯=A‾+B‾+C‾+⋯ and A+B+C+⋯¯=A‾B‾C‾⋯.

Proof by truth table (first form):

A B AB¯ A‾+B‾
0 0 1 1
0 1 1 1
1 0 1 1
1 1 0 0

(the second form follows in the same way). In gate terms: a NAND gate is equivalent to an OR gate with inverted inputs, and a NOR gate to an AND gate with inverted inputs (“break the bar, change the sign”). The theorems are used to simplify expressions and to convert circuits to all-NAND or all-NOR form.

✓ Checked step by step We checked both forms on all input combinations.

↑ Back to the question list

What is the principle used in ‘half-adder’? Give the truth table for it.

2004 · Paper II · Q8c · 20 marks

Solution

Principle of the half adder. Binary addition of two bits follows the rules 0+0=0,0+1=1, 1+0=1,1+1=102. The result needs two output bits: the sum S (the bit in the same column) and the carry C (the bit passed to the next column). A half adder adds two single bits A and B (it has no carry input, hence “half”).

(i) Truth (math) table for adding two bits.

A B Sum S Carry C
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1

(ii) Boolean expressions (from the rows where each output is 1): S=A‾B+AB‾,C=AB. (iii) Exclusive-OR. The sum is 1 when exactly one input is 1 – this is the exclusive-OR function: S=A‾B+AB‾=A⊕B. (Equivalently S=(A+B)AB¯: “A or B, but not both”.)

(iv) Logic diagram. An XOR gate gives the sum and an AND gate the carry, both fed from A and B.

ABS = A ⊕ BC = A·B
Half adder

To add multi-bit numbers held in two registers, a half adder is used for the least significant bits and full adders (each made of two half adders and an OR gate) for the higher bits, the carry rippling from column to column.

✓ Checked step by step We checked the half-adder truth table and its XOR derivation step by step.

↑ Back to the question list

Explain the operation of the following circuit is a gate. Draw the truth table and find the operation carried out by this gate neglecting the source impedance.

[Figure: Diode–transistor logic gate. Three inputs A, B and C, each connected through a diode D to a common node P; the diodes are drawn with their cathodes towards the inputs (anodes at P). An input waveform stepping from 0 V up to 12 V is drawn beside the inputs. Node P is connected to +12V through a 15K resistor. From P a resistor R1 (15K), shunted by a speed-up capacitor C1, goes to the base of transistor Q; the base is also connected to −12V through a 100 K resistor. Q is an npn transistor with its emitter to ground and its collector (C) connected to +12 V through a 2.2 K resistor; the output Y is taken from the collector.]

junction saturation voltages and diode voltages in forward direction. Find the minimum value of hfe.

2003 · Paper II · Q5c · 20 marks

Solution

Operation. This is a diode–transistor logic (DTL) gate. Neglect the diode forward drops and the transistor’s junction voltages, as instructed.

Any input LOW (0 V): the diode connected to that input is forward biased, so node P is clamped to about 0 V. The base then sees a divider between P (0 V) through 15 kΩ and −12 V through 100 kΩ: VB=−12×15115=−1.6V. The base–emitter junction is reverse biased, Q is cut off, and the output is Y=+12 V (HIGH, 1).

All inputs HIGH (+12 V): all diodes are reverse biased (P cannot exceed +12 V). Current flows from +12 V through the 15 kΩ resistor and R1 (15 kΩ) into the base, which is near 0 V: I1=1215+15kΩ=0.40mA. Part of it goes to −12 V through 100 kΩ: I2=12100kΩ=0.12mA. The base current is IB=0.40−0.12=0.28 mA. Q saturates and Y≈0 V (LOW, 0).

Truth table (positive logic, 1 = +12 V):

A B C Y
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 0

The diodes with the pull-up resistor form an AND gate and the transistor an inverter: the circuit is a three-input NAND gate, Y=ABC¯. The capacitor C1 is a speed-up capacitor for faster switching.

Minimum hfe. In saturation the collector current is IC(sat)=12V2.2kΩ=5.45mA. For saturation, hfeIB≥IC(sat): hfe(min)=5.450.28=19.5≈20.

✓ Checked by computer We computed the base currents in the two input states and the minimum h_fe in code.

↑ Back to the question list

Show that a negative logic OR gate is like a positive logic AND gate.

2002 · Paper II · Q5d(i) · 10 marks

Solution

In positive logic the higher voltage represents 1 (H = 1, L = 0); in negative logic the lower voltage represents 1 (L = 1, H = 0).

Consider a gate whose voltage table is that of a positive-logic AND gate: the output is H only when both inputs are H.

A B Y (voltages) Positive logic Negative logic
L L L 0 0 → 0 1 1 → 1
L H L 0 1 → 0 1 0 → 1
H L L 1 0 → 0 0 1 → 1
H H H 1 1 → 1 0 0 → 0

Read in negative logic, the output is 0 only when both inputs are 0 and 1 otherwise – the OR function. So the same physical gate is a positive-logic AND and a negative-logic OR: a negative-logic OR gate is like a positive-logic AND gate (and likewise a negative-logic AND is a positive-logic OR). This is the duality principle: changing from positive to negative logic complements every variable, and by De Morgan A‾+B‾¯=AB.

✓ Proof checked step by step We checked the equivalence by comparing the two truth tables row by row.

↑ Back to the question list

Combinational switching circuit can perform an addition of the numbers held in two registers. (i) Write down the math table for the addition of two bits. (ii) Write down a Boolean expression for the necessary circuit functions. (iii) Arrive at the Exclusive-OR function. (iv) Draw the logic diagram for the circuit which performs the addition.

2001 · Paper II · Q8a · 10 marks

Solution

Principle of the half adder. Binary addition of two bits follows the rules 0+0=0,0+1=1, 1+0=1,1+1=102. The result needs two output bits: the sum S (the bit in the same column) and the carry C (the bit passed to the next column). A half adder adds two single bits A and B (it has no carry input, hence “half”).

(i) Truth (math) table for adding two bits.

A B Sum S Carry C
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1

(ii) Boolean expressions (from the rows where each output is 1): S=A‾B+AB‾,C=AB. (iii) Exclusive-OR. The sum is 1 when exactly one input is 1 – this is the exclusive-OR function: S=A‾B+AB‾=A⊕B. (Equivalently S=(A+B)AB¯: “A or B, but not both”.)

(iv) Logic diagram. An XOR gate gives the sum and an AND gate the carry, both fed from A and B.

ABS = A ⊕ BC = A·B
Half adder

To add multi-bit numbers held in two registers, a half adder is used for the least significant bits and full adders (each made of two half adders and an OR gate) for the higher bits, the carry rippling from column to column.

✓ Checked step by step We checked the half-adder truth table and its XOR derivation step by step.

↑ Back to the question list

(i) What are sequential switching circuits (ii) Describe a simple sequential circuit. (iii) Describe a clocked RS Flip-Flop, (iv) Briefly describe ROMs.

2001 · Paper II · Q8b · 40 marks

Solution

(i) Sequential switching circuits. In a combinational circuit the outputs depend only on the present inputs. In a sequential circuit the outputs depend on the present inputs and on the past history – the circuit has memory, provided by storage elements (latches, flip-flops) and feedback. Its behaviour is described by a state table or state diagram. Examples: flip-flops, registers, counters, sequence detectors, memories.

(ii) A simple sequential circuit – the SR latch. Two NOR (or NAND) gates cross-coupled, the output of each fed back to an input of the other. With S=R=0 it holds whichever state it is in (memory); S=1 sets Q=1; R=1 resets Q=0; S=R=1 is not allowed. It stores one bit.

(iii) Clocked RS flip-flop.

SRCLKQQ
Clocked RS flip-flop made from NAND gates

Two NAND gates “steer” S and R into a NAND latch only while the clock is HIGH. When CLK = 0 both steering gates give 1 and the latch holds its state, whatever S and R do. When CLK = 1:

S R Qn+1
0 0 Qn (no change)
0 1 0 (reset)
1 0 1 (set)
1 1 indeterminate (forbidden)

The clock synchronises many flip-flops in a system so that they change state only at defined times. (Practical versions are edge triggered; the JK and D flip-flops remove the forbidden state.)

(iv) Read-only memories (ROMs). A ROM stores fixed binary data that can be read but not changed in normal operation; it is non-volatile (keeps its data without power). It consists of an address decoder that selects one of 2n word lines from an n-bit address, and an array of cells (diodes or transistors present or absent at the crossings) that put the stored word on the output bit lines. Any combinational function can be stored as a look-up table. Types: mask ROM (programmed during manufacture), PROM (fuses blown once by the user), EPROM (erasable by UV light), EEPROM and Flash (electrically erasable). Uses: firmware and BIOS, microprogram stores, look-up tables, code converters and character generators.

✓ Checked step by step We checked the descriptions of the clocked RS flip-flop and of ROMs step by step.

↑ Back to the question list

A circuit of a NOT gate is given in the figure below. Explain how you will determine the values of the resistances RB, R and RL.

[Figure: Single-transistor (npn, common-emitter) NOT gate. Input vin: a rectangular pulse of height 5 V applied between ground (o) and the input terminal; input connected through series resistor RB to the base. From the base node a resistor R goes down to a –5 V supply. Collector connected through load resistor RL to the +5 V supply; output vo taken from the collector. Emitter (arrow outward) connected to ground.]

2000 · Paper II · Q1d · 20 marks

Solution

The transistor works as a switch: input 0 V must make it cut off (vo=+5 V), and input 5 V must make it saturate (vo≈VCE(sat)≈0.2 V). The resistor R to −5 V ensures firm cut-off.

1. Choose RL from the allowed collector current in saturation (and the fan-out and speed needed). For IC(sat)≈5 mA: RL=VCC−VCE(sat)IC(sat)=5−0.25mA≈1kΩ. A smaller RL gives faster switching and higher fan-out but more power.

2. Choose RB and R for saturation when vin=5 V. The base current is the current through RB minus that through R: IB=5−VBERB−VBE+5R≥IC(sat)hFE(min) (usually with a safety factor of 1.5–2 for overdrive).

3. Check cut-off when vin=0: with no transistor current the base voltage is set by the divider between 0 V and −5 V: VB=−5×RBRB+R which must stay below about 0 V even when the collector leakage ICBO (maximum temperature) flows out through RB∥R, i.e. VB+ICBO(RB∥R)<0 with some margin.

Example. RL=1 kΩ, RB=15 kΩ, R=100 kΩ, VBE=0.7 V: IB=4.315k−5.7100k =0.287−0.057=0.23mA, which saturates the transistor (IC=4.8 mA) if hFE≥21 – comfortably met by a switching transistor with hFE≈50. At vin=0: VB=−5×15/115=−0.65 V, so the transistor is firmly off. A speed-up capacitor across RB may be added.

✓ Checked by computer We checked the saturation and cut-off conditions for a sample design in code.

↑ Back to the question list

Simplify the given Boolean expression and draw the corresponding logic circuit using NAND gates: Y=(A¯+B+C).(A¯+B¯+C)

1999 · Paper II · Q1d · 20 marks

Solution

Y=(A‾+B+C)(A‾+B‾+C). Let X=A‾+C. Then Y=(X+B)(X+B‾)=X+BB‾=X (distributive law). Y=A‾+C NAND realisation. A‾+C=A⋅C‾¯ (De Morgan), so one NAND gate makes C‾ (inputs tied) and a second NAND gate combines A and C‾: Y=A⋅C⋅C¯¯.

ACCY = A + C
NAND realisation of Y = Ā + C

✓ Checked by computer We checked the simplification against the full truth table in code.

↑ Back to the question list

Simplify the following logic function and draw the corresponding logic diagram:- Y=(A+B).(A+C).(B+C)

1998 · Paper II · Q4b · 20 marks

Solution

Y=(A+B)(A+C)(B+C). First, (A+B)(A+C)=A+BC (distributive law, A+AC+AB=A). Then Y=(A+BC)(B+C) =AB+AC+BCB+BCC =AB+AC+BC. Y=AB+BC+CA This is the majority function: Y = 1 when at least two of the three inputs are 1 (it is also the carry of a full adder). It needs three two-input AND gates and a three-input OR gate.

ABCY = AB + BC + CA
Logic circuit for Y = AB + BC + CA

✓ Checked by computer We checked the simplification against the full truth table in code.

↑ Back to the question list

Simplify the following logic function and draw the corresponding logic gates: Y=A.B+B.C¯+A¯.B+A¯.C+B¯.C+A¯.B¯.C¯+A.B.C.

1997 · Paper II · Q4b · 30 marks

Solution

Y=AB+BC‾+A‾B +A‾C+B‾C+A‾B‾C‾+ABC.

  1. AB+A‾B=B; then B+BC‾+ABC=B (absorption). Y=B+A‾C+B‾C+A‾B‾C‾.
  2. B+B‾C=B+C; then C+A‾C=C: Y=B+C+A‾B‾C‾.
  3. B+C+A‾B‾C‾: the last term matters only when B=C=0, where it equals A‾. So Y=A‾+B+C=AB‾C‾¯ Y is 0 only for A = 1, B = 0, C = 0. Circuit: an inverter on A and a three-input OR gate (or, equivalently, a three-input NAND of A, B‾ and C‾).
ABCY = A + B + C
Logic circuit for Y = Ā + B + C

✓ Checked by computer We checked the simplification against the full truth table in code.

↑ Back to the question list

Define ex-OR. Give its truth table and draw the possible logic blocks.

1996 · Paper II · Q4a · 30 marks

Solution

ANDY = A·BORY = A + BNOTY = ĀNANDY = A·BNORY = A + BXORY = A ⊕ B
Symbols of the basic gates

Basic gates (two inputs A, B; output Y).

A B AND AB OR A+B NAND AB¯ NOR A+B¯ XOR A⊕B
0 0 0 0 1 1 0
0 1 0 1 1 0 1
1 0 0 1 1 0 1
1 1 1 1 0 0 0

NOT: Y=A‾ (A = 0 gives 1; A = 1 gives 0).

  • AND: output 1 only if all inputs are 1 (Y=A⋅B).
  • OR: output 1 if any input is 1 (Y=A+B).
  • NOT: output is the complement of the input (Y=A‾).
  • NAND (NOT-AND): Y=A⋅B¯ – output 0 only when all inputs are 1.
  • NOR (NOT-OR): Y=A+B¯ – output 1 only when all inputs are 0.

Exclusive-OR (XOR). Output 1 when the inputs are different, 0 when they are the same: Y=A⊕B=AB‾+A‾B. It can be built from AND, OR and NOT gates (two ANDs fed with AB‾ and A‾B, followed by an OR), or from four NAND gates (below). It acts as an inequality detector, a controlled inverter and a modulo-2 adder (the sum output of a half adder); its complement is XNOR (equality).

Why NAND and NOR are universal gates. Any Boolean function can be written using AND, OR and NOT. Each of these can be built from NAND gates alone, or from NOR gates alone, so either type by itself can realise any logic circuit. (This simplifies manufacture: a whole IC can be made of one kind of gate.)

NOTAĀAĀANDABA·BABA·BORABA+BABA+Bwith NAND gateswith NOR gates
NOT, AND and OR made only from NAND gates (left) and only from NOR gates (right)

With NAND gates:

  • NOT: tie the inputs together, A⋅A¯=A‾.
  • AND: NAND followed by a NAND inverter, AB¯¯=AB.
  • OR: invert each input with a NAND, then NAND them: A‾⋅B‾¯=A+B (De Morgan). This is the required OR gate using only NAND gates (three gates).

With NOR gates:

  • NOT: A+A¯=A‾.
  • OR: NOR followed by a NOR inverter, A+B¯¯=A+B.
  • AND: invert each input with a NOR, then NOR them: A‾+B‾¯=AB.

XOR using only NAND gates (four gates):

ABY₁Y₂Y₃Y = A ⊕ B1234
Exclusive-OR from four NAND gates

Y1=AB¯, Y2=AY1¯, Y3=BY1¯, Y=Y2Y3¯. Then Y=AY1+BY1=(A+B)AB¯ =(A+B)(A‾+B‾)=AB‾+A‾B.

✓ Checked step by step We checked every truth table and each NAND/NOR construction by evaluating all input combinations.

↑ Back to the question list

More on Solid State Physics, Devices and Electronics

Questions: UPSC Civil Services (Main) Examination, Physics Paper II, 1996–2024. Solutions: Optional Province. Found an error? Tell us.

Spotted an error? Tell us.

We classify every PYQ with care, but mistakes can slip in. If a question is in the wrong topic, has a typo, the wrong year, or is missing, let us know. We review every report and update the page.

Report an Error
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted