Learn AP Comp Sci

☰

Problem of the Day

Tuesday, October 27, 2026


Problem:

The complex boolean expression shown here includes int values n1, n2, and n3.

!(n1 >= n2 || !(n3 < 7))

Which of the following expressions represents a valid simplification of the expression above?

  1. !n1 >= !n2 && !n3 >= 7
  2. n1 < n2 || n3 < 7
  3. n1 < n2 || n3 > 7
  4. n1 < n2 && n3 < 7

Show solution:

The correct answer is d. The initial ! is distributed to each inner boolean expression, with a corresponding change from || to && according to DeMorgan's Law. The comparator in the first comparison changes to <, and the two 'not' operations cancel in the second comparison, leaving us with n3 < 7.