SLIDE 1
CSZone.co.uk
Click to reveal · Arrow keys also work
OCR J277 · Component 2 · Topic 2.4.1a

Boolean Logic
Logic Gates

AND · OR · NOT — the three gates you need for OCR J277

CSZone OCR GCSE Computer Science J277
Learning Objectives

By the end of this video you will be able to...

Explain what Boolean logic is — a system where every input and output has exactly two possible values: 0 (FALSE) or 1 (TRUE) — and explain why logic gates are the building blocks of all digital hardware
Draw and recognise the symbol for each of the three OCR gates — NOT, AND, and OR — and state the rule each gate applies to produce its output
Write and complete a truth table for any single gate — listing all possible input combinations in order and giving the correct output value for each row
Write the correct Boolean notation for each gate: NOT A = A, A AND B = A · B, A OR B = A + B — and identify which gate each expression represents
Read a simple logic circuit diagram containing two gates, identify intermediate signals, and determine the output for a given set of inputs
⚡ Every processor decision — every IF statement, every loop condition — ultimately reduces to combinations of AND, OR, and NOT at the hardware level.
Boolean Logic

What is Boolean logic?

DEFINITION
Boolean logic is a system named after mathematician George Boole. Every variable has exactly two possible values: 1 (TRUE / HIGH) or 0 (FALSE / LOW). A logic gate is an electronic component that takes one or two Boolean inputs and produces a single Boolean output according to a fixed rule.
Gates are the building blocks of all digital circuits — every processor, memory chip, and piece of digital hardware is built from gates
Every IF statement in a program corresponds to logic gates making comparisons at the hardware level
WHAT DO 1 AND 0 MEAN?
1 = TRUE = HIGH voltage = switch closed = "yes". 0 = FALSE = LOW voltage = switch open = "no". In diagrams, inputs are labelled A (and B for two-input gates). The output is always labelled Q.
THE THREE GATES YOU NEED FOR OCR J277
GateInputsRule
NOT1Inverts — 0→1, 1→0
AND2Output 1 only if ALL inputs are 1
OR2Output 1 if ANY input is 1
A gate with 2 inputs has 4 possible input combinations: 00, 01, 10, 11. A gate with 1 input (NOT) has 2 combinations: 0 and 1. Always list all combinations in order — starting from 0.
TRUTH TABLES
A truth table lists every possible input combination and the output each one produces. It completely defines a gate's behaviour. Inputs are listed in binary counting order: for two inputs that's 00 → 01 → 10 → 11.
NOT Gate

NOT gate — the inverter

SYMBOL
A Q
RULE
The NOT gate inverts its input. If the input is 1, the output is 0. If the input is 0, the output is 1. It has one input and one output. Also called an inverter.
BOOLEAN NOTATION
Q = A    (read: "NOT A")
THE BUBBLE MEANS "INVERT"
The small circle at the output of the triangle is called a bubble. Whenever you see a bubble on any gate symbol, it means "invert the output at that point." The bubble is what makes this a NOT gate.
TRUTH TABLE
A (input)Q (output)
01
10
WORKED EXAMPLES
A = 0 → Q = 1  NOT 0 = 1
A = 1 → Q = 0  NOT 1 = 0
REAL-WORLD ANALOGY
A light switch wired to an alarm: when the switch is OFF (0), the alarm is ON (1). When the switch is ON (1), the alarm turns OFF (0). The output is always the opposite of the input.
AND Gate

AND gate — all inputs must be 1

SYMBOL
A B Q
RULE
Output is 1 only when ALL inputs are 1. If any input is 0, the output is 0. Think: "both A and B must be true."
BOOLEAN NOTATION
Q = A · B    (read: "A AND B")
MEMORY AID
AND = "BOTH must be 1". The flat left side and curved right side gives the gate a D-shape — think "D for Demanding." It demands all inputs are 1 before outputting 1. Out of 4 combinations, only 1 gives output 1.
TRUTH TABLE
ABQ = A · B
000
010
100
111
Out of 4 possible inputs, AND outputs 1 in only 1 case — when A=1 AND B=1. All other combinations give 0.
REAL-WORLD EXAMPLE
A car that only starts when the key is turned AND the seatbelt is fastened. Both conditions must be true at the same time — either one alone is not enough. A = key turned, B = seatbelt, Q = car starts.
OR Gate

OR gate — any input being 1 is enough

SYMBOL
A B Q
RULE
Output is 1 if ANY input is 1. Output is 0 only when ALL inputs are 0. Think: "at least one of A or B must be true."
BOOLEAN NOTATION
Q = A + B    (read: "A OR B")
MEMORY AID
OR = "ANY one is enough". The curved arrow shape points forward — it is generous, giving output 1 for any positive input. Out of 4 combinations, OR outputs 1 in 3 cases. Only 0,0 → 0.
TRUTH TABLE
ABQ = A + B
000
011
101
111
OR outputs 0 in only 1 case — when both inputs are 0. Every other combination gives 1.
REAL-WORLD EXAMPLE
A door alarm that triggers if the front door OR the back door is opened. Either one being open is enough to trigger the alarm. A = front door open, B = back door open, Q = alarm sounds.
Gate Comparison

