Menu Close

Computer systems, logic gates and Boolean algebra: UPSC Maths Optional PYQ Solutions (2008–2026)

All 25 questions UPSC has asked on Boolean algebra, logic gates and computer systems in the Mathematics Optional (Paper II, Numerical Analysis and Computer Programming) from 2008 to 2026, solved step by step – latest first.

Try them yourself first: the same questions, without solutions, are on our Numerical Analysis and Computer Programming 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 answer was worked out again independently with Python: each iteration, table or conversion was run again in double precision (or exact fractions), and algorithms were run on test equations.
  • ✓ Proof checked step by step for “prove that” questions, every step was checked against the definitions.

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):

2026 · 5c 2025 · 5c 2025 · 6b 2024 · 6b 2023 · 7a 2022 · 5c 2022 · 6b 2021 · 5c 2021 · 6b 2020 · 5c 2019 · 8a 2018 · 8a 2017 · 5c 2016 · 8c 2015 · 5c 2014 · 5d 2014 · 8b 2011 · 5d 2011 · 7b 2010 · 5d 2010 · 7c 2009 · 5c(ii) 2009 · 5d(i) 2008 · 5d(i) 2008 · 5d(ii)

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

Consider the logic circuit L : [Figure: logic circuit L with inputs A, B, C; the first AND gate takes A, B, C; the second AND gate takes A, B‾ (through a NOT gate) and C; the third AND gate takes A‾ (through a NOT gate) and B; the outputs of the three AND gates feed an OR gate whose output is Y] (i) Express Y as a Boolean expression. (ii) Write 8-bit special sequences for A, B and C. (iii) Find the truth table of L using 8-bit special sequences.

2026 · Paper II · Q5c · 10 marks

Solution

(i) Boolean expression. The three AND gates give ABCABC, AB‾CA\bar BC and A‾B\bar AB; the OR gate adds them: Y=ABC+AB‾C+A‾B.Y=ABC+A\bar BC+\bar AB . It simplifies: ABC+AB‾C=AC(B+B‾)=ACABC+A\bar BC=AC(B+\bar B)=AC, so Y=AC+A‾BY=AC+\bar AB.

(ii) 8-bit special sequences. For three inputs, list the 8 input combinations 000,001,…,111000,001,\dots,111 column-wise; each input then becomes an 8-bit string: A=00001111B=00110011C=01010101\begin{aligned}A&=0000\,1111\\ B&=0011\,0011\\ C&=0101\,0101\end{aligned} (Read vertically, bit ii of A,B,CA,B,C is the binary form of ii.)

(iii) Truth table, working bit by bit (A‾=11110000\bar A=1111\,0000, B‾=11001100\bar B=1100\,1100):

Signal Bits
AA 00001111
BB 00110011
CC 01010101
ABCABC 00000001
AB‾CA\bar BC 00000100
A‾B\bar AB 00110000
YY (OR) 00110101

As an ordinary truth table:

AA BB CC YY
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1

✓ Checked by computer We checked by computer: bitwise evaluation of the three AND terms and their OR gives Y=00110101Y=00110101, which equals AC+A‾BAC+\bar AB row by row.

↑ Back to the question list

(i) Convert the number (3479)10 into binary system and the number (7AE.9F)16 into decimal system. (ii) Determine the truth table for the Boolean function F(x,y,z)=(x+y+z′)(x′+y′) Also derive the full disjunctive normal form of F(x,y,z) from the truth table.

2025 · Paper II · Q5c · 10 marks

Solution

(i) (3479)10(3479)_{10} to binary. Repeated division by 2:

Divide by 2 Quotient Remainder
3479 1739 1
1739 869 1
869 434 1
434 217 0
217 108 1
108 54 0
54 27 0
27 13 1
13 6 1
6 3 0
3 1 1
1 0 1

Reading the remainders from the bottom up, (3479)10=(110110010111)2.(3479)_{10}=(110110010111)_2 . (Check: 2048+1024+256+128+16+4+2+1=34792048+1024+256+128+16+4+2+1=3479.)

(7AE.9F)16(7AE.9F)_{16} to decimal. A=10A=10, E=14E=14, F=15F=15: 7×162+10×16+14=1966916+15256=0.62109375\begin{aligned}7\times16^2+10\times16+14&=1966\\ \tfrac{9}{16}+\tfrac{15}{256}&=0.62109375\end{aligned} (7AE.9F)16=1966.62109375.(7AE.9F)_{16}=1966.62109375 .

