Loading

Q1.

Which block is used to handle exceptions in Java?

A. try

B. catch

C. finally

D. throw

Q2.

Which of the following is a checked exception in Java?

A. ArithmeticException

B. IOException

C. NullPointerException

D. ArrayIndexOutOfBoundsException

Q3.

What is the purpose of the finally block?

A. To catch exceptions

B. To define methods

C. To execute code regardless of exception occurrence

D. To throw exceptions

Q4.

Which keyword is used to declare that a method may throw an exception?

A. throw
B. throws
C. try
D. catch

Q5.

What happens if an exception is not handled in Java?

A. Program compiles successfully

B. Program terminates abruptly at runtime

C. Exception is ignored

D. Compiler automatically handles it