Boolean Expressions

AP Computer Science A· difficulty 2/5

Best way to check if int n is odd:

  • A

    n / 2 == 0

  • B

    n % 2 == 0

  • C

    n - 2 == 0

  • D

    n % 2 != 0

    check_circle

Explanation

Odd → remainder when divided by 2 is non-zero (Java: ±1).

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

Related questions