Data & representation · Higher

Boolean Logic & Truth Tables

Boolean logic underpins circuits and conditions in programs. Truth tables show outputs for every input combination.

Basic gates

• **AND** – true only if all inputs true • **OR** – true if at least one input true • **NOT** – inverts the input In programming, these combine conditions in IF statements.

Truth tables

List every combination of inputs (0/1) and the output. For two inputs there are 4 rows; for three inputs, 8 rows.

Worked example

Output of A AND NOT B when A=1, B=0?

Solution: NOT B = 1; 1 AND 1 = **1**

Practice questions

1. When is AND true?

2. How many rows in a truth table with 3 inputs?