KS48525 3.4.2 28 min read 10 question quiz 12 exam marks

Boolean Logic

NOT, AND, OR and XOR, how to build and read a logic circuit diagram, and a reliable method for completing the truth table of a combined circuit without guessing.

The four gates

A logic gate is a physical circuit taking one or more binary inputs and producing one binary output according to a fixed rule.

NOT

Inverts its single input. Written as NOT A.

AQ
01
10

AND

Output is 1 only when both inputs are 1. Written as A AND B.

ABQ
000
010
100
111

OR

Output is 1 when at least one input is 1. Written as A OR B.

ABQ
000
011
101
111

XOR

Exclusive OR. Output is 1 when the inputs are different. Written as A XOR B.

ABQ
000
011
101
110
OR and XOR differ in exactly one row

Both give 1 when one input is 1. Only OR also gives 1 when both are. Learn the bottom row and you have learned the difference.

The six logic gates with symbols, expressions and truth tablesSix logic gates, each with its British Standard symbol, its Boolean expression and its truth table. AND, written Q equals A dot B, gives 1 only when both inputs are 1. OR, written Q equals A plus B, gives 1 when at least one input is 1. NOT, a triangle with a small circle, inverts its single input, so 0 becomes 1 and 1 becomes 0. XOR, exclusive or, gives 1 when the inputs are different and 0 when they are the same. NAND is AND followed by an inverting circle, so it gives 0 only when both inputs are 1 and 1 otherwise. NOR is OR followed by an inverting circle, so it gives 1 only when both inputs are 0.ANDQ = A . BABQABQ000010100111ORQ = A + BABQABQ000011101111NOTQ = NOT AAQAQ0110XORQ = A xor BABQABQ000011101110NANDQ = NOT (A . B)ABQABQ001011101110NORQ = NOT (A + B)ABQABQ001010100110
The small circle on a symbol always means invert. Learn AND, OR and NOT, then NAND, NOR and XNOR are just those with a circle added.

Reading and drawing circuit diagrams

A logic circuit joins gates together, with the output of one becoming the input of the next.

To read a circuit, work from the inputs on the left towards the output on the right, naming the output of each gate as you go. Never try to see the whole thing at once.

For the circuit Q = (A AND B) OR (NOT C):

  • A and B go into an AND gate. Call its output X.
  • C goes into a NOT gate. Call its output Y.
  • X and Y go into an OR gate, and its output is Q.

Writing the expression from the diagram is the same process in reverse, working outwards from the inputs and bracketing each gate's output before it feeds the next.

Brackets change the answer

(A AND B) OR C and A AND (B OR C) are different circuits with different truth tables. If you are asked to write an expression from a diagram, the brackets are part of the answer.

Tracing a signal through a logic circuitA circuit with two inputs, A and B, feeding an AND gate whose output feeds a NOT gate, which produces the output Q, drawn twice. Every wire carries a 1 or a 0, written on it, and a wire carrying a 1 is drawn lit. In the first case A is 1 and B is 0. The AND gate outputs 1 only when both its inputs are 1, so it outputs 0. The NOT gate inverts whatever it is given, so that 0 becomes a 1 and Q is 1, and the bulb is on. In the second case both A and B are 1, so the AND gate outputs 1, the NOT gate inverts it, and Q becomes 0 and the bulb is off. A truth table beside the circuit lists all four combinations, with Q equal to 1 in every row except the one where both inputs are 1. The whole circuit is Q equals NOT, bracket, A AND B, bracket, and a combination that common has its own name and symbol: it is a NAND gate. When reading a circuit in an exam, work left to right and write the value on every wire as you go, because the marks are for the intermediate columns as much as the answer.A = 1, B = 0ABANDNOT1001Q = 1A = 1, B = 1ABANDNOT1110Q = 0Truth tableABANDQ0001010110011110Q is 1 every timeexcept when A and Bare both 1Q = NOT (A AND B)that is a NAND gate12345
  1. Two inputs, one AND gate, one NOT gate, one output.
  2. A = 1 and B = 0. AND needs both, so it gives 0.
  3. NOT flips it, so Q becomes 1.
  4. A = 1 and B = 1. AND gives 1, NOT flips it, Q is 0.
  5. Q = NOT (A AND B). That is a NAND gate, written out.
