Expressions and Assignment Statements

AP Computer Science A· difficulty 3/5

<code>double x = 5.0 / 0.0;</code> results in

  • A

    Infinity (no exception)

    check_circle
  • B

    ArithmeticException

  • C

    NaN

  • D

    0.0

Explanation

IEEE 754 floating point: 5.0/0.0 = Infinity (a special value); no exception.

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

Related questions