Boolean Bootcamp
The Boolean operators AND, OR and NOT, how to evaluate combined conditions that are true or false, and the order the operators are applied in when an expression mixes them.
Get the method right under pressure
Free interactive practice on the steps that lose marks under exam pressure.
Start revising freeWhat you'll cover
Logic decides what code does
Almost every decision a program makes comes down to true or false. A door unlocks if the code is correct AND the card is valid. A discount applies if you are a member OR it is a sale day. This module drills the three Boolean operators, AND, OR and NOT, and shows how to work out a condition that combines them.
The three operators
Learn these before you evaluate expressions.
AND against OR
The two combining operators have opposite moods.
Work from the inside out
When an expression mixes operators, follow a fixed order. Do anything in brackets first, then apply NOT, then AND, and finally OR. For example, NOT (true AND false) becomes NOT false, which is true. Finish each higher-priority step before moving on, and you will not make a precedence mistake.
Match the rule
- AND
- OR
- NOT
- brackets
- true only when both parts are true
- true when at least one part is true
- reverses the value it is given
- always worked out first
Evaluate an AND
What is the value of true AND false?
- false
- true
- both at once
- it cannot be worked out
Use the order rule
Applying the rule that NOT comes before OR, what is the value of NOT true OR true?
- true
- false
- the NOT applies to the whole expression
- it gives an error
Which are true?
Select the TWO expressions that evaluate to true.
- true OR false
- NOT false
- true AND false
- NOT true
Count the false rows
A truth table for an expression with 2 inputs has 4 rows. AND is true in only 1 of those rows. Subtract to find how many rows make AND false. What is the answer?
Order the evaluation
Put the order you apply Boolean operators in, earliest first.
- Anything in brackets
- NOT
- AND
- OR
Complete the rules
The _____ operator is true only when both conditions are true. The _____ operator reverses a value. The _____ operator is true when at least one condition is true. When operators are mixed, NOT is applied _____ the others.
Spot the false ones
Tap the TWO expressions that evaluate to false.
- false AND true
- NOT true
- true OR false
- NOT false
Evaluate the condition
Read each rule and decide whether it lets the action happen.
- A door unlocks only when the code is correct AND the card is valid. The code is correct but the card is not valid. Does the door unlock?
- A discount applies if you are a member OR it is a sale day. You are not a member but it is a sale day. Does the discount apply?
- An alarm sounds when the sensor is NOT blocked. The sensor is blocked. Does the alarm sound?
Explain the operators
Explain how the AND, OR and NOT operators work and the order they are applied in when an expression mixes them.
- Say what makes AND true and what makes OR true
- Say what NOT does to a value
- State the order the operators are applied in and give a worked example