Label every wire as you go. An intermediate column in a truth table is a mark, and it is also how you catch your own mistake.

Truth tables for combined circuits

This is where marks are won and lost, and there is a method that removes the guesswork entirely.

Step 1: work out how many rows. Two inputs give 4 rows, three inputs give 8, four give 16. It is 2 to the power of the number of inputs.

Step 2: fill the input columns systematically. With three inputs, the right hand column alternates 0 1 0 1, the middle alternates in pairs 0 0 1 1, and the left in fours 0 0 0 0 1 1 1 1. That guarantees every combination appears exactly once.

Step 3: add a column for every intermediate gate output. This is the step most candidates skip and it is where the method marks live.

Step 4: fill each column completely before starting the next. Working across a row means holding three rules in your head at once. Working down a column means applying one rule sixteen times, which is far harder to get wrong.

For Q = (A AND B) OR (NOT C):

ABCA AND BNOT CQ
000011
001000
010011
011000
100011
101000
110111
111101
Never rub out an intermediate column

The examiner cannot award method marks for working that is not there. Leave every column you added on the page.

A worked logic circuit and its full truth tableA circuit for Q equals A AND B, OR NOT C. Inputs A and B feed an AND gate. Input C feeds a NOT gate. The outputs of the AND gate and the NOT gate feed an OR gate, whose output is Q. The truth table has eight rows and shows the intermediate columns. With A, B and C as 0, 0, 0: A AND B is 0, NOT C is 1, Q is 1. With 0, 0, 1: 0 and 0, Q is 0. With 0, 1, 0: 0 and 1, Q is 1. With 0, 1, 1: 0 and 0, Q is 0. With 1, 0, 0: 0 and 1, Q is 1. With 1, 0, 1: 0 and 0, Q is 0. With 1, 1, 0: 1 and 1, Q is 1. With 1, 1, 1: 1 and 0, Q is 1. So Q is 1 in five of the eight rows.Q = (A . B) + (NOT C)ABCANDNOTORQABCA.BC'Q000011001000010011011000100011101000110111111101work out the middle columns first
Add a column for every gate output, not just the final one. The marks for method are in those middle columns.

Logic gate simulator

Build a circuit from gates, wire it up, and see the truth table fill in as you go. This tool needs JavaScript, so turn it on to use it. Everything you need to answer the exam question is explained in the text above.

Key terms you must be able to define

Logic gate
A circuit that takes binary inputs and produces a binary output according to a fixed rule.
NOT gate
A gate with one input whose output is the opposite of that input.
AND gate
A gate whose output is 1 only when both inputs are 1.
OR gate
A gate whose output is 1 when at least one input is 1.
XOR gate
A gate whose output is 1 when its two inputs are different.
Truth table
A table listing the output of a circuit for every possible combination of inputs.
Logic circuit
Two or more gates joined together, with the output of one feeding the input of another.
Boolean expression
A written form of a logic circuit, using NOT, AND, OR and XOR with brackets.

Flashcards

Say the definition out loud before you flip the card. Retrieving it from memory is what builds recall, reading it again is not.

DefineLogic gate
AnswerA circuit that takes binary inputs and produces a binary output according to a fixed rule.
DefineNOT gate
AnswerA gate with one input whose output is the opposite of that input.
DefineAND gate
AnswerA gate whose output is 1 only when both inputs are 1.
DefineOR gate
AnswerA gate whose output is 1 when at least one input is 1.
DefineXOR gate
AnswerA gate whose output is 1 when its two inputs are different.
DefineTruth table
AnswerA table listing the output of a circuit for every possible combination of inputs.
DefineLogic circuit
AnswerTwo or more gates joined together, with the output of one feeding the input of another.
DefineBoolean expression
AnswerA written form of a logic circuit, using NOT, AND, OR and XOR with brackets.

Reach the top grade on this topic

Logic questions are the most mechanical on the paper, so the marks go to whoever is most systematic.

Fill columns, not rows. One rule applied many times beats many rules applied once. It is faster and it is far more accurate.

Always add intermediate columns. They are worth method marks in their own right, and they make the final column almost impossible to get wrong.

Check two rows against the circuit at the end. Pick the all zeros row and the all ones row and trace them through the diagram. If both match, the rest almost certainly does.

