The answersDownload the PDF
Worksheet

A8.2 Circuits, expressions and truth tables

Boolean algebra and logic circuits · A level · OCR H446 1.4.3, AQA 7517 4.6.4.1, Eduqas A500QS 1.2 · about 20 min

BugBotLab
NameClassDate

What this lesson is about

Reading and drawing circuits, defining a problem in Boolean logic, and sum of products from a truth table.

Questions 6 marks in all

  1. [1 mark]Q = ¬(A ∨ B) ∨ (B ∧ C). A = 0, B = 1 and C = 0. What is Q?

  2. [1 mark]For how many of the 8 input rows is Q = ¬(A ∨ B) ∨ (B ∧ C) equal to 1?

  3. [1 mark]"The alarm sounds if the robot has bumped (K), or if it is close (C) while the battery is low (L)." Which expression matches?

    1. AK ∨ (C ∧ L)
    2. B(K ∨ C) ∧ L
    3. CK ∧ C ∧ L
    4. DK ∨ C ∨ L
  4. [1 mark]A truth table for A, B and C has Q = 1 only on the row A=1 B=0 C=1. Write its minterm in OCR notation, with the letters in the order A, B, C.

  5. [1 mark]How many gates does the circuit for (A ⊻ B) ∧ ¬C need?

    1. A3
    2. B2
    3. C4
    4. D5
  6. [1 mark]On a circuit diagram, what does a dot where two wires meet show?

    1. AThe wires are connected (a junction)
    2. BThe wires cross without connecting
    3. CA NOT gate
    4. DThe output of the circuit

The task: truth table to expression

Write sum_of_products(outputs). Its input outputs is a list of eight integers, each 0 or 1: the Q column of a truth table for inputs A, B and C, with the rows in binary order, so outputs[0] is the row A=0 B=0 C=0 and outputs[7] is A=1 B=1 C=1. It returns a string: Q = followed by the minterms joined with OR . Each minterm is in brackets, lists A, B and C in that order joined with AND , and writes an input that is 0 in that row as NOT and a space before the letter. If no row is 1, it returns Q = 0. For example, [0, 0, 1, 0, 0, 0, 0, 1] gives Q = (NOT A AND B AND NOT C) OR (A AND B AND C). Print the result for these three tables, one per line, in this order: [0, 1, 1, 1, 1, 1, 1, 1], then [0, 0, 1, 0, 0, 0, 1, 1], then [0, 0, 0, 0, 0, 0, 0, 0].

# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()

def sum_of_products(outputs):
    return "Q = "

print(sum_of_products([0, 1, 1, 1, 1, 1, 1, 1]))
print(sum_of_products([0, 0, 1, 0, 0, 0, 1, 1]))
print(sum_of_products([0, 0, 0, 0, 0, 0, 0, 0]))

Plan your program here, then type it in and press Run.

QR code
Do it on the robot
www.bugbotlab.com/learn/a8-2-circuits-and-expressions/
The simulator checks it and tells you when it passes. Nothing to install, no account.

Challenges

  1. The first table gives seven minterms. What short expression has that truth table? What does that tell you about sum of products?
  2. Extend sum_of_products to any number of inputs, taking the variable names as a second parameter.
  3. Write the alarm expression K ∨ (C ∧ L) in AQA notation, draw its circuit, and use your function to print its sum of products form.