Computer ScienceExam code: 0984

Logic Gates and Circuits

Boolean Logic

For longer questions the examiner gives the circuit and asks for the truth table for every input combination. The cleanest method is to add one column per gate in the order the signals flow, then fill in the table row by row.

Method. (1) Write down every input combination (2ⁿ rows). (2) Add an intermediate column for each internal gate, named after the gate (X, Y or Gate 1, Gate 2). (3) Fill in each intermediate column by applying the gate's rule to its input columns, row by row. (4) The final-output column Q is built from whatever feeds the last gate, using its rule.

Worked example

Completing the truth table for a multi-gate circuit

A logic circuit has three inputs A, B and C. It is described by the expression Q = (A AND B) OR (NOT C). An AND gate combines A and B; a NOT gate inverts C; then an OR gate combines those two results to give the final output Q. Complete the full truth table.

Solution:

Add one intermediate column per gate — label them A AND B and NOT C — then derive Q row by row.

ABCA AND BNOT CQ
000011
001000
010011
011000
100011
101000
110111
111101
  • A AND B is 1 only in the final two rows where both A and B are 1.
  • NOT C is 1 whenever C is 0 (rows 1, 3, 5, 7), and 0 whenever C is 1.
  • Q is 1 whenever at least one of those two intermediate values is 1; it is 0 only in rows 2, 4 and 6, where both intermediates are 0.

Build on this topic