Comprehensive Study Guide: Boolean Operators in Computer Science
Lesson Overview and Learning Outcomes
- Curriculum Context: Learn Like a GEM
- Subject: Computing
- Lesson Focus: Boolean Operators
- Date: 29 September 2026
- Learning Outcome: By the end of the lesson, learners will be able to evaluate Boolean expressions and justify the use of
AND,OR, andNOTin real-world situations. - Core Knowledge Components:
- Boolean operators can be used to create complex conditions for decision-making in pseudocode.
AND– The result isTRUEonly when both conditions areTRUE.OR– The result isTRUEwhen at least one condition isTRUE.NOT– Reverses a Boolean value:TRUEbecomesFALSE, andFALSEbecomesTRUE.
Prior Knowledge Retrieval: Selection Statements
Challenge 1 – Core (Meeting Expectations):
- Pseudocode:
text IF score >= 50 THEN OUTPUT "Pass" ELSE OUTPUT "Fail" ENDIF - Prediction for : Evaluates to
"Pass", because evaluates toTRUE. - Prediction for : Evaluates to
"Fail", because evaluates toFALSE.
- Pseudocode:
Challenge 2 – Advanced (Above Expectations):
- Pseudocode:
text IF mark >= 90 THEN OUTPUT "Gold" ELSEIF mark >= 75 THEN OUTPUT "Silver" ELSE OUTPUT "Bronze" ENDIF - Selection Branches Count: There are selection branches (
IF,ELSEIF,ELSE). - Prediction for : Evaluates to
"Silver", because isFALSE, but isTRUE. - Prediction for : Evaluates to
"Bronze", because both previous conditions evaluate toFALSE.
- Pseudocode:
Challenge 3 – Mastery (Push Yourself):
- Program Specification: A student receives a behaviour grade based on points:
- If behaviour points equal , output
"Outstanding". - Else if behaviour points are or above, output
"Good". - Otherwise, output
"Needs Improvement". - Python Implementation:
```python
points = int(input("Enter behaviour points: "))
if points == 100: print("Outstanding") elif points >= 80: print("Good") else: print("Needs Improvement") ```
Fundamentals of Boolean Logic
- Definition of Boolean: Refers to a form of algebra and logic operating exclusively on two truth values:
TRUEandFALSE. - Purpose in Computing: Boolean operators are applied inside conditional tests (
IFstatements) to evaluate compound conditions and empower computers to make automated branching decisions. - The Three Primary Operators: The fundamental Boolean operators used across programming languages and pseudocode are
AND,OR, andNOT. - Summary Rules Table:

- AND Operator:
- Format: One condition on either side (
Condition A AND Condition B). - Rules: If both conditions are true, the result is true. Otherwise, the result is false.
- OR Operator:
- Format: One condition on either side (
Condition A OR Condition B). - Rules: If one, or both, conditions are true, the result is true. It is false only when both conditions are false.
- NOT Operator:
- Format: One condition preceding the operator (
NOT Condition A). - Rules: If the condition is true, it makes it false. If the condition is false, it makes it true.
The AND Operator
- Core Operational Principle: The compound expression yields
TRUEstrictly when both operands evaluate toTRUE. If either operand or both operands evaluate toFALSE, the entire expression resolves toFALSE. - Truth Table for AND:
True AND True = TrueTrue AND False = FalseFalse AND True = FalseFalse AND False = False
- Smart Beach Control Room Scenario:
- Monitored Conditions:
Sea Safe = TrueLifeguard Present = True- Decision Evaluation:
Sea Safe AND Lifeguard Present=True AND True=True. The beach safely opens. - Predictive Case: If
Sea Safe = TrueandLifeguard Present = False, the compound test evaluates toFalse(True AND False = False), preventing opening.
- Pseudocode Implementation:

