Chapter 17: Logic

OCR GCSE Computer Science Teaching and Learning Resources
Chapter 17: Logic
ANSWERS TO QUESTIONS IN THE STUDENT’S BOOK
Page 173
Question
1. Draw a truth table for the following Boolean expressions:
a) ¬(A V B)
b) ¬A Λ ¬B
c) (A Λ B) Λ ¬C
d) ¬(A Λ B) V C
e) A Λ ¬(B V C)
Answer
a)
A
0
0
1
1
B
0
1
0
1
(A ∨ B)
0
1
1
1
¬ (A ∨ B)
1
0
0
0
b)
A
0
0
1
1
B
0
1
0
1
¬A
1
1
0
0
¬B
1
0
1
0
¬ A ∧ ¬B
1
0
0
0
c)
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
(A ∧ B)
0
0
0
0
0
0
1
1
¬C
1
0
1
0
1
0
1
0
(A ∧ B) ∧ ¬C
0
0
0
0
0
0
1
0
OCR GCSE Computer Science
© Hodder & Stoughton Limited 2016
OCR GCSE Computer Science Teaching and Learning Resources
d)
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
(A ∧ B)
0
0
0
0
0
0
1
1
¬ (A ∧ B)
1
1
1
1
1
1
0
0
¬ (A ∧ B) ∨ C
1
1
1
1
1
1
0
1
C
0
1
0
1
0
1
0
1
(B ∨ C)
0
1
1
1
0
1
1
1
¬ (B ∨ C)
1
0
0
0
1
0
0
0
A ∧ ¬ (B ∨ C)
0
0
0
0
1
0
0
0
e)
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
Question
2. Draw the logic circuits for each of the expressions in question 1.
Answer
a)
b)
OCR GCSE Computer Science
© Hodder & Stoughton Limited 2016
OCR GCSE Computer Science Teaching and Learning Resources
c)
d)
e)
Question
3. Draw the truth tables for A Λ (B V C) and (A Λ B) V (B Λ C).
a) Calculate 3 × (4 + 5) and (3 × 4) + (3 × 5)
b) What do you notice?
Answer
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
(B ∨ C)
0
1
1
1
0
1
1
1
A ∧ (B ∨ C)
0
0
0
0
0
1
1
1
OCR GCSE Computer Science
© Hodder & Stoughton Limited 2016
OCR GCSE Computer Science Teaching and Learning Resources
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
(A ∧ B) (B∧ C)
0
0
0
0
0
0
0
1
0
0
0
0
1
0
1
1
(A ∧ B) ∨ (B ∧ C)
0
0
0
1
0
0
1
1
a) 3 * (4 + 5) = 3 * 9 = 27
(3 * 4) + (3 * 5) = 12 + 15 = 27
b) The result is the same.
If we compare the truth tables for A Λ (B V C) and (A Λ B) V (A Λ C)
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
(A ∧ B) (A ∧ C)
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
1
(A ∧ B) ∨ (A ∧ C)
0
0
0
0
0
1
1
1
we get the same result; this is the distributive law.
OCR GCSE Computer Science
© Hodder & Stoughton Limited 2016