Boolean Logic CS Thinking Example 4

Follow the full solution, then compare it with the other examples linked below.

Example 4

medium
Evaluate the condition `(loggedIn AND NOT suspended) OR teacherOverride` when loggedIn = TRUE, suspended = TRUE, and teacherOverride = FALSE.

Solution

  1. 1
    Step 1: NOT suspended becomes FALSE because suspended is TRUE. Then loggedIn AND NOT suspended becomes TRUE AND FALSE, which is FALSE.
  2. 2
    Step 2: FALSE OR teacherOverride becomes FALSE OR FALSE, so the whole condition is FALSE.

Answer

FALSE
Boolean logic combines conditions into a single true-or-false result. Evaluating one operator at a time makes complex expressions easier to reason about correctly.

About Boolean Logic

A system of logic that works with only two possible values—true and false—combined using the operators AND, OR, and NOT. Boolean logic provides the mathematical foundation for all decision-making in computing, from simple if-statements to complex database queries and digital circuit design.

Learn more about Boolean Logic →

More Boolean Logic Examples