(ii) Truth table for F=(x+y+z′)(x′+y′)F=(x+y+z')(x'+y'):

xx yy zz x+y+z′x+y+z' x′+y′x'+y' FF
0 0 0 1 1 1
0 0 1 0 1 0
0 1 0 1 1 1
0 1 1 1 1 1
1 0 0 1 1 1
1 0 1 1 1 1
1 1 0 1 0 0
1 1 1 1 0 0

Full disjunctive normal form. Take one minterm for each row with F=1F=1: F(x,y,z)=x′y′z′+x′yz′+x′yz+xy′z′+xy′z\begin{aligned}F(x,y,z)&=x'y'z' + x'yz' + x'yz\\ &\quad+ xy'z' + xy'z\end{aligned} =∑m(0,2,3,4,5).=\textstyle\sum m(0,2,3,4,5). (As a check: F=0F=0 exactly when x=y=0,z=1x=y=0,\ z=1 (first factor 0) or x=y=1x=y=1 (second factor 0), i.e. rows 1, 6, 7.)

✓ Checked by computer We checked by computer: 3479=(110110010111)23479=(110110010111)_2, (7AE.9F)16=1966.62109375(7AE.9F)_{16}=1966.62109375, and the truth table of FF has 1s exactly in rows 0, 2, 3, 4, 5.

↑ Back to the question list

Simplify the Boolean function F(x,y,z)=xyz+x′yz+xy′z+xyz′ and draw the corresponding GATE network.

2025 · Paper II · Q6b · 15 marks

Solution

Use xyz=xyz+xyz+xyzxyz=xyz+xyz+xyz (idempotent law) to pair the extra term with each of the others: F=(xyz+x′yz)+(xyz+xy′z)+(xyz+xyz′)=yz(x+x′)+xz(y+y′)+xy(z+z′)=yz+xz+xy.\begin{aligned}F&=(xyz+x'yz)+(xyz+xy'z)\\ &\quad+(xyz+xyz')\\ &=yz(x+x')+xz(y+y')\\ &\quad+xy(z+z')\\ &=yz+xz+xy .\end{aligned} So F=xy+yz+zxF=xy+yz+zx – the majority function (1 when at least two inputs are 1). No further simplification is possible: each term covers a pair of minterms not covered by the others.

Gate network: three 2-input AND gates and one 3-input OR gate.

xyyzxzF
F = xy + yz + xz

✓ Checked by computer We checked by computer: xyz+x′yz+xy′z+xyz′xyz+x'yz+xy'z+xyz' and xy+yz+zxxy+yz+zx agree on all 8 inputs.

↑ Back to the question list

Draw the logical circuit for the Boolean expression Y=ABC‾+BC‾+A‾B. Also, obtain the output Y (truth table) for the three input bit sequences : A=10001111, B=00111100, C=11000100

2024 · Paper II · Q6b · 15 marks

Solution

Logic circuit. Three AND gates for ABC‾AB\bar C, BC‾B\bar C and A‾B\bar AB (NOT gates supply C‾\bar C and A‾\bar A), followed by a 3-input OR gate.

ABCBCABY
Y = ABC̄ + BC̄ + ĀB

(The expression simplifies: ABC‾+BC‾=BC‾AB\bar C+B\bar C=B\bar C, so Y=BC‾+A‾B=B(A‾+C‾)Y=B\bar C+\bar AB=B(\bar A+\bar C).)

Output for the given sequences, bit by bit:

Signal Bits
AA 10001111
BB 00111100
CC 11000100
ABC‾AB\bar C 00001000
BC‾B\bar C 00111000
A‾B\bar AB 00110000
YY 00111000

So Y=00111000Y=00111000.

✓ Checked by computer We checked by computer: bitwise, Y=00111000Y=00111000; the simplified form B(A‾+C‾)B(\bar A+\bar C) gives the same bits.

↑ Back to the question list

(i) Find the conjunctive normal form (CNF) of the following Boolean function : f(x,y,z,t)=x⋅y⋅z+x‾⋅y⋅(t+z‾) \(ii\) Express the Boolean function f(x,y,z)=x+(x‾⋅y‾+x‾⋅z)¯+z in disjunctive normal form (DNF) and construct the truth table for the function.

2023 · Paper II · Q7a · 15 marks

Solution

(i) Factor out yy: f=y[xz+x‾(t+z‾)].f=y\left[xz+\bar x(t+\bar z)\right]. For any P,QP,Q: xP+x‾Q=(x‾+P)(x+Q)xP+\bar xQ=(\bar x+P)(x+Q) (expand the right side: x‾x+x‾Q+xP+PQ\bar xx+\bar xQ+xP+PQ, and PQPQ is the consensus term, already covered). With P=zP=z, Q=t+z‾Q=t+\bar z: xz+x‾(t+z‾)=(x‾+z)(x+t+z‾).xz+\bar x(t+\bar z)=(\bar x+z)(x+t+\bar z). Hence the conjunctive normal form is f=y⋅(x+t+z‾)⋅(x‾+z).f=y\cdot(x+t+\bar z)\cdot(\bar x+z).

(ii) By De Morgan, x‾y‾+x‾z¯=x‾(y‾+z)¯=x+y‾+z¯=x+yz‾\overline{\bar x\bar y+\bar xz}=\overline{\bar x(\bar y+z)}=x+\overline{\bar y+z}=x+y\bar z. Therefore f=x+(x+yz‾)+z=x+yz‾+z=x+(y+z)(z‾+z)=x+y+z.\begin{aligned}f&=x+(x+y\bar z)+z=x+y\bar z+z\\ &=x+(y+z)(\bar z+z)=x+y+z .\end{aligned} So the (simplest) DNF is f=x+y+zf=x+y+z. As a full DNF, ff is the sum of all minterms except x‾y‾z‾\bar x\bar y\bar z: f=x‾y‾z+x‾yz‾+x‾yz+xy‾z‾+xy‾z+xyz‾+xyz.\begin{aligned}f&=\bar x\bar yz+\bar xy\bar z+\bar xyz+x\bar y\bar z\\ &\quad+x\bar yz+xy\bar z+xyz .\end{aligned} Truth table (with u=x‾y‾+x‾zu=\bar x\bar y+\bar xz):

xx yy zz uu u‾\bar u ff
0 0 0 1 0 0
0 0 1 1 0 1
0 1 0 0 1 1
0 1 1 1 0 1
1 0 0 0 1 1
1 0 1 0 1 1
1 1 0 0 1 1
1 1 1 0 1 1

✓ Checked by computer We checked by computer (SymPy): y(x+t+z‾)(x‾+z)y(x+t+\bar z)(\bar x+z) is equivalent to the given ff, and x+(x‾y‾+x‾z)¯+zx+\overline{(\bar x\bar y+\bar xz)}+z is equivalent to x+y+zx+y+z.

↑ Back to the question list

(i) Convert the number (1093.21875)10 into octal and the number (1693.0628)10 into hexadecimal systems. (ii) Express the Boolean function F(x,y,z)=xy+x′z in a product of maxterms form.

2022 · Paper II · Q5c · 10 marks

Solution

(i) (1093.21875)10(1093.21875)_{10} to octal.

Divide by 8 Quotient Remainder
1093 136 5
136 17 0
17 2 1
2 0 2
Fraction × 8 Product Integer part
0.21875 × 8 1.75 1
0.75 × 8 6 6

The fraction terminates, so (1093.21875)10=(2105.16)8.(1093.21875)_{10}=(2105.16)_8 . (Check: 2×512+1×64+0×8+5+18+664=1093.218752\times512+1\times64+0\times8+5+\tfrac18+\tfrac6{64}=1093.21875.)

(1693.0628)10(1693.0628)_{10} to hexadecimal.

Divide by 16 Quotient Remainder
1693 105 D (13)
105 6 9
6 0 6
Fraction × 16 Product Integer part
0.0628 × 16 1.0048 1
0.0048 × 16 0.0768 0
0.0768 × 16 1.2288 1
0.2288 × 16 3.6608 3
0.6608 × 16 10.5728 A (10)

The fraction does not terminate: (1693.0628)10≈(69D.1013A…)16.(1693.0628)_{10}\approx(69D.1013A\ldots)_{16} .

(ii) Product of maxterms for F=xy+x′zF=xy+x'z. F=1F=1 for xyxy: rows 110,111110,\ 111 (minterms 6, 7); for x′zx'z: rows 001,011001,\ 011 (minterms 1, 3). So F=∑m(1,3,6,7)F=\sum m(1,3,6,7) and F=0F=0 in rows 0, 2, 4, 5. Each zero row gives a maxterm (a variable appears uncomplemented where it is 0): F=∏M(0,2,4,5)=(x+y+z)(x+y′+z)⋅(x′+y+z)(x′+y+z′).\begin{aligned}F&=\textstyle\prod M(0,2,4,5)\\ &=(x+y+z)(x+y'+z)\\ &\quad\cdot(x'+y+z)(x'+y+z').\end{aligned}

✓ Checked by computer We checked by computer: 1093.21875=(2105.16)81093.21875=(2105.16)_8, 1693.0628≈(69D.1013A)161693.0628\approx(69D.1013A)_{16}, and xy+x′zxy+x'z is 0 exactly in rows 0, 2, 4, 5.

↑ Back to the question list

Find a combinatorial circuit corresponding to the Boolean function f(x,y,z)=[x⋅(y‾+z)]+y and write the input/output table for the circuit.

2022 · Paper II · Q6b · 15 marks

Solution

Multiplying out, f=x(y‾+z)+y=xy‾+xz+yf=x(\bar y+z)+y=x\bar y+xz+y. A two-level circuit: AND gates for xy‾x\bar y and xzxz (a NOT gate makes y‾\bar y), and an OR gate that also takes yy directly.

xyxzyf
f = x(ȳ + z) + y = xȳ + xz + y

Input/output table:

xx yy zz y‾+z\bar y+z x(y‾+z)x(\bar y+z) ff
0 0 0 1 0 0
0 0 1 1 0 0
0 1 0 0 0 1
0 1 1 1 0 1
1 0 0 1 1 1
1 0 1 1 1 1
1 1 0 0 0 1
1 1 1 1 1 1

The output column is 1 exactly when x=1x=1 or y=1y=1. Indeed xy‾+y=x+yx\bar y+y=x+y and xzxz is then absorbed, so f=x+y,f=x+y, which needs just one OR gate:

xyf
Simplified circuit: f = x + y

✓ Checked by computer We checked by computer: x(y‾+z)+yx(\bar y+z)+y and x+yx+y agree on all 8 inputs.

↑ Back to the question list

(i) Convert (3798.3875)10 into octal and hexadecimal equivalents. (ii) Obtain the principal conjunctive normal form of (¬P→R)∧(Q⇄P).

2021 · Paper II · Q5c · 10 marks

Solution

(i) (3798.3875)10(3798.3875)_{10}. Integer part to octal and to hexadecimal:

Divide by 8 Quotient Remainder
3798 474 6
474 59 2
59 7 3
7 0 7
Divide by 16 Quotient Remainder
3798 237 6
237 14 D (13)
14 0 E (14)

So 3798=(7326)8=(ED6)163798=(7326)_8=(ED6)_{16}.

Fraction to octal (×8) and to hexadecimal (×16):

Fraction × 8 Product Integer part
0.3875 × 8 3.1 3
0.1 × 8 0.8 0
0.8 × 8 6.4 6
0.4 × 8 3.2 3
0.2 × 8 1.6 1
0.6 × 8 4.8 4
0.8 × 8 6.4 6
0.4 × 8 3.2 3
Fraction × 16 Product Integer part
0.3875 × 16 6.2 6
0.2 × 16 3.2 3
0.2 × 16 3.2 3
0.2 × 16 3.2 3

In octal the digits 6,3,1,46,3,1,4 repeat; in hexadecimal the digit 3 repeats. Hence (3798.3875)10=(7326.306314¯)8=(ED6.63¯)16.\begin{aligned}(3798.3875)_{10}&=(7326.30\overline{6314})_8\\ &=(ED6.6\overline{3})_{16} .\end{aligned}

(ii) Principal conjunctive normal form. ¬P→R≡P∨R\neg P\to R\equiv P\lor R, and Q⇄PQ\rightleftarrows P is true when P,QP,Q have the same value.

PP QQ RR P∨RP\lor R Q↔PQ\leftrightarrow P Formula
0 0 0 0 1 0
0 0 1 1 1 1
0 1 0 0 0 0
0 1 1 1 0 0
1 0 0 1 0 0
1 0 1 1 0 0
1 1 0 1 1 1
1 1 1 1 1 1

The formula is false in rows 000,010,011,100,101000,\ 010,\ 011,\ 100,\ 101. Each false row gives a maxterm, so the PCNF is (P∨Q∨R)∧(P∨¬Q∨R)∧(P∨¬Q∨¬R)∧(¬P∨Q∨R)∧(¬P∨Q∨¬R).\begin{aligned}&(P\lor Q\lor R)\land(P\lor\neg Q\lor R)\\ &\land(P\lor\neg Q\lor\neg R)\land(\neg P\lor Q\lor R)\\ &\land(\neg P\lor Q\lor\neg R).\end{aligned}

✓ Checked by computer We checked by computer: 3798=(7326)8=(ED6)163798=(7326)_8=(ED6)_{16}, the fraction 0.38750.3875 gives the repeating digits shown, and the formula is false in exactly the five rows used.

↑ Back to the question list

Obtain the Boolean function F(x,y,z) based on the table given below. Then simplify F(x,y,z) and draw the corresponding GATE network : xyzF(x,y,z)11111101101110000111010000100000

2021 · Paper II · Q6b · 15 marks

Solution

Boolean function. F=1F=1 in the rows 111,110,101,011111,\ 110,\ 101,\ 011, so (sum of minterms) F(x,y,z)=xyz+xyz′+xy′z+x′yz.F(x,y,z)=xyz+xyz'+xy'z+x'yz . Simplify. Using xyz=xyz+xyz+xyzxyz=xyz+xyz+xyz: F=(xyz+xyz′)+(xyz+xy′z)+(xyz+x′yz)=xy+xz+yz.\begin{aligned}F&=(xyz+xyz')+(xyz+xy'z)\\ &\quad+(xyz+x'yz)\\ &=xy+xz+yz .\end{aligned} (FF is 1 when at least two of x,y,zx,y,z are 1 – the majority function.)

