Skip to content
SPM Tuition
Computer Science · Computing systems and logic

Reading Boolean expressions and truth tables

You know what AND and OR mean, but a truth table with three columns still trips you up.

A Boolean expression combines inputs that are 0 or 1 using AND, OR and NOT. A truth table lists every input combination and the output each one gives.

This lesson is part of computing systems and logic. Next you can use it in explaining selected logic circuits.

What does each operator do?

Operator Output is 1 when Example
AND both inputs are 1 1 AND 1 = 1, 1 AND 0 = 0
OR at least one input is 1 1 OR 0 = 1, 0 OR 0 = 0
NOT the input is 0 NOT 0 = 1, NOT 1 = 0

NOT acts on one input only, so it is applied before AND or OR unless a bracket says otherwise.

Worked example: Q = A AND NOT B

Two inputs give four rows. Add a helper column for NOT B, then combine it with A.

A B NOT B Q = A AND NOT B
0 0 1 0
0 1 0 0
1 0 1 1
1 1 0 0

Q is 1 in one row only, where A is 1 and B is 0. In words: the output is on when A is on and B is off.

The mistake that costs marks

The common slip is to treat NOT as if it covered the whole expression. The two expressions below look alike but give different tables.

A B NOT B A AND NOT B NOT (A AND B)
0 0 1 0 1
0 1 0 0 1
1 0 1 1 1
1 1 0 0 0

The last column is NOT (A AND B), which is 0 only when both inputs are 1. The bracket makes NOT apply to the result of the AND. Always check whether NOT sits on one letter or on a bracket.

Check yourself

Build the truth table for Q = NOT A OR B. Then say in which row Q equals 0.

Answer
A B NOT A Q = NOT A OR B
0 0 1 1
0 1 1 1
1 0 0 0
1 1 0 1

Q equals 0 only in the row A = 1, B = 0. Notice this is the opposite pattern of the worked example, where that same row was the only 1.

What to study next

Truth tables are the tool for checking a circuit. Continue with explaining selected logic circuits, then test yourself on the computing systems and logic practice set.

If you want a teacher to go through truth tables on your own questions, see online one-to-one Computer Science tuition.

Common questions

What do AND, OR and NOT do?

AND gives 1 only when both inputs are 1. OR gives 1 when at least one input is 1. NOT flips a single input, so 1 becomes 0 and 0 becomes 1. Other gates, such as NAND, are built from these three.

How many rows does a truth table need?

With n inputs you need 2 to the power n rows. Two inputs give 4 rows, and three inputs give 8 rows. List the rows in counting order from 00 or 000 upward so that none is missed or repeated.

In what order do I evaluate an expression?

Work out brackets first, then NOT, then AND, then OR. Adding an extra column for each step, such as a NOT B column, keeps the working visible and makes errors easy to find.

If truth tables go wrong under time pressure, one-to-one Computer Science lessons let a teacher watch you fill the columns and catch the exact step where a value flips.

  • Online one-to-one lessons for your child with an experienced teacher.
  • Your first class is a one-hour trial, from RM50. The fee is agreed before you book.
  • Happy with the teacher? Continue with lessons of about 1.5 hours. If not, ask for another teacher.