You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
This lesson introduces Boolean logic, a fundamental concept in computer science that underpins how all digital computers make decisions. Boolean logic is named after the mathematician George Boole (1815-1864), who developed an algebraic system for logical reasoning. In the OCR J277 specification (Section 2.5), you are expected to understand Boolean values, logic gates, truth tables, and Boolean expressions.
A Boolean value is a data type that has only two possible states:
| Value | Meaning | Binary |
|---|---|---|
| TRUE | Yes / On | 1 |
| FALSE | No / Off | 0 |
Every decision a computer makes ultimately comes down to a choice between true and false. When you press a key on a keyboard, a circuit either has current flowing (1) or it does not (0). When a program checks whether a password is correct, the answer is either true or false.
OCR Exam Tip: In the OCR J277 exam, Boolean values are always represented as 1 (true) and 0 (false). Make sure you use 1 and 0 in truth tables, not the words "true" and "false".
Computers are built from billions of tiny electronic switches called transistors. Each transistor can be in one of two states: on (1) or off (0). By combining millions of these simple on/off switches using Boolean logic, computers can perform incredibly complex calculations.
Boolean logic is used in:
if statements and while loops use Boolean expressionsIn Python and OCR pseudocode, Boolean logic appears whenever you write a condition:
# Python example
age = 16
has_id = True
if age >= 18 and has_id:
print("Entry allowed")
else:
print("Entry denied")
// OCR pseudocode
age = 16
hasID = true
if age >= 18 AND hasID then
print("Entry allowed")
else
print("Entry denied")
endif
In both examples, the condition age >= 18 evaluates to false (because 16 is not greater than or equal to 18), and has_id evaluates to true. The AND operator requires both conditions to be true, so the overall result is false and "Entry denied" is printed.
A logic gate is an electronic component that takes one or more binary inputs and produces a single binary output based on a specific Boolean rule. Logic gates are the physical implementation of Boolean logic inside a computer's circuits.
The main logic gates you need to know for OCR J277 are:
| Gate | Inputs | Rule |
|---|---|---|
| NOT | 1 | Inverts the input |
| AND | 2 | Output is 1 only if both inputs are 1 |
| OR | 2 | Output is 1 if at least one input is 1 |
| XOR | 2 | Output is 1 if inputs are different |
| NAND | 2 | Output is 0 only if both inputs are 1 |
| NOR | 2 | Output is 0 if at least one input is 1 |
Each gate has a standard symbol used in circuit diagrams and a truth table that shows every possible combination of inputs and the resulting output.
OCR J277 examines only three operators — AND, OR, NOT. Every Boolean expression you write in Paper 2 must be expressible as a network of these three gates. The flow diagram below shows how the three gates take their inputs and produce a single output Q.
flowchart LR
subgraph NOTGate["NOT (1 input)"]
An((A)) --> NOT[NOT]
NOT --> Qn((Q = NOT A))
end
subgraph ANDGate["AND (2 inputs)"]
Aa((A)) --> AND[AND]
Ba((B)) --> AND
AND --> Qa((Q = A . B))
end
subgraph ORGate["OR (2 inputs)"]
Ao((A)) --> OR[OR]
Bo((B)) --> OR
OR --> Qo((Q = A + B))
end
Lessons 2-4 examine each of these three gates in detail. Later lessons show how they combine to express any Boolean function.
A truth table lists all possible input combinations for a logic gate and shows the output for each combination. For a gate with n inputs, there are 2^n rows in the truth table.
OCR Exam Tip: When constructing a truth table, always list the input combinations in a systematic order — start with all 0s and count up in binary: 00, 01, 10, 11. This ensures you do not miss any combinations.
| Term | Definition |
|---|---|
| Boolean value | A value that is either true (1) or false (0) |
| Logic gate | An electronic component that performs a Boolean operation |
| Truth table | A table showing all possible inputs and outputs for a logic operation |
| Boolean expression | A mathematical expression using Boolean operators (AND, OR, NOT) |
| Input | A value fed into a logic gate |
| Output | The result produced by a logic gate |
George Boole published The Laws of Thought in 1854, describing a mathematical system where statements could only be true or false. At the time, his work was viewed as pure mathematics with no practical use. Nearly a century later, in 1937, a young engineer called Claude Shannon wrote a master's thesis showing that Boole's algebra could describe the behaviour of electrical switching circuits. Shannon's insight — that ON/OFF switches correspond to TRUE/FALSE values — is the foundation of all modern digital electronics. Every smartphone, laptop, and games console in the world ultimately runs on Boolean logic.
OCR Exam Tip: Questions sometimes ask why Boolean logic is important to computing. A strong answer links the two-state nature of Boolean values (1/0) directly to the two physical states of transistors (ON/OFF, high voltage / low voltage).
OCR J277 restricts you to three logical operators: AND, OR, and NOT. Every Boolean problem in Paper 2 can be solved with just these three. Higher-tier operators such as XOR, NAND, NOR, and XNOR are covered at A Level (OCR H446 / J417), not at GCSE — so for your exam, keep your working strictly in terms of AND, OR, and NOT.
| Operator | Symbol in OCR algebra | Plain English | Example |
|---|---|---|---|
| AND | . (dot) | "both must be true" | A . B |
| OR | + (plus) | "at least one is true" | A + B |
| NOT | overbar (¯) | "is not true" | Ā |
Note that the + here is Boolean OR, not arithmetic addition. In Boolean algebra 1 + 1 = 1 because "true OR true = true". This is a classic misconception that costs students marks.
A library door opens automatically when a member card is presented (M) AND the library is open (L). Let M = 1 mean "card presented", and L = 1 mean "library open".
Expression: door_open = M AND L (written M . L)
| M | L | door_open |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Only the last row opens the door — both conditions must be satisfied. Real buildings use exactly this kind of Boolean logic in access-control systems.
With three inputs (A, B, C) there are 2^3 = 8 rows. Count in binary from 000 up to 111:
| A | B | C |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 0 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
| 1 | 1 | 1 |
A quick memory trick: the C column alternates 0,1,0,1,...; the B column alternates 00,11,00,11,...; the A column is 0000 then 1111. If you ever see an input column that does not follow this pattern, a row is missing.
"Boolean + means addition." No — + in Boolean algebra means OR. So 1 + 1 = 1, not 2. If the question asks for arithmetic, it will say "sum" or use clear number-line language.
"NOT means minus." No — NOT is inversion (flip). NOT 0 = 1 and NOT 1 = 0. There is no concept of negative numbers in Boolean algebra at GCSE.
"True is always 1." In OCR J277 exams, always write 1 and 0 in truth tables, not the words true and false. Writing "true/false" in a truth-table cell can cost a mark.
"Operator precedence doesn't matter." It does. Standard Boolean precedence is: NOT first, then AND, then OR. So A + B . C means A + (B . C), not (A + B) . C. Use brackets when in doubt — examiners reward clarity.
A vending machine dispenses a drink when a coin is inserted (C = 1) AND a button is pressed (B = 1), but only if the machine is not empty (E = 0 means not empty).
Write a Boolean expression for dispense.
Solution:
dispense = C AND B AND (NOT E)
Or in OCR algebra: dispense = C . B . Ē.
Now complete the truth table:
| C | B | E | NOT E | C AND B | dispense |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 1 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 1 | 0 | 1 | 0 |
Only one combination delivers a drink — coin in, button pressed, machine not empty.
Exam-style question (4 marks): "Explain what is meant by a Boolean value and give two examples of how Boolean values are used inside a computer system."
Grade 3-4 model answer:
A Boolean value is true or false. It can be 1 or 0. Computers use Boolean values in if statements and to turn things on and off.
Why this is Grade 3-4: The student recalls the definition and gives two very basic uses, but without specific technical vocabulary.
Grade 5-6 model answer:
A Boolean value is a data type with only two possible values: true (1) or false (0). Computers use Boolean values in conditional statements such as
ifin Python, so that the program can make decisions. They are also used inside the CPU where transistors are either on (1) or off (0), allowing arithmetic to be performed with binary numbers.
Why this is Grade 5-6: Correct definition, two clear examples with some technical detail (if statements, transistors, binary).
Grade 7-9 model answer:
A Boolean value is a data type that can take only one of two possible values, conventionally represented as 1 (true) or 0 (false). At the hardware level, Boolean values correspond to the two physical states of a transistor — high voltage (1) and low voltage (0) — which allows digital circuits to be constructed from billions of simple on/off switches. At the software level, Boolean values drive conditional execution: an
ifstatement evaluates a Boolean expression such asage >= 18 AND hasIDand follows one branch when the result is 1 and another when it is 0. Without Boolean values, programs would have no way to make decisions and digital electronics would have no way to encode information.
Why this is Grade 7-9: Precise definition, explicit link between hardware and software, correct use of technical vocabulary (conditional execution, transistor states), and evaluative language showing understanding of why the concept matters.
This content is aligned with OCR GCSE Computer Science (J277) specification section 2.4 Boolean Logic. For the most accurate and up-to-date information, please refer to the official OCR specification document.