Multiple choice

Which exception is thrown when user provides divisor as zero, i.e. c=a/b, where b=0?

  1. NullPointerException

  2. ArithmeticException

  3. IOException

  4. ArrayOutOfBoundsException

  5. IllegalAccessException

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

ArithmeticException gets raised whenever an invalid operation has been attempted by the user. For example, in the above expression, the division by zero exception is raised, if the user has provided the zero value for b.