All 23 questions UPSC has asked on Boolean algebra and logic gates in the Electrical Engineering Optional (Paper I, Digital Electronics) from 1997 to 2023, solved step by step – latest first.
Try them yourself first: the same questions, without solutions, are on our Digital Electronics topic-wise PYQs page. Circuit diagrams have been redrawn from the question papers.
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 were worked out again independently in code (SymPy and NumPy: circuit equations, power balance, matrices, integrals).
- ✓ Proof checked step by step or ✓ Derivation checked step by step for “prove” and “derive” questions, every step was checked against the definitions and standard results.
Where a printed question is wrong, unclear or incomplete, we say so and solve the intended version.
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):
2023 · 4b 2021 · 1e 2020 · 2c 2019 · 5b 2019 · 7d 2018 · 2a 2017 · 2a 2017 · 5a 2016 · 5a 2015 · 5e 2014 · 6b 2013 · 6a 2013 · 6c 2012 · 5b 2011 · 6a 2009 · 7a(i) 2007 · 5b(ii) 2006 · 6a(iii) 2002 · 3a 2001 · 1b 1999 · 5b(i) 1998 · 2c 1997 · 5a
Consider the control circuitry of a machine copier with four switches as shown below in the figure. These switches are at various points along the path of the machine. Each switch is normally open and closes only when the paper passes over it. Let there be a restriction that switch 1 and switch 4 cannot close simultaneously. Use Karnaugh map to design a logic circuit that produces a high output whenever two or more switches are closed at the same time.
Solution
Note. Each input line is pulled up to 5 V and a closed switch connects it to ground. So a line reads 0 when its switch is closed (active-low). We first design in terms of “switch closed” variables and then translate to the line voltages A, B, C, D seen by the logic circuit.
Variables. Let when SW1, SW2, SW3, SW4 is closed. Since SW1 and SW4 can never close together, every state with is a don’t care (×). The output is 1 when two or more switches are closed.
Groups. Using the × cells, we get five quads: , , , , .
In terms of the line voltages. With , , , : So the circuit needs one NOR, two NANDs, one AND and one OR:
✓ Checked by computer We checked the map, the don’t-cares and the final circuit against all 16 switch states in code.
Consider the four variables logic function defined as follows: Assuming input variables as A, B, C and D, propose a logic circuit using only three logic gates to implement the function.
Solution
Regrouping the function. Write and . Then and , so
Three-gate circuit. One 2-input AND gives , one 2-input OR gives , and one XOR combines them.
✓ Checked by computer We checked the XOR form against the given function on all 16 inputs in code.
Design a combinational circuit to implement the minimal sum-of-products of the logic function .
Solution
Karnaugh map. The ones are at 1, 2, 3, 5, 7, 11, 13.
Groups.
- (quad 1, 3, 5, 7).
- (pair 2, 3): the only group covering 2.
- (pair 3, 11): the only group covering 11.
- (pair 5, 13): the only group covering 13.
All four are essential, so the minimal sum of products is
Circuit. Inverters for , four AND gates and a 4-input OR.
✓ Checked by computer We found every minimum cover by exhaustive search in code.
Simplify the following expression using Boolean algebra: and draw the logic diagram for reduced expression.
Solution
Simplification.
Logic diagram. One 2-input AND and one 2-input OR.
✓ Checked by computer We checked the reduced expression on all eight inputs in code.
Reduce the combinational logic circuit shown in Figure 7(d) to a minimum form.
Solution
Reduction. The first AND gives . After the inverter, the node carries The AND gate with a single input simply passes . So the OR gate receives , and :
Minimum form. The whole circuit is a single 4-input OR gate, .
✓ Derivation checked step by step We checked the reduction step by step.
Convert the following logic equation to NAND logic and draw the circuit using NAND gates:
Solution
Simplify first.
NAND form. Double inversion and De Morgan: So is a NAND of and . The inverters are NAND gates with tied inputs.
Four NAND gates in all: two as inverters (for and ), one for , and the output gate.
✓ Checked by computer We checked the reduced form and the NAND circuit on all inputs in code.
For the Boolean function (i) find all the prime implicants; (ii) give minimal representation; (iii) find minimal two-level realization using NAND gates only.
Solution
(i) Prime implicants. The ones are at 0, 2, 5, 6, 7, 8, 10, 13.
| Prime implicant | Minterms |
|---|---|
| 0, 2, 8, 10 | |
| 5, 13 | |
| 6, 7 | |
| 5, 7 | |
| 2, 6 |
(ii) Minimal representation. (only cover of 0, 8, 10) and (only cover of 13) are essential. They leave 6 and 7, which covers in one term: This cover is unique.
(iii) Two-level NAND realization. An AND–OR sum of products becomes NAND–NAND directly:
✓ Checked by computer We listed the prime implicants and searched all covers in code.
Prove that .
Solution
To prove: .
Proof. Multiply the third term by : since and .
This is the consensus theorem: is the consensus of and , so it is redundant.
✓ Proof checked step by step We checked the proof step by step.
Minimize the SOP terms given for a Boolean function Implement the minimized function using NAND gates alone.
Solution
Karnaugh map. The ones are at 2, 3, 8, 10, 11, 12, 14, 15.
Groups.
- : 10, 11, 14, 15.
- : 8, 10, 12, 14.
- : 2, 3, 10, 11.
All three quads are essential:
NAND-only circuit (two levels). The inverters for and are NAND gates with their inputs tied.
✓ Checked by computer We checked the minimum cover by exhaustive search in code.
Obtain all the possible minimal functions for: .
Solution
Note. The function has minterms up to 7, so we take three variables A, B, C (A most significant).
Prime implicants. The ones are at 0, 2, 3, 4, 5, 7. Every 1 has exactly two neighbouring ones, so the ones form a ring and there are six prime implicants (all pairs): (2, 3), (0, 2), (4, 5), (5, 7), (0, 4), (3, 7).
None is essential: each minterm is covered by two of them. We need three pairs to cover six minterms, and there are exactly two ways to do it:
Both use three 2-literal terms and are equally minimal.
✓ Checked by computer We listed all prime implicants and all minimum covers in code.
(i) Find 2’s complement of the following numbers: (1) 10010010 (2) 11011000 (ii) Convert the logical equation into product-of-sums (POS) form and design circuits using (1) OR and AND gates and (2) NOR gates. (iii) Explain the function of Schottky diode connected between the collector and base of transistors of TTL gate.
Solution
(i) 2’s complements (invert all bits and add 1):
| Number | 1’s complement | 2’s complement |
|---|---|---|
| 10010010 | 01101101 | 01101110 |
| 11011000 | 00100111 | 00101000 |
(ii) Simplify, then the POS form. is the consensus of and , so For the POS form, use with : Check: , which equals .
(1) With OR and AND gates.
(2) With NOR gates only. POS maps directly onto NOR–NOR:
The inverter for can itself be a NOR gate with its inputs tied, so the circuit uses NOR gates only.
(iii) Schottky diode between base and collector (Schottky TTL). The Schottky diode has a forward drop of about 0.3 V, against 0.7 V for the base–collector junction. When the transistor is driven hard, the excess base current is diverted through the diode into the collector, so the collector–base junction is clamped at about 0.3 V and never becomes strongly forward biased. The transistor never enters deep saturation, so no excess charge is stored in the base. The storage time disappears and the turn-off delay drops sharply. This is why 74S and 74LS gates are much faster than standard 74-series TTL (about 3 ns against 10 ns propagation delay), at the cost of a slightly higher .
✓ Checked by computer We checked the complements and both circuits against the given expression in code.
Determine the MSP form of the switching function using 6-variable Karnaugh map.
Solution
Arrangement. We take u as the most significant variable and z as the least. A 6-variable map is four 4-variable maps (in w, x, y, z), one for each value of uv, laid out so that side-by-side and one-above-the-other maps differ in only u or v. Cells in the same position on such neighbouring maps are adjacent.
Groups.
- (teal): cells on all four maps, a group of 16 (0, 1, 4, 5, 16, 17, 20, 21, 32, 33, 36, 37, 48, 49, 52, 53).
- (red): cells 0110 and 1110 on the uv = 00 and 01 maps (6, 14, 22, 30).
- (gold): cells 1011 and 1111 on the uv = 00 map (11, 15).
- (purple): cells 1011 and 1111 on the uv = 11 map (59, 63).
Each group is essential, and together they cover all 24 minterms. The minimum sum of products is
✓ Checked by computer We found every minimum cover of the 24 minterms by exhaustive search in code.
Assuming that logic 0 is available, show that the INCLUSION gate is a universal building block.
Solution
Note. We read the INCLUSION gate as the implication gate, (output 0 only for ; “A is included in B”).
A set of gates is universal if it can make NOT, AND and OR. With logic 0 available:
NOT. .
OR. , so
AND. By De Morgan, . Now , so
| A | B | |||
|---|---|---|---|---|
| 0 | 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 | 1 |
NOT, OR and AND all come from the inclusion gate and the constant 0, so it is a universal building block. (Without the constant 0, NOT cannot be made: .)
✓ Checked by computer We checked each derived gate against its truth table in code.
Convert decimal 65,535 to its hexadecimal and binary.
Solution
Hexadecimal. Divide repeatedly by 16: All four remainders are 15 (F), so
Binary. Each hex F is 1111: Check: , the largest 16-bit number, which is sixteen ones.
✓ Checked by computer We checked both conversions in code.
Convert decimal number 40 into binary and hexadecimal numbers.
Solution
Binary. Divide repeatedly by 2 and read the remainders upwards:
| Division | Quotient | Remainder |
|---|---|---|
| 40 ÷ 2 | 20 | 0 |
| 20 ÷ 2 | 10 | 0 |
| 10 ÷ 2 | 5 | 0 |
| 5 ÷ 2 | 2 | 1 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Hexadecimal. Group the bits in fours from the right: . Check: .
✓ Checked by computer We checked both conversions in code.
Design a combinational logic circuit which produces an output equal to ‘1’ if the input variables have more 1’s in the sequence than 0’s. The output is zero otherwise. Design the circuit for three variable inputs. Draw the realization.
Solution
Truth table. With three inputs, “more 1s than 0s” means two or three 1s (a majority circuit).
| A | B | C | F |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |
Simplification. . On a map, minterm 7 pairs with each of 3, 5 and 6:
Realization. Three 2-input AND gates and one 3-input OR.
✓ Checked by computer We checked the circuit on all eight inputs in code.
Implement an OR gate with AND and NOT gates.
Solution
Using De Morgan’s theorem. So we invert A and B, AND them, and invert the result. This needs one AND gate and three NOT gates.
| A | B | output | |
|---|---|---|---|
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 0 | 1 |
✓ Derivation checked step by step We checked the derivation step by step.
Minimize and implement the following multiple-output functions
Solution
Maps.
Separate minimization. This needs 7 distinct AND gates ( is already common).
Shared minimization. We look for products that can serve both functions. (8, 12) and (1, 3) are implicants of both. If uses (for 1, 3) in place of , minterm 5 is still covered by and 7 by . The two functions then share two gates: Now only 6 AND gates are needed: , , , , , , plus two 4-input OR gates. This is the minimum (our search found no 5-gate solution; 6-gate alternatives exist with the same cost).
Implementation. The two shared AND outputs each feed both OR gates; the other four feed one OR each.
✓ Checked by computer We searched all shared and separate covers for the fewest gates in code.
A locker can be opened by A and B when they are both there, as the locker has 2 keys, one of which is with A and the other with B. C has both the keys, but he is permitted to open the locker only when B is not there. Show that the locker can be opened always if both A and C are there. Give the Boolean identity that symbolisms this situation.
Solution
Variables. when that person is present; when the locker can be opened.
Conditions.
- A and B together can open it: term .
- C can open it only when B is absent: term .
A and C both present. Put : So the locker can always be opened when A and C are both there, whether B is present or not: if B is there, A and B open it; if B is away, C opens it.
Boolean identity. Adding the term does not change : This is the consensus theorem. Proof: , which is absorbed by and .
✓ Checked by computer We checked the locker function and the identity on all eight inputs in code.
A farmer (F) has two sheds ( & ) in his farm to keep his farm produce and belongings. He keeps vegetables (V) as farm produce, a goat (G) which can eat the vegetables and a dog (D) that can bite the goat in the absence of the farmer. The farmer along has to manage both sheds without loosing either vegetables or the goat. Suggest a logic circuit that can alarm him under any catastrophic condition by means of a buzzer.
Solution
Note. The question is open-ended. We take each of F, V, G, D as a variable that is 1 when it is in shed N1 and 0 when it is in shed S1. A catastrophe is the goat left with the vegetables, or the dog left with the goat, in a shed where the farmer is not.
Danger conditions.
- Goat and vegetables together without the farmer: and .
- Dog and goat together without the farmer: and .
Expanded form. For (goat in N1, farmer in S1), danger if or . For , danger if or : In the order (F, V, G, D), the alarm states are minterms 3, 6, 7, 8, 9, 12.
Circuit. One XOR, two XNORs, one OR and one AND.
✓ Checked by computer We checked the alarm function against all 16 placements in code.
Simplify the Boolean function and realise it using NAND gates.
Solution
Simplification.
NAND realization. : a 3-input NAND of , B, , followed by a NAND used as an inverter. and come from NAND gates with tied inputs.
✓ Checked by computer We checked the simplified form and the NAND circuit on all inputs in code.
Reduce the following four variable function using Karnaugh map and implement it in NAND logic,
Solution
Karnaugh map. The ones are at 0, 4, 7, 8, 12, 13, 15.
Groups.
- : 0, 4, 8, 12 (the whole top row).
- : 7, 15 (the only group for 7).
- : 12, 13 (covers 13).
(13 can equally be paired with 15 as , giving the other minimum .)
NAND implementation.
✓ Checked by computer We found every minimum cover by exhaustive search in code.
Minimize the following logic functions using Karnaugh maps and realize them using NAND gates. (i) (ii)
Solution
Maps.
(i) The ones are at 2, 3, 6, 7 and 8–15. The bottom half (A = 1) is a group of 8 and the two lower rows (C = 1) are another: NAND form: , a NAND gate fed by and (two NANDs as inverters).
(ii) The maxterms listed are 0–10, 12, 13, so the function is 1 only at 11, 14 and 15: NAND form:
✓ Checked by computer We checked both minimal forms on all 16 inputs in code.
More on Digital Electronics
- All Electrical Engineering PYQ solutions, topic by topic
- Digital Electronics topic-wise PYQs (questions only, for practice)
- Electrical Engineering PYQ analysis: which units carry the marks year by year
- Year-wise question papers
- Electrical Engineering booklist
Questions: UPSC Civil Services (Main) Examination, Electrical Engineering Paper I, 1997–2023. Solutions: Optional Province. Found an error? Tell us.

