Truth tables
A truth table for three inputs lists every combination of those inputs next to the output of the logical expression. The expression can mix AND, OR and NOT, so work out each row from all three values together, not from a single input alone.
AND gives 1 only when every input is 1, so with three inputs all three must be 1. A single 0 anywhere is enough to make the output 0. OR is the mirror image: it gives 0 only when all three inputs are 0, and one 1 is enough to make the output 1. OR is inclusive, so two or even three 1s also give 1.
Compare A = 1, B = 1 and C = 0. A AND B AND C is 0 because C fails, while A OR B OR C is 1 because two of the inputs already succeed.
Read the problem and pin down what the inputs are, what the output is, and how they combine. A laptop's cooling fan runs fast when a game is running OR the processor is hot, but not when quiet mode is on. The inputs are game running (G), processor hot (H) and quiet mode (Q), and the output is fan fast (F), giving F = (G OR H) AND NOT Q.
Then apply the operators to each of the eight rows: the bracket is worked out first, and NOT Q flips that one input only. Where G = 1, H = 0 and Q = 0, the bracket gives 1 and NOT Q gives 1, so F = 1. Change Q to 1 and F becomes 0 however hard the game is working, because quiet mode overrides the other two inputs.
| G | H | Q | F = (G OR H) AND NOT Q |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 0 |
Edexcel GCSE Computer Science · Truth tables