Learn AP Comp Sci

Problem of the Day

Wednesday, October 8, 2025


Problem:

A shirt is described in terms of its sleeve length and whether or not the shirt is clean. The boolean variable shortSleeves is true if the shirt has short sleeves (and not long sleeves). The boolean variable isClean is true if the shirt is clean, and false if the shirt is dirty. Which boolean expression will evaluate as true for a long-sleeve shirt that is clean?

  1. !(shortSleeves || !isClean)
  2. !shortSleeves && !isClean
  3. !shortSleeves ll isClean
  4. !(shortSleeves && !isClean)

Show solution:

The correct answer is a. By applying DeMorgan's Law to this answer, the expression becomes !shortSleeves && isClean, which is what the problem is looking for.