Back

Advanced Boolean algebra in programming - Answers

Q1. State whether each of the following tests is TRUE or FALSE.

a. (10 > 20) OR (30 > 40)  FALSE
b. (5 < 6) AND (20 >= 10)  TRUE
c. (5 <= 10) AND (35 < 50)  TRUE
d. (3 != 3) OR (5 == 5)  TRUE
e. (7 >= 8) OR (14 != 15)  TRUE
f. NOT ((50 > 40) AND (10 > 5))  FALSE
g. NOT (5 >= 5)  FALSE
h. NOT (20 != 20)  TRUE
i. NOT ((34 > 24) OR (3 > 1))  FALSE
j. NOT ((20 < 30) AND (30 > 5))  FALSE
k. ("Fred" > "John") OR ("Cat" < "Dog")  TRUE
l. NOT (("Fred" > "John") OR ("Cat" < "Dog"))  FALSE
m. NOT (("table" > "Table") AND ("Left" < "Left"))  TRUE
n. NOT ( NOT ("up" < "down"))  FALSE

Extension task
Students should write own Boolean tests and work out the answer and then swap questions with others in the class. Some students will struggle with Boolean algebra. They need to be shown how to break down a complex problem into smaller chunks, and then build the solution up. The key to this is to take careful note of the brackets.

Back