Gate network:

xyyzxzF
F = xy + xz + yz

✓ Checked by computer We checked by computer: the minterm sum xyz+xyz′+xy′z+x′yzxyz+xyz'+xy'z+x'yz equals xy+yz+zxxy+yz+zx on all 8 inputs.

↑ Back to the question list

Let g(w,x,y,z)=(w+x+y)(x+y‾+z)(w+y‾) be a Boolean function. Obtain the conjunctive normal form for g(w,x,y,z). Also express g(w,x,y,z) as a product of maxterms.

2020 · Paper II · Q5c · 10 marks

Solution

CNF. gg is already a product of sums, so a conjunctive normal form is g=(w+x+y)(x+y‾+z)(w+y‾).g=(w+x+y)(x+\bar y+z)(w+\bar y). Product of maxterms. Each sum that lacks a variable is expanded with VV‾=0V\bar V=0, i.e. S=(S+V)(S+V‾)S=(S+V)(S+\bar V): w+x+y=(w+x+y+z)⋅(w+x+y+z‾)=M0M1x+y‾+z=(w+x+y‾+z)⋅(w‾+x+y‾+z)=M2M10w+y‾=(w+x+y‾+z)⋅(w+x+y‾+z‾)⋅(w+x‾+y‾+z)⋅(w+x‾+y‾+z‾)=M2M3M6M7\begin{aligned}w+x+y&=(w+x+y+z)\\ &\quad\cdot(w+x+y+\bar z)\\ &=M_0\,M_1\\ x+\bar y+z&=(w+x+\bar y+z)\\ &\quad\cdot(\bar w+x+\bar y+z)\\ &=M_2\,M_{10}\\ w+\bar y&=(w+x+\bar y+z)\\ &\quad\cdot(w+x+\bar y+\bar z)\\ &\quad\cdot(w+\bar x+\bar y+z)\\ &\quad\cdot(w+\bar x+\bar y+\bar z)\\ &=M_2\,M_3\,M_6\,M_7\end{aligned} (Maxterm MiM_i is 0 exactly at input i=(wxyz)2i=(wxyz)_2.) Dropping the repeated M2M_2: g=∏M(0,1,2,3,6,7,10)g=\textstyle\prod M(0,1,2,3,6,7,10) =(w+x+y+z)⋅(w+x+y+z′)⋅(w+x+y′+z)⋅(w+x+y′+z′)⋅(w+x′+y′+z)⋅(w+x′+y′+z′)⋅(w′+x+y′+z)\begin{aligned}&=(w+x+y+z)\\ &\quad\cdot(w+x+y+z')\\ &\quad\cdot(w+x+y'+z)\\ &\quad\cdot(w+x+y'+z')\\ &\quad\cdot(w+x'+y'+z)\\ &\quad\cdot(w+x'+y'+z')\\ &\quad\cdot(w'+x+y'+z)\end{aligned}

✓ Checked by computer We checked by computer: g=0g=0 exactly for the inputs numbered 0, 1, 2, 3, 6, 7, 10 (in the order wxyzwxyz), so g=∏M(0,1,2,3,6,7,10)g=\prod M(0,1,2,3,6,7,10).

↑ Back to the question list

Given the Boolean expression X=AB+ABC+AB‾C‾+AC‾ (i) Draw the logical diagram for the expression. (ii) Minimize the expression. (iii) Draw the logical diagram for the reduced expression.

2019 · Paper II · Q8a · 15 marks

Solution

(i) Logic diagram of the given expression.

ABABCABCACX
Original: X = AB + ABC + AB̄C̄ + AC̄

(ii) Minimisation. X=AB(1+C)+AC‾(B‾+1)=AB+AC‾=A(B+C‾).\begin{aligned}X&=AB(1+C)+A\bar C(\bar B+1)\\ &=AB+A\bar C\\ &=A(B+\bar C).\end{aligned} (absorption: AB+ABC=ABAB+ABC=AB and AC‾+AB‾C‾=AC‾A\bar C+A\bar B\bar C=A\bar C.)

(iii) Logic diagram of the reduced expression: one NOT, one OR and one AND gate.

ABCX
Reduced: X = A(B + C̄)

✓ Checked by computer We checked by computer: AB+ABC+AB‾C‾+AC‾AB+ABC+A\bar B\bar C+A\bar C and A(B+C‾)A(B+\bar C) agree on all 8 inputs.

↑ Back to the question list

Simplify the boolean expression : (a+b)⋅(b‾+c)+b⋅(a‾+c‾) by using the laws of boolean algebra. From its truth table write it in minterm normal form.

2018 · Paper II · Q8a · 15 marks

Solution

Simplification. (a+b)(b‾+c)+b(a‾+c‾)=ab‾+ac+bb‾+bc+a‾b+bc‾=ab‾+ac+b(c+c‾)+a‾b=ab‾+ac+b(b+a‾b=b)=a+b+ac(ab‾+b=a+b)=a+b(a+ac=a).\begin{aligned}&(a+b)(\bar b+c)+b(\bar a+\bar c)\\ &=a\bar b+ac+b\bar b+bc+\bar ab+b\bar c\\ &=a\bar b+ac+b(c+\bar c)+\bar ab\\ &=a\bar b+ac+b\qquad(b+\bar ab=b)\\ &=a+b+ac\qquad(a\bar b+b=a+b)\\ &=a+b\qquad(a+ac=a).\end{aligned} Truth table:

aa bb cc Value
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1

Minterm normal form (one minterm for each row with value 1): a‾bc‾+a‾bc+ab‾c‾+ab‾c+abc‾+abc\begin{aligned}&\bar ab\bar c + \bar abc + a\bar b\bar c\\ &+a\bar bc + ab\bar c + abc\end{aligned} =∑m(2,3,4,5,6,7).=\textstyle\sum m(2,3,4,5,6,7).

✓ Checked by computer We checked by computer: the given expression equals a+ba+b on all 8 inputs and is 1 for minterms 2–7.

↑ 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

Write the Boolean expression z(y+z)(x+y+z) in its simplest form using Boolean postulate rules. Mention the rules used during simplification. Verify your result by constructing the truth table for the given expression and for its simplest form.

2017 · Paper II · Q5c · 10 marks

Solution

using, in order, the distributive law, zz=zzz=z, absorption (z+zy=zz+zy=z), the distributive law and absorption again: z(y+z)(x+y+z)=(zy+zz)(x+y+z)=(zy+z)(x+y+z)=z(x+y+z)=zx+zy+z=z\begin{aligned}&z(y+z)(x+y+z)\\ &=(zy+zz)(x+y+z)\\ &=(zy+z)(x+y+z)\\ &=z(x+y+z)\\ &=zx+zy+z\\ &=z\end{aligned} So the simplest form is zz.

Verification by truth table:

xx yy zz y+zy+z x+y+zx+y+z z(y+z)(x+y+z)z(y+z)(x+y+z) zz
0 0 0 0 0 0 0
0 0 1 1 1 1 1
0 1 0 1 1 0 0
0 1 1 1 1 1 1
1 0 0 0 1 0 0
1 0 1 1 1 1 1
1 1 0 1 1 0 0
1 1 1 1 1 1 1

The last two columns are identical.

✓ Checked by computer We checked by computer: the last two columns of the truth table agree in every row.

↑ Back to the question list

Let A, B, C be Boolean variables, A‾ denote complement of A, A+B is an expression for A OR B and A⋅B is an expression for A AND B. Then simplify the following expression and draw a block diagram of the simplified expression, using AND and OR gates. A⋅(A+B+C)⋅(A‾+B+C)⋅(A+B‾+C)⋅(A+B+C‾).

2016 · Paper II · Q8c · 15 marks

Solution

Use absorption, A⋅(A+P)=AA\cdot(A+P)=A, on every factor that contains AA uncomplemented: A(A+B+C)=A,A(A+B‾+C)=A,A(A+B+C‾)=A.\begin{aligned}A(A+B+C)&=A,\\ A(A+\bar B+C)&=A,\\ A(A+B+\bar C)&=A .\end{aligned} So the expression reduces to A⋅(A‾+B+C)=AA‾+A(B+C)=A(B+C)=AB+AC.\begin{aligned}&A\cdot(\bar A+B+C)\\ &=A\bar A+A(B+C)\\ &=A(B+C)=AB+AC .\end{aligned} Block diagram (one OR gate, one AND gate):

ABCY
A·(B + C)

✓ Checked by computer We checked by computer: the product equals A(B+C)A(B+C) on all 8 inputs.

↑ Back to the question list

Find the principal (or canonical) disjunctive normal form in three variables p, q, r for the Boolean expression ((p∧q)→r)∨((p∧q)→−r). Is the given Boolean expression a contradiction or a tautology?

2015 · Paper II · Q5c · 10 marks

Solution

Write u=p∧qu=p\land q. Since (u→r)≡¬u∨r(u\to r)\equiv\neg u\lor r and (u→¬r)≡¬u∨¬r(u\to\neg r)\equiv\neg u\lor\neg r, (u→r)∨(u→¬r)≡¬u∨r∨¬u∨¬r≡¬u∨(r∨¬r)≡¬u∨T≡T.\begin{aligned}&(u\to r)\lor(u\to\neg r)\\ &\equiv\neg u\lor r\lor\neg u\lor\neg r\\ &\equiv\neg u\lor(r\lor\neg r)\equiv\neg u\lor T\equiv T .\end{aligned} The expression is true for every assignment: it is a tautology (not a contradiction).

The principal disjunctive normal form therefore contains all 23=82^3=8 minterms: (p∧q∧r)∨(p∧q∧¬r)∨(p∧¬q∧r)∨(p∧¬q∧¬r)∨(¬p∧q∧r)∨(¬p∧q∧¬r)∨(¬p∧¬q∧r)∨(¬p∧¬q∧¬r).\begin{aligned}&(p\land q\land r)\lor(p\land q\land\neg r)\\ &\lor(p\land\neg q\land r)\lor(p\land\neg q\land\neg r)\\ &\lor(\neg p\land q\land r)\lor(\neg p\land q\land\neg r)\\ &\lor(\neg p\land\neg q\land r)\lor(\neg p\land\neg q\land\neg r).\end{aligned} (Check one row: p=q=r=Tp=q=r=T gives (T→T)∨(T→F)=T∨F=T(T\to T)\lor(T\to F)=T\lor F=T; any row with p∧qp\land q false makes both implications true.)

✓ Checked by computer We checked by computer: the expression is true in all 8 rows of its truth table.

↑ Back to the question list

Use only AND and OR logic gates to construct a logic circuit for the Boolean expression z=xy+uv.

2014 · Paper II · Q5d · 10 marks

Solution

z=xy+uvz=xy+uv is a sum of two products: one AND gate for xyxy, one for uvuv, and an OR gate to combine them.

xyuvz
z = xy + uv

✓ Proof checked step by step We checked all 16 input combinations: the circuit outputs 1 exactly when x=y=1x=y=1 or u=v=1u=v=1.

↑ Back to the question list

For any Boolean variables x and y, show that x+xy=x.

2014 · Paper II · Q8b · 15 marks

Solution

x+xy=x⋅1+x⋅y=x(1+y)=x⋅1=x.\begin{aligned}x+xy&=x\cdot1+x\cdot y\\ &=x(1+y)\\ &=x\cdot1\\ &=x .\end{aligned} Check by truth table: if x=0x=0 both sides are 0; if x=1x=1, x+xy=1+y=1=xx+xy=1+y=1=x. Hence x+xy=xx+xy=x (the absorption law).

✓ Proof checked step by step We checked each step against the Boolean algebra laws, and the identity in all four rows of its truth table.

↑ Back to the question list

(i) Compute (3205)10 to the base 8. (ii) Let A be an arbitrary but fixed Boolean algebra with operations ∧, ∨ and ′ and the zero and the unit element denoted by 0 and 1 respectively. Let x,y,z,…… be elements of A. If x,y∈A be such that x∧y=0 and x∨y=1 then prove that y=x′.

2011 · Paper II · Q5d · 12 marks

Solution

(i) Repeated division by 8:

Divide by 8 Quotient Remainder
3205 400 5
400 50 0
50 6 2
6 0 6

(3205)10=(6205)8.(3205)_{10}=(6205)_8 . (Check: 6×512+2×64+0×8+5=32056\times512+2\times64+0\times8+5=3205.)

(ii) The complement is unique. By definition x′x' satisfies x∧x′=0x\land x'=0 and x∨x′=1x\lor x'=1. Suppose also x∧y=0x\land y=0 and x∨y=1x\lor y=1. Then y=y∧1=y∧(x∨x′)=(y∧x)∨(y∧x′)=0∨(y∧x′)=y∧x′.\begin{aligned}y&=y\land1\\ &=y\land(x\lor x')\\ &=(y\land x)\lor(y\land x')\\ &=0\lor(y\land x')\\ &=y\land x' .\end{aligned} (using, in turn, the identity law, x∨x′=1x\lor x'=1, the distributive law and x∧y=0x\land y=0). In the same way, using x∧x′=0x\land x'=0 and x∨y=1x\lor y=1: x′=x′∧1=x′∧(x∨y)=(x′∧x)∨(x′∧y)=0∨(x′∧y)=x′∧y.\begin{aligned}x'&=x'\land1=x'\land(x\lor y)\\ &=(x'\land x)\lor(x'\land y)\\ &=0\lor(x'\land y)=x'\land y .\end{aligned} Since ∧\land is commutative, y∧x′=x′∧yy\land x'=x'\land y, so y=x′y=x'.

✓ Proof checked step by step We checked each step against the Boolean algebra axioms (identity, complement, distributive and commutative laws); (6205)8=3205(6205)_8=3205 was checked by computer.

↑ Back to the question list

Find the logic circuit that represents the following Boolean function. Find also an equivalent simpler circuit : xyzf(x,y,z)11111100101010000111010000100000

2011 · Paper II · Q7b · 20 marks

Solution

f=1f=1 only in rows 111111 and 011011, so f=xyz+x‾yz.f=xyz+\bar xyz . Circuit (sum of minterms):

xyzxyzf
From the table: f = xyz + x̄yz

Simpler circuit. xyz+x‾yz=yz(x+x‾)=yzxyz+\bar xyz=yz(x+\bar x)=yz, so a single AND gate does the job:

yzf
Simpler equivalent: f = yz

✓ Checked by computer We checked by computer: xyz+x‾yzxyz+\bar xyz and yzyz agree with the given table in all 8 rows.

↑ Back to the question list

(i) Suppose a computer spends 60 per cent of its time handling a particular type of computation when running a given program and its manufacturers make a change that improves its performance on that type of computation by a factor of 10. If the program takes 100 sec to execute, what will its execution time be after the change ? (ii) If A⊕B=AB′+A′B, find the value of x⊕y⊕z.

2010 · Paper II · Q5d · 12 marks

Solution

(i) Of the 100 s, 60%60\% (60 s) is spent on the improved computation and 40 s on everything else. The improved part becomes 10 times faster: 60/10=660/10=6 s. The rest is unchanged. New time: 6+40=46s.6+40=46\ \text{s}. (Overall speed-up 100/46≈2.17100/46\approx2.17, not 10 – this is Amdahl’s law.)

(ii) A⊕B=AB′+A′BA\oplus B=AB'+A'B is 1 when exactly one input is 1. Then x⊕y⊕z=(x⊕y)z′+(x⊕y)′z=(xy′+x′y)z′+(xy+x′y′)z=x′y′z+x′yz′+xy′z′+xyz.\begin{aligned}&x\oplus y\oplus z\\ &=(x\oplus y)z'+(x\oplus y)'z\\ &=(xy'+x'y)z'+(xy+x'y')z\\ &=x'y'z+x'yz'\\ &\quad+xy'z'+xyz .\end{aligned} (using (xy′+x′y)′=xy+x′y′(xy'+x'y)'=xy+x'y'). So x⊕y⊕z=1x\oplus y\oplus z=1 exactly when an odd number of x,y,zx,y,z are 1.

