Boolean Expressions and Logic Homework
Quick practice with Boolean Expressions and Logic
AP CSP – 10 Minute Problem Set
Big Idea 3.5: Boolean Expressions and Logic
1. Boolean Basics (1 min)
Circle True or False:
a) A Boolean value can only be True
or False
.
b) The expression 7 == 8
evaluates to True
.
c) The expression 5 < 10
evaluates to True
.
2. Relational Operators (1 min)
Fill in the blank with the correct relational operator (==, !=, >, <, >=, <=
):
a) 8 ___ 8
→ True
b) 12 ___ 15
→ True
c) 5 ___ 2
→ False
3. Modulo Operator (1 min)
Write a Boolean expression that checks if a variable num
is even.
4. Logical Operators (2 min)
Determine if each expression is True or False when x = 12
and y = 5
.
a) (x > 10) and (y > 10)
→ __
b) (x < 20) or (y > 10)
→ __
c) not (y < 7)
→ __
5. Scenario Practice (2 min)
Write Boolean expressions for the following:
a) You can go out if you finished your homework and your test score is at least 80.
b) You can leave your umbrella at home if it is not cloudy and the temperature is greater than 75.
6. AP-Style Question (3 min)
In a country, a person must be at least 16 years old to drive a car and at least 18 years old to vote.
The variable age
represents a person’s age.
Which of the following expressions correctly evaluates to True
if the person is old enough to drive but not old enough to vote?
I. (age >= 16) and (age <= 18)
II. (age >= 16) and (not (age >= 18))
III. (age < 18) and (not (age < 16))
- Circle all correct answers.
- Explain briefly why.