DLD - Digital Logic Design, Past Papers, UOS Main Campus

Digital Logic Design Past Paper 2026 – BS CS, IT & SE 2nd Semester UOS (CMPC-5204)

ProgramBS CS
Semester2nd
Year2026
Course codeCMPC-5204
AnswersSolved ✓

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-magnitude0001001110010011
1’s complement0001001111101100
2’s complement0001001111101101

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

ABCinSCout
00000
00110
01010
01101
10010
10101
11001
11111

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.

ABCinSCoutA⊕BCin(A⊕B)AB
Full adder: S = A⊕B⊕Cin, Cout = AB + Cin(A⊕B)

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

DigitABCDabcdefg
000001111110
100010110000
200101101101
300111111001
401000110011
501011011011
601101011111
701111110000
810001111111
910011111011
10–151xxxXXXXXXX

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.

ABCDActive output (= 1)Minterm
0000D0 (all others 0)m0
0001D1 (all others 0)m1
0010D2 (all others 0)m2
0011D3 (all others 0)m3
0100D4 (all others 0)m4
0101D5 (all others 0)m5
0110D6 (all others 0)m6
0111D7 (all others 0)m7
1000D8 (all others 0)m8
1001D9 (all others 0)m9
1010D10 (all others 0)m10
1011D11 (all others 0)m11
1100D12 (all others 0)m12
1101D13 (all others 0)m13
1110D14 (all others 0)m14
1111D15 (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 \ yz00011110
00011
10011

(b) F(A, B, C, D) = Σ(4, 6, 7, 15)

AB \ CD00011110
000000
011 (m4)01 (m7)1 (m6)
11001 (m15)0
100000

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:

  1. NOT gate: A
  2. AND gate: BC
  3. Lower NAND (inputs A and D): N2 = AD = A + D
  4. Upper NAND (inputs A and N2): N1 = A·N2 = A + N2 = A + AD = A + D
  5. 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.

Save this paper for offline studyDownload the question paper, or save the paper together with all solved answers as a PDF.
↓ Download Paper (JPG)

About Saif R

An educator and technology enthusiast passionate about empowering students through quality education and digital learning. Dedicated to making academic resources and opportunities accessible to everyone.