Boolean logic is the foundation of computing. Every decision a computer makes is based on values that are either True (1) or False (0). Three fundamental Boolean operators are used in OCR J277: AND, OR, and NOT.
Boolean expressions evaluate to True or False. They are used in IF conditions, WHILE loops, and to design logic circuits.
AND outputs True only when ALL inputs are True. If any input is False, the output is False.
Real example: "You can enter a concert IF you have a ticket AND you are over 18."
| A | B | A AND B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
OR outputs True when AT LEAST ONE input is True. It only outputs False when ALL inputs are False.
Real example: "You get a discount IF you are a student OR a senior citizen."
| A | B | A OR B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
NOT takes a single input and inverts it. True becomes False; False becomes True.
Real example: "NOT logged in → show login page"
| A | NOT A |
|---|---|
| 0 | 1 |
| 1 | 0 |
Operators can be combined to make more complex expressions. Evaluate NOT first, then AND, then OR — unless brackets change the order.
Example: A AND NOT B
| A | B | NOT B | A AND NOT B |
|---|---|---|---|
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
Boolean operators appear directly in OCR J277 pseudocode conditions:
A truth table with n inputs has 2ⁿ rows. Two inputs → 4 rows (2²). Three inputs → 8 rows (2³).
8 questions · 24 marks
| Term | Definition |
|---|
10 questions · 10 marks · 10 minutes