✓ Checked by computer We checked by computer: 60/10+40=4660/10+40=46 s, and x⊕y⊕zx\oplus y\oplus z is 1 exactly in rows 1, 2, 4, 7.

↑ Back to the question list

(i) Find the hexadecimal equivalent of the decimal number (587632)10 (ii) For the given set of data points (x1,f(x1)),(x2,f(x2)),……,(xn,f(xn)) write an algorithm to find the value of f(x) by using Lagrange’s interpolation formula. (iii) Using Boolean algebra, simplify the following expressions (i) a+a′b+a′b′c+a′b′c′d+…… (ii) x′y′z+yz+xz where x′ represents the complement of x.

2010 · Paper II · Q7c · 20 marks

Solution

(i) Repeated division by 16:

Divide by 16 Quotient Remainder
587632 36727 0
36727 2295 7
2295 143 7
143 8 F (15)
8 0 8

(587632)10=(8F770)16.(587632)_{10}=(8F770)_{16} .

(ii) Lagrange’s formula: f(x)≈∑i=1nf(xi)∏j≠ix−xjxi−xjf(x)\approx\displaystyle\sum_{i=1}^{n}f(x_i)\prod_{j\ne i}\frac{x-x_j}{x_i-x_j}.

ALGORITHM  Lagrange interpolation
Input : n, data points (x[1], f[1]), ..., (x[n], f[n]), the point x
1. sum = 0
2. For i = 1 to n do
       term = f[i]
       For j = 1 to n do
           if j ≠ i then term = term*(x - x[j])/(x[i] - x[j])
       end for
       sum = sum + term
   end for