01 total = 97
02 IF(total > 90 AND total < 100) THEN
03 OUTPUT("Just in range")
04 ELSE
05 OUTPUT("Incorrect amount")
06 ENDIF
```
* *Trace with :*
* Sub-condition 1: evaluates to `TRUE`.
* Sub-condition 2: evaluates to `TRUE`.
* Compound result: `TRUE AND TRUE` evaluates to `TRUE`.
* System output: `"Just in range"`.
# The OR Operator
* **Core Operational Principle:** The compound expression yields `TRUE` whenever at least one condition evaluates to `TRUE`. The output is `FALSE` exclusively when both operands evaluate to `FALSE`.
* **Truth Table for OR:**
* `True OR True = True`
* `True OR False = True`
* `False OR True = True`
* `False OR False = False`
* **Smart Library Entry System Scenario:**
* *Monitored Conditions:*
* `Library Member = True`
* `Teacher Permission = False`
* *Decision Evaluation:* `Library Member OR Teacher Permission` = `True OR False` = `True`. Access is granted.
* *Predictive Case:* If a student is both a library member and has teacher permission (`True OR True`), the evaluation yields `True`.
* **Pseudocode Implementation:**

text 01 total = 50 02 IF(total > 100 OR total < 0) THEN 03 OUTPUT("Out of range") 04 ELSE 05 OUTPUT("Accepted") 06 ENDIF ```
- Trace with :
- Sub-condition 1: evaluates to
FALSE. - Sub-condition 2: evaluates to
FALSE. - Compound result:
FALSE OR FALSEevaluates toFALSE. - System output: The
ELSEbranch triggers, outputting"Accepted".
- Sub-condition 1: evaluates to
The NOT Operator
- Core Operational Principle: A unary operator applied to a single condition that inverts its Boolean value. A
TRUEstate is converted toFALSE, and aFALSEstate is converted toTRUE. - Truth Table for NOT:
NOT True = FalseNOT False = True
- Smart School Sports System Scenario:
- Monitored Condition:
Injured = False - Decision Evaluation:
NOT Injured=NOT False=True. The student is eligible to participate. - Predictive Case: If a student is injured (
Injured = True), evaluatingNOT TrueyieldsFalse, preventing sports participation.
- Monitored Condition:
- Pseudocode Implementation:

text 01 quantity = 0 02 IF NOT(quantity = 0) THEN 03 OUTPUT("Still some remaining") 04 ELSE 05 OUTPUT("No items remaining") 06 ENDIF - Trace with :
- Line 02 applies
NOTto a single condition. - Sub-condition: evaluates to
TRUE. - Inversion:
NOT(TRUE)evaluates toFALSE. - System output: The
ELSEbranch triggers, outputting"No items remaining".
Operator Precedence and Evaluation Order
- Execution Hierarchy: In expressions containing multiple Boolean operators without grouping symbols, operators are evaluated strictly by order of precedence:
- Precedence 1:
NOT(always evaluates first). - Precedence 2:
AND(always evaluates second). - Precedence 3:
OR(always evaluates third).
- Precedence 1:
- Modifying Precedence: Brackets (parentheses) must be used to alter the natural execution sequence. Expressions enclosed inside brackets are evaluated prior to any outer operators.
Guided Practice and Application Scenarios
- Scenario: School Trip Rules:
- Criteria: A student can join a school trip if they have a permission slip
ANDhave paid the trip fee. - Evaluation 1: , Can they join? No (
True AND False = False). - Evaluation 2: , Can they join? No (
False AND True = False). - Evaluation 3: , Can they join? Yes (
True AND True = True). - Justification of Operator Selection:
ANDis used because both conditions must be true simultaneously. A student requires both parental permission and fee payment. IfORwere used, meeting only one condition would allow the student to join, which would improperly permit students without permission or without payment.
- Criteria: A student can join a school trip if they have a permission slip
- Challenge 1 – Coding Competition Entry:
- Criteria: A student can enter the coding competition if they are in Year 8
ANDhave submitted the registration form. - Task: Explain what happens if only one condition is true.
- Solution: The overall result is
FALSE. Students must be in Year 8 and registered; meeting only one condition fails theANDgate, denying entry.
- Criteria: A student can enter the coding competition if they are in Year 8
- Challenge 2 – Library Book Borrowing:
- Criteria: A student can borrow a library book if they are a Year 8 student
ORare a library club member. - Operator Required:
OR. - Justification:
ORis used because a student only needs to meet one of the qualifying conditions to borrow a library book.
- Criteria: A student can borrow a library book if they are a Year 8 student
- Challenge 3 – Football Tournament Eligibility:
- Criteria: A student can play in the tournament if they have a sports kit
ANDhave permissionAND NOTinjured. - Operators Used:
AND,NOT. - Function of NOT:
NOTis needed because the student must not be injured to participate. It inverts the Boolean value ofinjuredso that an uninjured student () becomesTRUE, satisfying the participation requirement while disqualifying injured individuals ().
- Criteria: A student can play in the tournament if they have a sports kit
Independent Practice: Spatial Analysis and Evaluation
- Applying (Levels C/D) – Range Check Algorithm:
- Inspected Code: Lines 01–06 evaluating
IF(total > 100 OR total < 0)with . - Conditions Tested: and .
- Function of OR: Requires only one of the sub-conditions to be true for the compound condition to evaluate to true.
- Predicted Output:
"Accepted". Because isFALSEand isFALSE,FALSE OR FALSEevaluates toFALSE, transferring control toELSE.
- Inspected Code: Lines 01–06 evaluating
- Analyzing (Levels A/B) – Algorithm Intent and Boundary Testing:
- Algorithm Purpose: To check whether the numerical value of
totalfalls outside the valid range (strictly less than or strictly greater than ). - Tracing :
- Step 1:
- Step 2:
- Step 3: Compound result is
False OR False = False. - Step 4: Output produces
"Accepted". - Explanation: The boundary value is neither greater than nor less than , meaning it is within the accepted range.
- Algorithm Purpose: To check whether the numerical value of
- Evaluating (Level A*) – Colour Check Algorithm:

