Boolean Algebra & Logic Gates
Level: 4 (Application — novel problems, no hints) Time limit: 60 minutes Total marks: 60
Answer all questions. Show all working. Use notation for Boolean expressions where denotes NOT, denotes AND, denotes OR, denotes XOR.
Question 1 — Number systems & two's complement [12 marks]
A microcontroller stores 8-bit signed integers in two's complement.
(a) Convert decimal to its 8-bit two's complement binary form, then express that byte in hexadecimal. [4]
(b) The register holds the byte 0xB6. Interpret it as (i) an unsigned integer and (ii) a signed two's complement integer. [3]
(c) Perform the 8-bit two's complement addition of and . State the resulting byte, the decimal value it represents when interpreted as signed, and whether overflow occurred (justify using the carry-in/carry-out or sign rule). [5]
Question 2 — Gate-level derivation & universal gates [14 marks]
A 2-input function produces output 1 only when the two inputs differ.
(a) Name this function and write its Boolean expression. [2]
(b) Construct the complete truth table for . [2]
(c) Prove algebraically that can be implemented using exactly four 2-input NAND gates. Show the intermediate signals. [6]
(d) A single NAND gate has propagation delay . Determine the worst-case propagation delay from an input transition to the output of your 4-NAND circuit, and explain which path is critical. [4]
Question 3 — SOP, POS and Boolean laws [12 marks]
Consider the function defined by the minterms:
(a) Write the canonical Sum-of-Products (SOP) expression. [3]
(b) Write the canonical Product-of-Sums (POS) expression by first identifying the maxterms. [3]
(c) Using only Boolean algebra laws (state each law used), simplify as far as possible. [6]
Question 4 — Karnaugh map with don't-cares [12 marks]
A 4-variable function of inputs is specified as: where denotes don't-care conditions.
(a) Draw the 4-variable K-map and enter the 1s, 0s and don't-cares. [4]
(b) Determine the minimal SOP expression, clearly circling/listing your prime implicant groups. State whether you used either don't-care to reduce the term count. [6]
(c) Count the number of 2-input gates (AND/OR only) required for a two-level implementation of your minimal SOP. [2]
Question 5 — Quine–McCluskey method [10 marks]
For the function
(a) Apply the Quine–McCluskey tabular method: group minterms by number of 1s, perform the combination steps, and list all prime implicants. [7]
(b) Build the prime implicant chart and derive the minimal expression. Identify any essential prime implicants. [3]
Answer keyMark scheme & solutions
Question 1 [12]
(a) in 8-bit two's complement. [4]
- (64+16+8+4+1). [1]
- Invert: . [1]
- Add 1: . [1]
- Hex: . [1]
(b) Byte 0xB6 = . [1]
- (i) Unsigned . [1]
- (ii) Signed: MSB=1 so negative. Two's complement: value . [1]
(c) : [5]
- , . [1]
- Sum: (= 146 unsigned). [2]
- Interpreted signed: MSB=1 → . [1]
- Overflow: two positives gave a negative sign → overflow occurred. (Carry into MSB = 1, carry out of MSB = 0; they differ ⇒ overflow.) [1]
Question 2 [14]
(a) Function is XOR. . [2]
(b) Truth table: [2]
| A | B | F |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
(c) 4-NAND XOR proof: [6] Let .
- . [1]
- . [1.5]
- . [1.5]
- (De Morgan). [2] This equals . ∎
(d) Propagation delay: [4]
- is level 1; are level 2 (fed by ); is level 3. [2]
- Critical path: input → → (or ) → = 3 gates in series. [1]
- Worst-case delay . [1]
Question 3 [12]
(a) Canonical SOP (m1,m2,m4,m7): [3] (1 mark for correct set, deduct for each wrong term; full 3 for all correct.)
(b) Maxterms are the remaining : [3]
(c) Simplify : [6]
- Combine (distributive/complement ). [2]
- Combine ... use again via idempotent . Take . [2]
- Combine . [1]
- Result: (majority function). [1]
Question 4 [12]
(a) K-map (rows AB, cols CD; order 00,01,11,10): [4]
| AB\CD | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | 1 | d | d | 1 |
| 01 | 0 | 1 | 1 | 0 |
| 11 | 0 | 1 | 1 | 0 |
| 10 | 1 | 0 | 0 | 1 |
(minterms: 0,2 in AB=00; 5,7 in AB=01; 8,10 in AB=10; 13,15 in AB=11; d=1,3 in AB=00)
(b) Grouping: [6]
- Ones at 5,7,13,15 → columns CD=01,11 with : group . [2]
- Ones at 0,2,8,10 (with don't-cares 1,3 available in AB=00):
- Group covers 0,2,8,10. [2]
- The don't-cares 1,3 could extend but are not needed; using alone is minimal.
- Minimal SOP: [1] This is the XNOR of and : . Don't-cares not needed for minimality. [1]
(c) Two-level: 2 AND gates (each 2-input) + 1 OR gate = 3 gates. (One AND needs via inverters, not counted as 2-input AND/OR.) [2]
Question 5 [10]
(a) QM combination for : [7]
Group by 1s (3-bit):
- 0 ones: 000 (0)
- 1 one: 001(1), 010(2)
- 2 ones: 101(5), 110(6)
- 3 ones: 111(7)
Combine size-2:
- 0-1: 00– (0,1)
- 0-2: 0–0 (0,2)
- 1-5: –01 (1,5)
- 2-6: –10 (2,6)
- 5-7: 1–1 (5,7)
- 6-7: 11– (6,7)
Combine size-4: none combine (differing patterns don't pair with matching dashes). Prime implicants: (0,1)=; (0,2)=; (1,5)=; (2,6)= wait: (2,6)=–10 → ; (5,7)=; (6,7)=. [7]
PIs: .
(b) PI chart (minterms 0,1,2,5,6,7): [3]
| PI | 0 | 1 | 2 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|
| (0,1) | ✓ | ✓ | ||||
| (0,2) | ✓ | ✓ | ||||
| (1,5) | ✓ | ✓ | ||||
| (2,6) | ✓ | ✓ | ||||
| (5,7) | ✓ | ✓ | ||||
| (6,7) | ✓ | ✓ |
No single essential PI (each minterm covered ≥2 ways). A minimal cover needs 3 PIs, e.g.: (covers 0,1 / 2,6 / 5,7 — all six minterms). Alternative equally minimal: . [3]
[
{"claim":"-93 in 8-bit two's complement equals 0xA3 (163 as unsigned pattern)","code":"val=(-93)%256; result = (val==0xA3)"},
{"claim":"0xB6 as signed 8-bit is -74","code":"u=0xB6; s=u-256 if u>=128 else u; result = (s==-74)"},
{"claim":"59+87 signed 8-bit overflows to -110","code":"r=(59+87)%256; s=r-256 if r>=128 else r; result = (r==0b10010010 and s==-110)"},
{"claim":"Q3(c) majority: minterm sum of BC+AC+AB equals AND/OR combos over the 4 given terms","code":"A,B,C=symbols('A B C'); f=(~A&B&C)|(A&~B&C)|(A&B&C)|(A&B&~C); g=(B&C)|(A&C)|(A&B); result = simplify_logic(f)==simplify_logic(g)"},
{"claim":"Q4 minimal F = BD + ~B~D equals XNOR of B,D over minterm set","code":"A,B,C,D=symbols('A B C D'); mins=[0,2,5,7,8,10,13,15]; dc=[1,3]; f=(B&D)|(~B&~D); vals=[]; \nfrom itertools import product\nok=True\nfor a,b,c,d in product([0,1],repeat=4):\n idx=a*8+b*4+c*2+d\n fv=1 if f.subs({A:a,B:b,C:c,D:d}) else 0\n if idx in mins:\n ok=ok and fv==1\n elif idx in dc:\n pass\n else:\n ok=ok and fv==0\nresult = ok"},
{"claim":"Q5 F=~A~B + B~C + AC covers exactly m(0,1,2,5,6,7)","code":"A,B,C=symbols('A B C'); f=(~A&~B)|(B&~C)|(A&C); cov=set(); \nfrom itertools import product\nfor a,b,c in product([0,1],repeat=3):\n if f.subs({A:a,B:b,C:c}): cov.add(a*4+b*2+c)\nresult = cov=={0,1,2,5,6,7}"}
]