3. Print "f(x) =", sum
4. Stop

(iii) (a) Using p+p′q=p+qp+p'q=p+q repeatedly: a+a′b=a+ba+b+a′b′c=a+b+(a+b)′c=a+b+ca+b+c+a′b′c′d=a+b+c+d,…\begin{aligned}a+a'b&=a+b\\ a+b+a'b'c&=a+b+(a+b)'c\\ &=a+b+c\\ a+b+c+a'b'c'd&=a+b+c+d,\ \dots\end{aligned} so a+a′b+a′b′c+a′b′c′d+⋯=a+b+c+d+⋯a+a'b+a'b'c+a'b'c'd+\cdots=a+b+c+d+\cdots.

  1. x′y′z+yz+xz=z(x′y′+y+x)=z(x′+y+x)=z⋅1=z.\begin{aligned}x'y'z+yz+xz&=z(x'y'+y+x)\\ &=z(x'+y+x)\\ &=z\cdot1=z .\end{aligned}

✓ Checked by computer We checked by computer: 587632=(8F770)16587632=(8F770)_{16}; the algorithm, run on the six points of the 2009 interpolation question, returns f(3)=10f(3)=10; both simplifications were confirmed on all inputs.

↑ Back to the question list

Find the values of two valued boolean variables A, B, C, D by solving the following simultaneous equations : A‾+AB=0AB=ACAB+AC‾+CD=C‾D where x‾ denotes the complement of x.

2009 · Paper II · Q5c(ii) · 6 marks

Solution

First equation. A‾+AB=A‾+B\bar A+AB=\bar A+B (since A‾+AB=(A‾+A)(A‾+B)\bar A+AB=(\bar A+A)(\bar A+B)). So A‾+B=0\bar A+B=0, which forces A‾=0\bar A=0 and B=0B=0: A=1,B=0.A=1,\qquad B=0 . Second equation. AB=ACAB=AC with A=1A=1, B=0B=0 gives 0=C0=C: C=0.C=0 . Third equation. With A=1A=1, B=0B=0, C=0C=0: the left side is AB+AC‾+CD=0+1+0=1AB+A\bar C+CD=0+1+0=1, and the right side is C‾D=D\bar CD=D. So D=1.D=1 . Solution: A=1,B=0,C=0,D=1A=1,\ B=0,\ C=0,\ D=1 (and it is the only one). Check: A‾+AB=0\bar A+AB=0 ✓; AB=0=ACAB=0=AC ✓; AB+AC‾+CD=1=C‾DAB+A\bar C+CD=1=\bar CD ✓.

✓ Checked by computer We checked by computer: of the 16 possible assignments, only A=1,B=0,C=0,D=1A=1,\ B=0,\ C=0,\ D=1 satisfies all three equations.

↑ Back to the question list

Realize the following expression by using NAND gates only : g=(a‾+b‾+c)d‾(a‾+e)f where x‾ denotes the complement of x.

2009 · Paper II · Q5d(i) · 6 marks

Solution

Use three facts about NAND (written ↑\uparrow):

  • P¯=P↑P\overline{P}=P\uparrow P (inverter),
  • a‾+b‾+c=abc‾¯=NAND(a,b,c‾)\bar a+\bar b+c=\overline{a\,b\,\bar c}=\text{NAND}(a,b,\bar c) (De Morgan),
  • a‾+e=ae‾¯=NAND(a,e‾)\bar a+e=\overline{a\,\bar e}=\text{NAND}(a,\bar e).

So, with T1=NAND(a,b,c‾)T_1=\text{NAND}(a,b,\bar c) and T2=NAND(a,e‾)T_2=\text{NAND}(a,\bar e), g=T1⋅d‾⋅T2⋅f=NAND(T1,d‾,T2,f)¯.g=T_1\cdot\bar d\cdot T_2\cdot f=\overline{\text{NAND}(T_1,\bar d,T_2,f)} . The final inversion is one more NAND with its inputs tied. Gates used: three NAND inverters (for c‾\bar c, e‾\bar e, d‾\bar d), two NANDs for T1T_1, T2T_2, a 4-input NAND, and a NAND inverter at the output.

abcdaefg
NAND-only network for g (small NAND gates with tied inputs act as inverters)

✓ Checked by computer We checked by computer: the NAND network gives the same output as gg for all 64 inputs.

↑ Back to the question list

State the principle of duality in Boolean algebra and given the dual of the Boolean expressions (X+Y)⋅(X¯⋅Z¯)⋅(Y+Z) and X⋅X¯=0

2008 · Paper II · Q5d(i) · 6 marks

Solution

Principle of duality. Every identity of Boolean algebra remains valid if we interchange the operations ++ and ⋅\cdot and interchange the constants 00 and 11 throughout (complements and variables are left as they are). The new expression is the dual of the old one. This works because the axioms themselves come in dual pairs (e.g. x+0=xx+0=x and x⋅1=xx\cdot1=x; x+x‾=1x+\bar x=1 and x⋅x‾=0x\cdot\bar x=0).

Duals.

  1. (X+Y)⋅(X¯⋅Z¯)⋅(Y+Z)(X+Y)\cdot(\overline X\cdot\overline Z)\cdot(Y+Z) has dual (X⋅Y)+(X¯+Z¯)+(Y⋅Z).(X\cdot Y)+(\overline X+\overline Z)+(Y\cdot Z).
  2. X⋅X¯=0X\cdot\overline X=0 has dual X+X¯=1.X+\overline X=1 .

✓ Proof checked step by step We checked both duals by interchanging +↔⋅+\leftrightarrow\cdot and 0↔10\leftrightarrow1 symbol by symbol, leaving complements unchanged.

↑ Back to the question list

Represent (A¯+B¯+C¯)(A+B¯+C)(A+B+C¯) in NOR to NOR logic network.

2008 · Paper II · Q5d(ii) · 6 marks

Solution

A product of sums maps directly onto two levels of NOR gates. For sums S1,S2,S3S_1,S_2,S_3, De Morgan gives S1S2S3=S‾1+S‾2+S‾3¯=NOR(S‾1,S‾2,S‾3),\begin{aligned}S_1S_2S_3&=\overline{\bar S_1+\bar S_2+\bar S_3}\\ &=\text{NOR}(\bar S_1,\bar S_2,\bar S_3),\end{aligned} and each S‾k\bar S_k is itself a NOR of the literals in SkS_k: S‾1=NOR(A‾,B‾,C‾)S‾2=NOR(A,B‾,C)S‾3=NOR(A,B,C‾)\begin{aligned}\bar S_1&=\text{NOR}(\bar A,\bar B,\bar C)\\ \bar S_2&=\text{NOR}(A,\bar B,C)\\ \bar S_3&=\text{NOR}(A,B,\bar C)\end{aligned} So F=NOR(NOR(A‾,B‾,C‾),NOR(A,B‾,C),NOR(A,B,C‾)),\begin{aligned}F=\text{NOR}\big(&\text{NOR}(\bar A,\bar B,\bar C),\\ &\text{NOR}(A,\bar B,C),\\ &\text{NOR}(A,B,\bar C)\big),\end{aligned} with the complemented inputs made by NOR gates whose inputs are tied together.

ABCABCABCF
NOR–NOR network (small NOR gates with tied inputs act as inverters)

✓ Checked by computer We checked by computer: the NOR–NOR network and the product of sums agree on all 8 inputs.

↑ Back to the question list

More on Numerical Analysis and Computer Programming

Questions: UPSC Civil Services (Main) Examination, Mathematics Paper II, 2008–2026. 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