Comparing NOT, AND and OR

ALL THREE TRUTH TABLES — SIDE BY SIDE
A B NOT A A AND B A OR B
0 0 1 0 0
0 1 1 0 1
1 0 0 0 1
1 1 0 1 1
NOT A uses only column A (single input). AND and OR use both columns A and B.
AND vs OR — THE KEY DIFFERENCE
AND outputs 1 in 1 out of 4 cases (only 1,1). OR outputs 1 in 3 out of 4 cases (everything except 0,0). AND is strict; OR is generous.
SYMBOL IDENTIFICATION
NOT
Triangle + bubble at output
AND
Flat left side, curved right (D-shape)
OR
Curved left and right (arrow shape)
QUICK RULES — LEARN THESE
NOT: output is always opposite the input
AND: output 1 only when A=1 and B=1
OR: output 0 only when A=0 and B=0
Boolean Notation

Writing Boolean expressions

THE THREE NOTATIONS
NOT
Q = A
A bar (overline) above A means NOT A. Read aloud: "Q equals NOT A"
AND
Q = A · B
A dot B means A AND B. The dot is like multiplication. Read: "Q equals A AND B"
OR
Q = A + B
A plus B means A OR B. Not addition — it's Boolean OR. Read: "Q equals A OR B"
IMPORTANT — + DOES NOT MEAN ADD
In Boolean logic, A + B does not mean add A and B together. It means A OR B. 1 + 1 = 1 in Boolean logic (not 2), because OR with both inputs as 1 still gives output 1.
COMBINING GATES — BRACKETS
When a circuit has two gates, substitute one output into the next using brackets. Brackets show which gate is evaluated first (just like in maths).

Example: A and B feed AND gate → P. Then P and C feed OR gate → Q.
Q = (A · B) + C
This means: compute A AND B first to get the intermediate result, then OR that with C.
READING AN EXPRESSION
A · BNOT A, then AND with B
(A · B) + CAND first, then OR with C
A + BNOT A, then OR with B
⚡ The outermost operator in an expression is the last gate — the one closest to output Q. The innermost (or in brackets) is the first gate. Read inside-out to trace the circuit order.
Logic Circuit

Reading a two-gate circuit — NOT into AND

CIRCUIT
Input A feeds through a NOT gate to produce intermediate signal P.
P and input B feed into an AND gate to produce final output Q.
Expression: Q = A · B
A B P AND Q
STEP 1 — FIND P (NOT A)
When A=0, P=1. When A=1, P=0. Fill the P column before touching Q.
STEP 2 — FIND Q (P AND B)
Output 1 only when both P=1 AND B=1.
ALWAYS ADD AN INTERMEDIATE COLUMN
Never try to jump from the inputs directly to Q. Add a column for every intermediate signal (P, X, etc.). Each column can earn its own marks independently — even if Q is wrong, a correct P column still scores.
COMPLETE TRUTH TABLE
ABP = AQ = P · B
0010
0111
1000
1100
Yellow = intermediate column P (marked separately). Purple = final output Q.
OBSERVATION
Q = 1 in only one case: A=0, B=1. The NOT gate on A means A must be off before the AND gate will let B through. This is sometimes called "B but not A."
TRACING ONE ROW — QUICK METHOD
If a question asks "what is Q when A=0 and B=1?" — trace gate by gate: Step 1: P = NOT 0 = 1. Step 2: Q = 1 AND 1 = 1. Answer: Q = 1. No need to build the full table for a single-row question.
Worked Example

Two-gate circuit — AND into OR

CIRCUIT
Inputs A and B both feed into an AND gate → intermediate signal P.
P and input B also feed into an OR gate → final output Q.
Expression: Q = (A · B) + B
A B AND P OR Q
STEP 1 — P = A AND B
P = 1 only when A=1 AND B=1. All other rows: P=0.
STEP 2 — Q = P OR B
Q = 1 when P=1 OR B=1.
COMPLETE TRUTH TABLE
ABP = A·BQ = P+B
0000
0101
1000
1111
INTERESTING RESULT
The Q column is identical to the B column — Q always equals B. This is because (A·B) OR B simplifies to just B by the Boolean absorption law. The AND gate makes no difference to the final output here. A circuit can contain more gates than are strictly necessary.
Exam Practice

Logic gates — exam questions

Question 1 — 1 mark
State the output of an AND gate when A = 1 and B = 0.
Answer — Q1
Output Q = 0. An AND gate outputs 1 only when ALL inputs are 1. Since B = 0, the output is 0. (1 mark)
Question 2 — 2 marks
Complete the truth table for an OR gate.

