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.
By the end of this lesson you should be able to explain what Boolean values are and why they matter to computers. This develops AO1 (knowledge and understanding of the two-state Boolean logic that underpins digital decision-making).
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 2n 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.
It is easy to think of Boolean logic as something that lives only inside a processor, but the truth is that you interact with Boolean decisions dozens of times a day without noticing. Every time an app decides whether to show you a notification, whether a form can be submitted, or whether a game character can jump, a Boolean expression somewhere has been evaluated to 1 or 0. The reason the AND, OR and NOT operators are so powerful is that almost any real-world rule can be broken down into a combination of "both of these", "at least one of these" and "not this". Once you learn to translate an English sentence into those three operators, you can describe the decision-making logic of any system on the specification.
Consider a smartphone that only lets you pay by tapping the phone against a terminal when the screen is unlocked (U = 1) and the payment app is set as the default (D = 1) and you have not exceeded your daily spending limit (L = 0, where L = 1 means the limit has been reached). In plain English the rule is "allow the tap-to-pay only when the phone is unlocked and the app is the default and the limit has not been reached". Translating this word by word into the three J277 operators gives:
canPay = U AND D AND (NOT L)
The word "and" maps straight to the AND operator, and the phrase "has not been reached" tells you the L variable must be inverted with NOT. This kind of direct translation — reading the sentence and picking out the AND, OR and NOT words — is exactly what OCR examiners are testing when they set a scenario question. There is nothing mysterious about it once you practise it a few times.
A natural question is: why do computers use only two states rather than, say, ten states matching the decimal digits 0 to 9? The answer is about reliability. A transistor only has to tell the difference between "voltage present" and "voltage absent", which is easy to detect even when the signal is a little noisy or the components are slightly imperfect. If a circuit had to distinguish ten separate voltage levels, a small amount of electrical noise could push one level into another and corrupt the data. By committing to just two states — clearly separated high and low voltages representing 1 and 0 — digital systems become extremely tolerant of interference. This is the practical engineering reason behind Boolean logic's dominance, and it is a strong point to make in an exam answer that asks why computers are built on binary Boolean values.
A school library self-service kiosk allows a student to borrow a book (B = 1) only when their account is in credit (C = 1) and they are not already holding the maximum number of loans (M = 0, where M = 1 means the maximum has been reached), or when a librarian has manually overridden the check (V = 1). Write a Boolean expression.
Step 1 — Identify the two independent ways borrowing is allowed. Either "in credit AND not at the maximum", or "the librarian override is active".
Step 2 — Write each part. The first part is C AND (NOT M). The second part is simply V.
Step 3 — Join the two parts with OR because either route is sufficient:
canBorrow = (C AND (NOT M)) OR V
Notice how the brackets protect the AND from being accidentally read as part of the OR. This is the standard shape of a scenario answer: small AND/NOT groups joined by OR, with brackets making the precedence explicit.
Specimen question modelled on the OCR J277 format (4 marks):
A car's engine-start system allows the engine to start (S = 1) only when the brake pedal is pressed (B = 1) and the gear selector is in Park (P = 1). Define what is meant by a Boolean value (1 mark), write a Boolean expression for S using only AND, OR and NOT (2 marks), and state the one input combination for which S = 1 (1 mark).
Mark scheme (indicative):
S = B AND P. Award 1 mark for correctly using AND, and 1 mark for a fully correct expression with both variables. A candidate writing "B OR P" earns 0 for the operator because OR does not require both conditions.Examiner-style commentary based on common feedback patterns: the definition mark is almost always earned, but candidates lose the operator mark by reaching for OR when the scenario clearly says "and". A reliable habit is to underline every "and", "or" and "not" in the question before writing anything, because those three words map directly onto the three operators the specification examines.
"A Boolean value can be 'maybe' or 'unknown'." Not at GCSE. In the J277 model there is no third state — every Boolean value is exactly 1 or 0. Systems that appear to handle "unknown" actually store that information using extra Boolean variables, not a third value.
"The words AND, OR, NOT mean the same in Boolean logic as in casual speech." Mostly, but be careful with OR. In everyday English "tea or coffee?" often implies one or the other, not both. In Boolean logic, plain OR is inclusive — it is still 1 when both inputs are 1. The exclusive "one but not both" meaning is a different operator that is not part of the J277 core.
"Boolean logic is just for hardware." It runs equally in software: every if condition, every loop guard, and every database filter is a Boolean expression. Being comfortable moving between the hardware view (gates and voltages) and the software view (conditions and keywords) is exactly the flexible understanding the specification rewards.
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.