How do the logic operators AND, OR and NOT work, and how do you build a truth table?
Boolean logic: the operators AND, OR and NOT, applying them to expressions, and constructing truth tables for simple logic statements including combinations of operators.
An OCR J277 2.4.1 answer on Boolean logic: the operators AND, OR and NOT, applying them to expressions, and constructing truth tables for simple logic statements and combinations of operators.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
Jump to a section
What this dot point is asking
OCR wants you to use the three Boolean logic operators, AND, OR and NOT, apply them to expressions, and construct truth tables for simple statements, including expressions that combine operators. Boolean logic underpins both program conditions and the logic circuits inside a computer. This is examined in Paper 2, usually as "complete the truth table".
The three operators
Truth tables for single operators
The three basic truth tables:
| A | B | A AND B | A OR B |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 |
| A | NOT A |
|---|---|
| 0 | 1 |
| 1 | 0 |
Combining operators
Try this
Q1. State when the expression is false. [1 mark]
- Cue. Only when both A and B are false (0).
Q2. How many rows does a truth table with three inputs have? [1 mark]
- Cue. Eight (2 to the power 3).
Q3. State the output of . [1 mark]
- Cue. is 0, and NOT 0 is 1, so the output is 1.
Exam-style practice questions
Practice questions written in the style of OCR exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.
OCR 20214 marksComplete a truth table for the expression , and state in words when Q is true.Show worked answer →
AND gives true only when both inputs are true. With two inputs there are four rows.
: . : . : . : .
In words: Q is true only when both A and B are true (1).
Markers reward all four output rows correct and a clear statement that AND is true only when both inputs are true. Using 1 for true and 0 for false is expected; one slipped row loses the table mark.
OCR 20225 marksConstruct a truth table for the expression . There are three inputs.Show worked answer →
Three inputs give eight rows. Work out (A OR B) and (NOT C) first, then AND them.
When C = 1, NOT C = 0, so Q = 0 on all four of those rows regardless of A and B. When C = 0, NOT C = 1, so Q equals (A OR B): Q = 0 only when A = 0 and B = 0, and Q = 1 otherwise.
So Q = 1 on exactly these rows: (A=0,B=1,C=0), (A=1,B=0,C=0), (A=1,B=1,C=0). Q = 0 on the other five rows.
Markers reward a correct eight-row table with intermediate columns for (A OR B) and (NOT C), and the correct final Q column. Building the intermediate columns is the method that earns the working marks.
Related dot points
- Logic gates: the AND, OR and NOT gates and their symbols, reading and drawing simple logic circuit diagrams, and producing the truth table for a combination of gates.
An OCR J277 2.4.1 answer on logic gates: the AND, OR and NOT gates and their symbols, reading and drawing simple logic circuit diagrams, and working out the truth table for a combination of gates.
- The common operators: arithmetic (add, subtract, multiply, divide, exponent, MOD and DIV), comparison operators, and Boolean operators (AND, OR, NOT), and how they are used in expressions.
An OCR J277 2.2.2 answer on the common operators: arithmetic (including exponent, MOD and DIV), comparison operators, and the Boolean operators AND, OR and NOT, with worked examples of integer division and modulus.
- The three basic programming constructs: sequence, selection (if and switch/case) and iteration (count-controlled for loops and condition-controlled while and do until loops), and when to use each.
An OCR J277 2.2.2 answer on the three programming constructs: sequence, selection (if and switch/case) and iteration (count-controlled for loops and condition-controlled while and do until loops), with the OCR Exam Reference Language for each.
- The purpose of the CPU and the fetch-decode-execute cycle, the von Neumann architecture, and the function of common CPU components (ALU, CU, cache, registers including the MAR, MDR, Program Counter and Accumulator).
An OCR J277 1.1.1 answer on the purpose of the CPU, the fetch-decode-execute cycle, the von Neumann architecture, and the function of the ALU, control unit, cache and the named registers (MAR, MDR, Program Counter, Accumulator).
- Converting between denary and binary (up to and including 8 bits), binary addition and the detection of overflow, and binary shifts and their effect.
An OCR J277 1.2.4 answer on converting between denary and binary up to 8 bits, adding binary numbers and detecting overflow, and binary shifts and their effect on a value.
Sources & how we know this
- OCR GCSE (9-1) Computer Science (J277) specification — OCR (2020)