When comparing two circuits, put the truth tables side by side. "The output columns are identical for every combination of inputs, so the circuits are equivalent" is the sentence a mark scheme is looking for.

Mistakes that cost marks here

Avoid these
  • Confusing OR with XOR. They differ only when both inputs are 1.
  • Getting the wrong number of rows. Three inputs need eight rows, not six.
  • Filling the input columns unsystematically, so a combination is missed or repeated.
  • Rubbing out intermediate columns before handing in, which throws away method marks.
  • Ignoring brackets when writing an expression from a diagram.
Fun fact

Boolean algebra was published by George Boole in 1854 as a way of expressing logical reasoning mathematically. It had no practical application at all until Claude Shannon connected it to electrical switching circuits, eighty five years later.

Knowledge check

0 of 10 answered
1What is the output of an AND gate when its inputs are 1 and 0?
2Which gate gives an output of 1 only when its two inputs are different?
3How many rows does a truth table need for a circuit with 4 inputs?
4What is the output of NOT (A OR B) when A is 0 and B is 1?
5In how many rows of a two input truth table do OR and XOR give different outputs?
6For the expression (A AND B) OR C, what is the output when A is 1, B is 0 and C is 1?
7Why should you add a column for each intermediate gate output when completing a truth table?
8Which expression matches a circuit where A and B feed an OR gate, whose output and C feed an AND gate?
9What is the output of A XOR B when both inputs are 1?
10Two circuits are shown to be equivalent. What does this mean?
Score 0 / 10

Exam-style questions

Five written questions in the style of the real paper. Write a full answer, then let the marker check it against the mark scheme.

12 marks
1Complete a truth table for the Boolean expression Q = NOT A AND B.4 marks
Complete

Mark scheme0 / 4
  • LUses four rows covering all combinations of A and B
  • LIncludes a column for NOT A
  • LGives Q as 1 only when A is 0 and B is 1
  • LGives Q as 0 in the other three rows
Model answer

With A and B as inputs the table has four rows. Adding a column for NOT A gives 1, 1, 0, 0 as A runs 0, 0, 1, 1. Q is that column ANDed with B, so Q is 0 when A is 0 and B is 0, Q is 1 when A is 0 and B is 1, Q is 0 when A is 1 and B is 0, and Q is 0 when A is 1 and B is 1. The output is therefore 1 in exactly one row, the one where A is 0 and B is 1.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.
2Explain the difference between an OR gate and an XOR gate.2 marks
Explain

Mark scheme0 / 2
  • LAn OR gate outputs 1 when at least one input is 1
  • LAn XOR gate outputs 1 only when the inputs are different, so 0 when both are 1
Model answer

An OR gate gives an output of 1 whenever at least one of its inputs is 1, including when both are. An XOR gate gives an output of 1 only when its two inputs are different, so when both inputs are 1 its output is 0. The two gates therefore agree on three of the four rows of the truth table and differ only on the last.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.
3A logic circuit has three inputs A, B and C. A and B feed an AND gate. The output of the AND gate and input C feed an XOR gate, whose output is Q. Write the Boolean expression for Q and state how many rows its truth table would have.3 marks
Write

Mark scheme0 / 3
  • LWrites the AND operation in brackets
  • LApplies XOR with C to that output
  • LStates 8 rows
Model answer

The AND gate acts first on A and B, so its output is written as A AND B and must be bracketed because it becomes a single input to the next gate. That output is then combined with C by the XOR gate, giving Q equals (A AND B) XOR C. With three inputs there are 2 to the power 3 combinations, so the truth table would have 8 rows.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.
4Explain why it is good practice to include a column for each intermediate gate output when completing a truth table for a combined circuit.3 marks
Explain

Mark scheme0 / 3
  • LEach column applies one simple rule rather than several at once
  • LThis makes errors far less likely
  • LThe working is creditworthy, so method marks can be awarded even if the final column is wrong
Model answer

Adding a column for each gate turns the problem into a series of single steps, so at each column you are applying one gate's rule repeatedly rather than holding two or three rules in your head while working across a row. That is both faster and considerably less error prone. It also matters for marks: the intermediate columns are the visible working, so an examiner can award method marks for a correct approach even if a slip appears in the final output column. Working that has been rubbed out cannot earn anything.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.
Machine mark 0 / 12