Compound Boolean Expressions

AP Computer Science A· difficulty 2/5

if (!(x < 5)) {
    return true;
}
return false;

Which expression is equivalent to !(x < 5)?

  • A

    x != 5

  • B

    x <= 5

  • C

    x > 5

  • D

    x >= 5

    check_circle

Explanation

The negation of x < 5 is x >= 5 (x is at least 5).

Want 10 more like this — adaptive to your weak spots?

Related questions