Writing a logic expression from a truth table

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Writing a logic expression from a truth table

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A two-input truth table has X = 1 only in the row A=1, B=1. Which expression matches?
A X = A OR B
B X = A AND B
2. A two-input truth table has output X = 0, 1, 1, 0 for the rows 00, 01, 10, 11. Which single gate gives this pattern?
A XOR
B OR
3. To build an expression from a complex truth table, which rows do you write out?
A Only the rows where the output is 0
B Only the rows where the output is 1
4. The row A=1, B=0 gives X = 1. How do you write this row?
A A AND NOT B
B NOT A AND B
5. You have written one AND part for each row where X = 1. How do you join these parts together?
A With OR
B With AND

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1X = (A AND NOT B) OR (NOT A AND B) ARows with output 1 must be joined with OR, not AND. The correct expression is (NOT A AND B) OR (A AND NOT B).
2X = A AND B AND NOT C BX = NOT A AND NOT B
3The only row with output 1 is A=0, B=0. Write this row with NOT on both inputs that are 0. CB is 0 in this row, so it needs NOT. The correct row is A AND NOT B.
4Output 1 only when A=1 and B=0, and also when A=1 and B=1. Join the two row expressions with OR. DX = (A AND NOT B) OR (A AND B)
5X = A AND B (for the row A=1, B=0 with output 1) ERows 10 and 01 give output 1. Each row is written with AND and NOT on the 0 input, then the rows are joined with OR.
6X = (NOT A AND B) AND (A AND NOT B) (for rows 01 and 10 with output 1) FThe only row with output 1 is A=1, B=1, C=0. The 0 input C gets NOT and all three inputs are joined with AND.

Definitions

X = (A AND NOT B) OR (NOT A AND B)

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
X = A ___ B
2.
X = A AND ___ B
3.
X = (A AND NOT B) __ (NOT A AND B)
4.
X = A AND NOT _ AND C
5.
X = (A ___ NOT B) OR (NOT A AND B)

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A Table: A=0, B=1 gives X=1
B Row 1 as AND: A AND B
C Only one row has X=1
D X = NOT A AND B
Question 2
A Only row 1 1 gives X = 1
B This is the OR pattern
C X = A AND B
Question 3
A Rows with X=1: 0 1 and 1 0
B P = NOT A AND B
C Q = A AND NOT B
D X = P AND Q
Question 4
A Row A=1, B=0, C=1 gives X=1
B A is 1, so write A
C B is 0, so write B
D C is 1, so write C
E Row: A AND NOT B AND C
Question 5
A Table: X=1 only when A=0,B=0
B Row 0 0: both inputs are 0
C Write it: NOT A OR NOT B
D X = NOT A AND NOT B

Answer Key

Writing a logic expression from a truth table
Section A: Quick Questions
Q1
B — X = A AND B
Q2
A — XOR
Q3
B — Only the rows where the output is 1
Q4
A — A AND NOT B
Q5
A — With OR
Section B: Match the Pairs
Q1
X = (A AND NOT B) OR (NOT A AND B) → Rows 10 and 01 give output 1. Each row is written with AND and NOT on the 0 input, then the rows are joined with OR.
Q2
X = A AND B AND NOT C → The only row with output 1 is A=1, B=1, C=0. The 0 input C gets NOT and all three inputs are joined with AND.
Q3
The only row with output 1 is A=0, B=0. Write this row with NOT on both inputs that are 0. → X = NOT A AND NOT B
Q4
Output 1 only when A=1 and B=0, and also when A=1 and B=1. Join the two row expressions with OR. → X = (A AND NOT B) OR (A AND B)
Q5
X = A AND B (for the row A=1, B=0 with output 1) → B is 0 in this row, so it needs NOT. The correct row is A AND NOT B.
Q6
X = (NOT A AND B) AND (A AND NOT B) (for rows 01 and 10 with output 1) → Rows with output 1 must be joined with OR, not AND. The correct expression is (NOT A AND B) OR (A AND NOT B).
Section C: Definitions
Q1
X = (A AND NOT B) OR (NOT A AND B) — To write an expression from a truth table, take each row with output 1 and join its inputs with AND, adding NOT to any input that is 0. Then join those rows with OR.
Section D: Fill in the Blanks
Q1
X = A AND B
Q2
X = A AND NOT B
Q3
X = (A AND NOT B) OR (NOT A AND B)
Q4
X = A AND NOT B AND C
Q5
X = (A AND NOT B) OR (NOT A AND B)
Section E: Spot the Error
Q1
B — A is 0 in this row, so it must be written as NOT A. The row should be NOT A AND B.
Q2
B — An output that is 1 only when both inputs are 1 is the AND pattern. OR gives 1 for three of the four rows.
Q3
D — Rows with output 1 are joined with OR, not AND. P and Q can never both be true at once, so AND would always give 0.
Q4
C — An input that is 0 in the row must be written with NOT. It should say: B is 0, so write NOT B.
Q5
C — Inputs within one row are joined with AND, not OR. The row should be written NOT A AND NOT B.