Loading

Q1.

How do you create a custom exception in Java?

A. Extend Exception or RuntimeException 

B. Implement Runnable

C. Extend Thread

D. Use throw keyword only

Q2.

Which type of exception must be handled explicitly when creating a custom exception?

A. Checked Exception 

B. Unchecked Exception

C. RuntimeException

D. None

Q3.

Which of the following is true about custom exceptions?

A. Cannot have constructors

B. Can have constructors to pass messages 

C. Cannot be thrown using throw

D. Must always extend RuntimeException

Q4.

Which statement is correct about handling custom exceptions?

A. They cannot be caught

B. They must be caught or declared if checked 

C. They automatically terminate the program

D. They cannot extend Exception

Q5.

Which keyword is used to throw a custom exception?

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