- Inspected Code:
text INPUT colour IF colour = "red" OR colour = "blue" THEN value = 1 ELSE value = 2 ENDIF - Impact of OR Operator: Makes the conditional test true if the user input matches either
"red"or"blue". - Outcome for Input
"blue": Sets because"blue"matches one of the valid conditions in theORexpression. - Alternative Input Generating : Entering
"green"produces because"green"is neither"red"nor"blue", causing both comparisons to evaluate toFALSE.
- Inspected Code:
Independent Practice: Verbal Analysis and Comparative Evaluation
- Mechanics of Decision-Making: Boolean operators help computers make decisions by testing whether defined criteria are true or false, directing the execution pipeline down specific algorithmic pathways based on the resulting logic state.
- Comparative Trade-Offs of Boolean Operators:
- AND Operator: Highly accurate and secure by enforcing multiple mandatory prerequisites; however, it is strict and will fail if even one minor criterion is unfulfilled.
- OR Operator: Highly flexible by accommodating multiple acceptable alternatives; however, it risks allowing unwanted outcomes if conditions are defined too permissively.
- NOT Operator: Essential for filtering out exclusions and handling exceptions; however, stacking negative logic can cause confusion in complex programs.
- Judgment on Real-World Utility:
ANDis the most critical operator for high-stakes real-world systems because mission-critical applications require multiple independent verifications before authorizing actions.- Everyday Technology Example: Online banking security systems require a valid password
ANDan SMS/biometric verification code before granting account access. UsingANDguarantees that meeting only one security criterion is insufficient, maintaining strict data integrity.
Questions & Discussion
- Turn and Talk Discussion:
- Question: Ajman Beach can only open if the sea is safe and a lifeguard is present. Why does the beach need to check more than one condition before opening?
- Answer: Checking multiple conditions via an
ANDoperation is essential for safety compliance. If the sea is safe but no lifeguard is on duty, swimmers are unprotected during emergencies. Conversely, if a lifeguard is present but the sea is rough, conditions remain hazardous. Both factors must be satisfied simultaneously to prevent preventable accidents.
- Exit Ticket – SHOW ME:
- Question: A student can access a school computer only if they know the username and password. Which Boolean operator is being used and why?
- Answer: The
ANDoperator is being used because both credentials must be verified as true before access is granted.
- Exit Ticket – THINK BACK:
- Question 1: Which Boolean operator requires all conditions to be
TRUE? - Answer:
AND. - Question 2: Which Boolean operator requires at least one condition to be
TRUE? - Answer:
OR. - Question 3: What does the
NOToperator do? - Answer: It reverses a Boolean value:
TRUEbecomesFALSEandFALSEbecomesTRUE.
- Question 1: Which Boolean operator requires all conditions to be
- Exit Ticket – THINK FORWARD:
- Question: How might
AND,OR, andNOThelp a computer make decisions in a larger program? - Answer: In larger software systems, these operators can be combined into compound conditional expressions and control structures to manage complex logic, manage user permissions, validate data ranges, and coordinate system behaviors based on multiple dynamic inputs.
- Question: How might