Practice Boolean in CS Thinking

Use these practice problems to test your method after reviewing the concept explanation and worked examples.

Quick Recap

A data type representing a logical value that can only be true or falseβ€”nothing else.

A boolean is a yes/no answer. Is the user logged in? True or false. Is the number positive? True or false.

Example 1

easy
Evaluate each expression when x = 7: (a) x > 5, (b) x == 10, (c) x != 7, (d) x >= 7.

Example 2

medium
A variable `isLoggedIn` is a boolean. Write pseudocode that outputs 'Welcome back' if logged in, or 'Please log in' otherwise.

Example 3

easy
What is the value of each: (a) NOT TRUE, (b) (5 < 3) OR (10 > 8), (c) (4 == 4) AND (3 > 5)?

Example 4

medium
A theme park ride requires: age β‰₯ 12 AND height β‰₯ 140. A child is age 13 and height 135. Evaluate the full Boolean expression step by step. Can they ride?