You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
The OR gate takes two inputs and produces an output of 1 when at least one input is 1. It is one of the three fundamental logic gates (along with AND and NOT) and is essential knowledge for OCR J277 Section 2.5.
The OR gate implements logical disjunction. The output is 1 (true) when input A or input B (or both) is 1. The output is 0 only when both inputs are 0.
In Boolean algebra, OR is written as:
OCR Exam Tip: Be careful not to confuse the Boolean OR symbol (+) with arithmetic addition. In Boolean algebra, 1 + 1 = 1 (not 2). The + symbol means OR, not "add".
| A | B | A OR B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
The output is 0 in only one row — when both inputs are 0. In all other cases, the output is 1.
The standard OR gate symbol has a curved back (input side) and a pointed front (output side), resembling an arrowhead or shield shape:
flowchart LR
A((A)) --> OR["OR gate"]
B((B)) --> OR
OR --> Q((Q))
The two inputs enter from the left, and the single output exits from the right. There is no bubble at the output.
In Python:
# Using the or keyword
is_weekend = True
is_holiday = False
if is_weekend or is_holiday:
print("No school today!")
else:
print("Time for school")
In OCR pseudocode:
isWeekend = true
isHoliday = false
if isWeekend OR isHoliday then
print("No school today!")
else
print("Time for school")
endif
Since isWeekend is true, the OR condition evaluates to true — you only need at least one condition to be true.
Imagine two light switches connected in parallel controlling a single light bulb:
| Switch A | Switch B | Light |
|---|---|---|
| Off | Off | Off |
| Off | On | On |
| On | Off | On |
| On | On | On |
The light turns on if either switch (or both) is on. This is an OR operation.
| Feature | AND | OR |
|---|---|---|
| Output is 1 when... | Both inputs are 1 | At least one input is 1 |
| Output is 0 when... | At least one input is 0 | Both inputs are 0 |
| Number of 1s in output column | 1 out of 4 | 3 out of 4 |
| Boolean symbol | A . B | A + B |
| Real-world analogy | Switches in series | Switches in parallel |
This comparison is a common exam question. Make sure you can clearly explain the difference.
| Application | How OR is used |
|---|---|
| Alarm systems | An alarm triggers if sensor A OR sensor B detects movement |
| Error checking | A system flags an error if fault A OR fault B is detected |
| User interfaces | A menu appears if the user clicks the button OR presses the keyboard shortcut |
| Search engines | Results are returned if they contain keyword A OR keyword B |
When OR is applied to two binary numbers, each pair of corresponding bits is ORed:
| Operation | Bit 1 | Bit 2 | Bit 3 | Bit 4 |
|---|---|---|---|---|
| 1 | 0 | 1 | 1 | |
| OR | 1 | 1 | 0 | 0 |
| Result | 1 | 1 | 1 | 1 |
Each column: 1 OR 1 = 1, 0 OR 1 = 1, 1 OR 0 = 1, 1 OR 0 = 1.
| Operation | Bit 1 | Bit 2 | Bit 3 | Bit 4 |
|---|---|---|---|---|
| 0 | 0 | 1 | 0 | |
| OR | 1 | 0 | 0 | 1 |
| Result | 1 | 0 | 1 | 1 |
Confusing OR with XOR — OR outputs 1 when both inputs are 1; XOR outputs 0 when both inputs are 1. The only difference is the bottom row of the truth table.
Treating + as addition — in Boolean algebra, A + B means A OR B, not A plus B. The value 1 + 1 = 1 in Boolean, not 2.
Drawing the wrong symbol — the OR gate has curved sides. The AND gate has a flat left side. Do not mix them up.
OCR Exam Tip: If a truth table question gives three 1s in the output column and one 0, the gate is OR. If it gives one 1 and three 0s, the gate is AND.
Example 1: Evaluate A + B for specific inputs.
A = 0, B = 1. Then A + B = 0 + 1 = 1. Remember: this is Boolean OR, not arithmetic addition.
Example 2: OR with three inputs.
Evaluate Q = A + B + C when A = 0, B = 0, C = 1.
Q = 0 + 0 + 1 = 1. A single 1 is enough to make the whole OR expression true.
Example 3: OR combined with NOT.
Evaluate Q = (NOT A) + B for all possible inputs.
| A | B | NOT A | Q = (NOT A) + B |
|---|---|---|---|
| 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 |
Q is 0 only when A = 1 and B = 0 — that is, when both (NOT A) and B are 0.
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.