Blog
Digital Logic Design Past Paper 2026 – BS CS, IT & SE 2nd Semester UOS (CMPC-5204)
University of Sargodha Digital Logic Design (CMPC-5204) paper for AD/BS Computer Science, IT and Software Engineering 2nd semester, 2026 exam (40 marks, 2:30 hours) – one of the newest papers on the site. The paper has been retyped, and solved answers are given below for all 8 short questions and all five long questions, including the full adder, seven-segment decoder, K-maps and the circuit for F and G. All working was checked by computer.
Solved answers
Q1 – Short answers (8 × 2)
I. +19 and −19 (8-bit): 19 = 100112.
| Form | +19 | −19 |
|---|---|---|
| Sign-magnitude | 00010011 | 10010011 |
| 1’s complement | 00010011 | 11101100 |
| 2’s complement | 00010011 | 11101101 |
II. Add 01000100 + 00011011 + 00001110 + 00010010: (The printed first number “a 1000100” is 01000100.) 01000100 + 00011011 = 01011111 (68 + 27 = 95); 01011111 + 00001110 = 01101101 (109); 01101101 + 00010010 = 01111111 = +127. No overflow, because 127 still fits in 8-bit signed range.
III. Subtractions (2’s complement: add the 2’s complement of the subtrahend): (a) 00001000 − 00000011 = 00001000 + 11111101 = 1 00000101 → discard carry → 00000101 (8 − 3 = +5).
(b) 00001100 − 11110111: 11110111 = −9, its 2’s complement is 00001001, so 00001100 + 00001001 = 00010101 (12 − (−9) = +21).
IV. Binary to hexadecimal (group 4 bits from the right): (a) 100 1010 0101 0111 = 0100 1010 0101 0111 = 4A5716
(b) 1111 1000 0110 1001 = F86916
V. XOR vs OR: An OR gate gives 1 when at least one input is 1 (including both 1). An XOR gate gives 1 only when the inputs are different (an odd number of 1s); for inputs 1, 1 OR gives 1 but XOR gives 0. YOR = A + B, YXOR = A⊕B = AB + AB.
VI. De Morgan’s theorems: (a) (A + B + C)D = A + B + C + D = ABC + D
(b) AB + CD + EF = AB · CD · EF = (A + B)(C + D)(E + F)
VII. Simplify [AB(C + BD) + AB]C: AB(C + BD) = ABC + ABBD = ABC + 0 (since BB = 0).
So [ABC + AB]C = ABC + ABC = BC(A + A) = BC
VIII. Standard SOP of ABC + AB + ABCD: Add the missing variables to each term:
ABC = ABC(D + D) = ABCD + ABCD
AB = ABCD + ABCD + ABCD + ABCD
F = ABCD + ABCD + ABCD + ABCD + ABCD + ABCD + ABCD = Σm(0, 1, 2, 3, 10, 11, 13)
Q2 – Full adder: logic diagram and truth table
A full adder adds three bits: A, B and the carry-in Cin, and gives Sum (S) and Carry-out (Cout).
| A | B | Cin | S | Cout |
|---|---|---|---|---|
| 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 |
S = Σm(1, 2, 4, 7) = A ⊕ B ⊕ Cin
Cout = Σm(3, 5, 6, 7) = AB + Cin(A ⊕ B) (= AB + ACin + BCin)
Logic diagram: it is built from two half adders and one OR gate. XOR-1 gives A⊕B; XOR-2 gives (A⊕B)⊕Cin = S. AND-1 gives AB, AND-2 gives Cin(A⊕B), and the OR gate combines them into Cout.
Q3 – Seven-segment display: truth table and logic
A BCD-to-seven-segment decoder takes a 4-bit BCD digit (A B C D, A = MSB) and turns on segments a–g of a common-cathode display (1 = segment ON). Inputs 1010–1111 are not valid BCD and are used as don’t-cares (X).
| Digit | A | B | C | D | a | b | c | d | e | f | g |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 |
| 2 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 |
| 3 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 |
| 4 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 |
| 5 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 |
| 6 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 |
| 7 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
| 8 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| 9 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 |
| 10–15 | 1 | x | x | x | X | X | X | X | X | X | X |
Segment layout: a = top, b = top-right, c = bottom-right, d = bottom, e = bottom-left, f = top-left, g = middle. Simplified with K-maps (using don’t-cares):
- a = A + C + BD + BD
- b = B + CD + CD
- c = B + C + D
- d = A + BC + CD + BD + BCD
- e = BD + CD
- f = A + BC + BD + CD
- g = A + BC + BC + CD
Logic diagram: the inputs A, B, C, D and their complements (from four NOT gates) feed AND gates that form each product term above, and one OR gate per segment combines its terms to give outputs a–g, which drive the seven LED segments (with a 7447/7448 decoder IC doing the same job in practice).
Q4 – Decoder and 4-bit (4-to-16) decoder truth table
A decoder is a combinational circuit that converts an n-bit binary input into one of 2n outputs: exactly one output is active (1) for each input combination, i.e. each output is one minterm. It is used for memory address decoding, selecting devices, seven-segment drivers and implementing Boolean functions. A 4-bit decoder (4-to-16 line) has inputs A B C D and outputs D0–D15, with Di = mi, e.g. D0 = ABCD, D15 = ABCD. With an enable input E, all outputs are 0 when E = 0.
| A | B | C | D | Active output (= 1) | Minterm |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | D0 (all others 0) | m0 |
| 0 | 0 | 0 | 1 | D1 (all others 0) | m1 |
| 0 | 0 | 1 | 0 | D2 (all others 0) | m2 |
| 0 | 0 | 1 | 1 | D3 (all others 0) | m3 |
| 0 | 1 | 0 | 0 | D4 (all others 0) | m4 |
| 0 | 1 | 0 | 1 | D5 (all others 0) | m5 |
| 0 | 1 | 1 | 0 | D6 (all others 0) | m6 |
| 0 | 1 | 1 | 1 | D7 (all others 0) | m7 |
| 1 | 0 | 0 | 0 | D8 (all others 0) | m8 |
| 1 | 0 | 0 | 1 | D9 (all others 0) | m9 |
| 1 | 0 | 1 | 0 | D10 (all others 0) | m10 |
| 1 | 0 | 1 | 1 | D11 (all others 0) | m11 |
| 1 | 1 | 0 | 0 | D12 (all others 0) | m12 |
| 1 | 1 | 0 | 1 | D13 (all others 0) | m13 |
| 1 | 1 | 1 | 0 | D14 (all others 0) | m14 |
| 1 | 1 | 1 | 1 | D15 (all others 0) | m15 |
Q5 – K-map simplification
(a) F(x, y, z) = Σ(2, 3, 6, 7)
The minterms 010, 011, 110, 111 all have y = 1 and fill the two right-hand columns (yz = 11 and 10) of both rows, forming one group of four. x and z change inside the group, so F = y.
| x \ yz | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 |
(b) F(A, B, C, D) = Σ(4, 6, 7, 15)
| AB \ CD | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | 0 | 0 | 0 | 0 |
| 01 | 1 (m4) | 0 | 1 (m7) | 1 (m6) |
| 11 | 0 | 0 | 1 (m15) | 0 |
| 10 | 0 | 0 | 0 | 0 |
Group m4 + m6 (row 01, columns 00 and 10 wrap around): ABD. Group m7 + m15 (column 11, rows 01 and 11): BCD. These two groups cover all four minterms (m6 + m7 = ABC is not needed).
F = ABD + BCD
Q6 – Output expressions F and G of the circuit
Name the gate outputs, from left to right:
- NOT gate: A
- AND gate: BC
- Lower NAND (inputs A and D): N2 = AD = A + D
- Upper NAND (inputs A and N2): N1 = A·N2 = A + N2 = A + AD = A + D
- OR gate (inputs A and BC): R = A + BC
F = N1 · R = (A + D)(A + BC) = AA + ABC + AD + BCD = ABC + AD + BCD.
BCD is the consensus term of ABC and AD, so it is redundant: F = ABC + AD
G = R · N2 = (A + BC)(A + D) = AA + AD + ABC + BCD = AD + ABC + BCD.
BCD is the consensus of ABC and AD: G = ABC + AD
Check: the results were verified for all 16 input combinations by evaluating the gate network directly.