ABQ = A + B
00?
01?
10?
11?
Answer — Q2
ABQ = A + B
000
011
101
111
[1] rows 00→0 correct · [1] rows 01, 10, 11 → 1 all correct
Question 3 — 4 marks
A logic circuit has inputs A and B. Input A passes through a NOT gate to produce output P. P and B then feed into an AND gate to produce final output Q.

(a) Write the Boolean expression for P. [1]
(b) Write the Boolean expression for Q in terms of A and B. [1]
(c) Complete the truth table for this circuit: [2]

ABPQ
00??
01??
10??
11??
Exam Answers

Question 3 — mark scheme

MARK SCHEME
(a) P = A   [1]
(b) Q = A · B   [1]
(c) Truth table — 2 marks:
ABP = AQ = A·B
0010
0111
1000
1100
[1] P column all correct · [1] Q column all correct
HOW TO APPROACH CIRCUIT QUESTIONS
Always add a column for every intermediate signal. Work left to right — solve each gate in turn. Never try to calculate the final output directly without filling the P column first.
ALL THREE GATES — QUICK REFERENCE
GateNotationOutput 1 whenOutput 0 when
NOTAA = 0A = 1
ANDA · BA=1 AND B=1any input = 0
ORA + Bany input = 1A=0 AND B=0
GATE SYMBOLS — IDENTIFY THEM
Triangle + bubble = NOT D-shape = AND Arrow curve = OR
⚡ Exam tip: in a circuit question, read off the gate type from the symbol shape before filling any column. If you misidentify AND as OR (or vice versa), every value in that column will be wrong. Identify first, calculate second.
Common Mistakes

Common mistakes — avoid these in the exam

MISTAKE 1 — Confusing AND with OR
Students write 1 for AND when only one input is 1, because they mix it up with OR. AND is the strict gate — ALL inputs must be 1 for the output to be 1. OR is the generous gate — ANY input being 1 is enough. Getting these backwards corrupts every row of your truth table
✓ AND: only 1,1 → 1 (one case out of four). OR: only 0,0 → 0 (one case out of four — the opposite)
MISTAKE 2 — Getting the NOT truth table wrong
Students sometimes write NOT with two inputs, or write NOT 1 = 1. NOT has exactly one input and two rows in its truth table. It always produces the opposite: NOT 0 = 1 and NOT 1 = 0. There is no other possibility. Also, the bubble on the gate symbol — not the triangle shape — is what identifies a NOT gate
✓ NOT: 1 input, 2 rows. Output always flips: 0→1 and 1→0
MISTAKE 3 — Skipping the intermediate column
Students try to jump straight from A and B to Q without working out the intermediate signal P. This causes errors — especially when a NOT gate feeds into AND or OR — because you're trying to hold two calculations in your head at once. Intermediate columns also earn their own independent marks: a correct P column scores even if Q is wrong
✓ Always write a P column for every gate that is not the final output. Fill it completely before moving to Q
MISTAKE 4 — Wrong number of rows or wrong input order
Students forget to list all 4 input combinations, or list them in the wrong order (e.g. 00, 11, 01, 10 rather than 00, 01, 10, 11). A two-input gate has exactly 4 rows: 00, 01, 10, 11 in that binary counting order. Missing or reordering rows means some outputs will be wrong even if you applied the gate rule correctly
✓ Two inputs: always 4 rows, always in order 00 → 01 → 10 → 11
Summary

Key points — 2.4.1a

Boolean logic uses two values only — 1 (TRUE) and 0 (FALSE). Logic gates are electronic components that take Boolean inputs and produce a Boolean output according to a fixed rule. Inputs are labelled A and B; output is labelled Q
The three gates on OCR J277 are: NOT — inverts, 0→1 and 1→0, one input; AND — output 1 only when all inputs are 1, two inputs; OR — output 1 when any input is 1, two inputs. Learn the symbol shape for each
Boolean notation: NOT A is written as A with an overline. A AND B is A · B. A OR B is A + B. The plus sign in Boolean logic means OR — not addition. Brackets show which gate is evaluated first when combining gates
For circuit questions: add an intermediate column for every signal that is not an input and not the final output Q. Fill columns left to right — complete each gate's column before moving on. Columns are marked independently, so show all working
To identify a gate from its symbol: triangle with bubble = NOT. D-shape (flat left, curved right) = AND. Arrow/curved shape = OR. The bubble on a gate symbol always means "invert the output at that point"
⚡ Next topic: 2.4.1b — Truth Tables. Multi-gate circuits and constructing complete truth tables.
2.4.1a Complete

Logic Gates
NOT · AND · OR

Get the full resource pack at CSZone.co.uk

📄
Marked Worksheet
CSZone.co.uk
Quiz
CSZone.co.uk
📊
Slides
CSZone.co.uk
Next Up
2.4.1b — Truth Tables