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?
!(shortSleeves || !isClean)
!shortSleeves && !isClean
!shortSleeves ll isClean
!(shortSleeves && !isClean)
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.