Computer Hardware and Logic Circuits: Question 5

Syllabus 3.2

Structured AS 9 marks

A logic circuit has three inputs, A, B and C, and one output, X. It is built from three gates, connected as follows:

  • Gate 1 is a two-input NAND gate, with inputs A and B. Its output is called N1.
  • Gate 2 is a single-input NOT gate, with input C. Its output is called N2.
  • Gate 3 is a two-input XOR gate, with inputs N1 and N2. Its output is the output of the whole circuit, X.

Write Boolean expressions in plain text: use . for AND, + for OR, and NOT immediately before a term for NOT (for example, NOT (A.B)).

(a) Describe how the symbol for a NAND gate differs from the symbol for an AND gate. [1]

(b) Write the Boolean expression for X in terms of A, B and C. [2]

(c) Complete the truth table for this circuit for all eight combinations of A, B and C, showing the intermediate outputs N1 and N2 as well as the final output X. [4]

(d) A colleague claims that only inputs A and C affect the output X, and that input B has no effect at all. Using two rows of your completed truth table that have the same values of A and C but different values of B, show that the colleague is incorrect. [2]

Show worked solution Hide worked solution

Worked solution

Part (a): The NAND gate’s symbol

A NAND gate is simply an AND gate with its output inverted. Its symbol is drawn as the standard AND gate shape (a flat back, rounded/D-shaped front), with a small circle, a “bubble”, added at the output. This bubble is the standard way of showing inversion on a gate symbol, and the same idea turns an OR gate symbol into a NOR gate symbol.

Part (b): The Boolean expression for X

Working through the circuit gate by gate:

  • Gate 1 (NAND, inputs A and B): N1 = NOT (A.B)
  • Gate 2 (NOT, input C): N2 = NOT C
  • Gate 3 (XOR, inputs N1 and N2): X = N1 XOR N2

Substituting N1 and N2 into the expression for X:

X = NOT (A.B) XOR NOT (C)

Part (c): Completing the truth table

There are three inputs, so the truth table needs 2 to the power 3, which is 8, rows. Work out N1, then N2, then X for each row:

  • N1 = NOT (A.B): this is 0 only when A = 1 and B = 1 (i.e. only in the last two rows), and 1 otherwise.
  • N2 = NOT C: this is simply the opposite of C.
  • X = N1 XOR N2: this is 1 only when N1 and N2 are different from each other, and 0 when they are the same.
ABCN1 = NOT(A.B)N2 = NOT CX = N1 XOR N2
000110
001101
010110
011101
100110
101101
110011
111000

Check the two rows where A = B = 1: here A.B = 1, so N1 = NOT 1 = 0, unlike every other row where N1 = 1. This is the only place the NAND gate’s inversion changes which rows get an N1 of 0, so it is worth double-checking those two rows carefully, as done above.

Part (d): Testing the colleague’s claim

To isolate the effect of B alone, compare two rows that share the same A and the same C, but have different B:

Take A = 1, B = 0, C = 0, which gives X = 0, and A = 1, B = 1, C = 0, which gives X = 1.

In both rows, A = 1 and C = 0. Neither has changed. Only B has changed, from 0 to 1, and the output X has changed too, from 0 to 1. If B genuinely had no effect on the output, X would have to stay the same across these two rows, since A and C are unchanged. Because X does change, B does affect the output, so the colleague’s claim is incorrect.

(The same conclusion can be reached using A = 1, B = 0, C = 1, X = 1 compared with A = 1, B = 1, C = 1, X = 0. Another pair with matching A and C but different B and different X.)

Final answers

  • (a) The NAND symbol is the AND gate symbol with a small circle (“bubble”) added at the output, showing the AND result is inverted.
  • (b) X = NOT (A.B) XOR NOT (C)
  • (c) X values in order (A,B,C from 000 to 111): 0, 1, 0, 1, 0, 1, 1, 0, see the completed table above.
  • (d) Incorrect: e.g. rows A = 1, B = 0, C = 0 (X = 0) and A = 1, B = 1, C = 0 (X = 1) have the same A and C but different B and different X, so B does affect the output.