Logic gates and logic circuits

Computer Science AS · Hardware. The idea in plain words, the rules to remember, the mistake to avoid and a worked example, written and checked by Mega Lecture.

Test this topic freeAll Computer Science AS topics

The idea

A logic gate takes one or two binary inputs and gives one binary output. There are six gates to know: NOT, AND, OR, NAND, NOR and XOR. A truth table lists the output for every possible combination of inputs. With n inputs there are 2n rows.

The same logic can be shown in four ways: a problem statement in words, a logic expression, a logic circuit and a truth table. You must be able to change any one into another.

Work in small stages. Find the output of each bracket or each gate first, as an extra column, then combine these columns to get the final output.

Rules to remember

Common mistake

Students apply NOT to the wrong part. NOT (A OR B) inverts the result of the OR, but NOT A OR B inverts only A. These give different truth tables.

Worked example

In the eight-row truth table for X = (A AND NOT B) OR (B AND C), how many rows have X = 1?

  1. A AND NOT B is 1 when A = 1 and B = 0, with C either value: rows 1 0 0 and 1 0 1.
  2. B AND C is 1 when B = 1 and C = 1, with A either value: rows 0 1 1 and 1 1 1.
  3. No row is in both lists, because one needs B = 0 and the other B = 1, so the OR gives 2 + 2 = 4 rows.

Answer: Four rows have X = 1.

Ask about this

Type what you are stuck on. The helper finds the explanation, worked examples and the notes to read, free and instant.

Keep going

← Computers and their componentsCentral Processing Unit (CPU) architecture →Take a Computer Science AS test