AP CSA 2.6 Exercise 2: Comparing Boolean Expressions Applied Practice

Unit 2: Selection and Iteration · Lesson 2.6 · Exercise 2

Comparing Boolean Expressions: Applied Practice

Six scenarios on proving two conditions are the same, and the single input that shows they are not.

How this one is different

The exercise-1 editor asks you to simplify conditions. These six ask how you KNOW a simplification is safe, which is a truth table or a counterexample and never an impression.

Applied Practice

6 questions · scenario driven · every answer is recorded for your teacher

Question 1 of 6Apply
A student claims !(a && b) is the same as !a && !b.
What settles the claim fastest?
Incorrect. Both are true there; another agreeing row.
Incorrect. Both are false there, so it agrees and proves nothing.
Correct. Correct. One disagreeing row refutes an equivalence, and mixed inputs are where these two diverge.
Incorrect. Intuition is what produced the wrong claim.
Question 2 of 6Analyze
Two conditions agree on three of the four rows of a two-variable truth table.
What follows?
Incorrect. Equivalence is not a majority vote.
Correct. Correct, and the disagreeing row is exactly the input that will eventually reach production.
Incorrect. "Practical purposes" is how the disagreeing case ships.
Incorrect. Four rows fully cover two booleans.
Question 3 of 6Apply
A condition reads if (x) { return true; } else { return false; }
What is the simplification?
Correct. Correct. The if is doing nothing but restating the boolean it was handed.
Incorrect. Equivalent but still redundant.
Incorrect. It reduces to a single expression.
Incorrect. That inverts the result.
Question 4 of 6Analyze
A three-variable condition is claimed equivalent to a shorter one.
How many rows must a complete truth table check?
Incorrect. Six matches no power of two.
Incorrect. Four covers two variables, not three.
Incorrect. Rows enumerate combinations, not variables.
Correct. Correct: two to the third power.
Question 5 of 6Evaluate
Two expressions are equivalent in truth value, but one calls a method with a side effect that the other short circuits away.
Are they interchangeable in a program?
Incorrect. They genuinely can be truth-equivalent; that is the premise.
Incorrect. This is the trap: logical equivalence does not imply behavioral equivalence.
Correct. Correct, and it is why side effects belong outside conditions.
Incorrect. Speed does not restore a skipped side effect.
Question 6 of 6Apply
A condition reads !(x <= 10).
What is the direct equivalent?
Incorrect. Excludes values above 10, which the original includes.
Correct. Correct. The negation of "at most 10" is "more than 10".
Incorrect. Wrongly includes 10 itself, which the original excludes.
Incorrect. Would include values below 10.

Where to go next

Get in Touch

Whether you're a student, parent, or teacher — I'd love to hear from you.

Just want free AP CS resources?

Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.

Typically responds within 24 hours

Message Sent!

Thanks for reaching out. I'll get back to you within 24 hours.

🏫 Welcome, fellow educator!

I offer curriculum resources, practice materials, and study guides designed for AP CS teachers. Let me know what you're looking for — whether it's classroom materials, a guest speaker, or Teachers Pay Teachers resources.

Email

[email protected]

📚

Courses

AP CSA, CSP, & Cybersecurity

Response Time

Within 24 hours

Prefer email? Reach me directly at [email protected]