Boolean Logic Examples in CS Thinking

Start with the recap, study the fully worked examples, then use the practice problems to check your understanding of Boolean Logic.

This page combines explanation, solved examples, and follow-up practice so you can move from recognition to confident problem-solving in CS Thinking.

Concept Recap

A system of logic that works with only two possible values: true and false, combined with AND, OR, NOT.

Yes/no thinking. You combine simple true/false conditions into complex decisions with AND, OR, NOT.

Read the full concept explanation โ†’

How to Use These Examples

  • Read the first worked example with the solution open so the structure is clear.
  • Try the practice problems before revealing each solution.
  • Use the related concepts and background knowledge badges if you feel stuck.

What to Focus On

Core idea: All program conditions ultimately reduce to a single true or false decision at each step.

Common stuck point: AND requires both true. OR requires at least one true. NOT flips the value.

Worked Examples

Example 1

medium
Evaluate: (TRUE AND FALSE) OR (NOT FALSE).

Solution

  1. 1
    Step 1: TRUE AND FALSE = FALSE.
  2. 2
    Step 2: NOT FALSE = TRUE.
  3. 3
    Step 3: FALSE OR TRUE = TRUE.

Answer

TRUE
Boolean logic uses AND, OR, and NOT operators. AND requires both inputs to be true; OR requires at least one; NOT inverts the value. These are the building blocks of conditions in programs.

Example 2

medium
Complete the truth table for A AND (NOT B) where A and B can each be TRUE or FALSE.

Practice Problems

Try these problems on your own first, then open the solution to compare your method.

Example 1

medium
Evaluate: NOT (TRUE OR FALSE) AND TRUE.

Example 2

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

Background Knowledge

These ideas may be useful before you work through the harder examples.

selection