(a && b) && !(a && b)
false

Let c represent the repeated expression a && b. The expression becomes:
c && !c

The left side requires that c be true. The right side requires that c be false. The sides are combined with and (&&). It is not possible for c to be both true and false, so the entire expression always evaluates to false.

Not all Boolean expressions always evaluate to true or always evaluate to false. In general, writing such an expression in code would be a logical error. Expressions that always evaluate to true or always evaluate to false may be featured on the AP CS A Exam. If an expression really does always evalute to the same value, don’t be afraid to select that answer choice.

Other simplifications include:

c || !c always evaluates to true.

c && c is equivalent to c.

c || c is equivalent to c.

c == c always evaluates to true.

Exercise 1 solution
Exercise 3 solution
Exercises
All solutions