Exceptions Questions and Answers
Practice ModeShowing 10 of 30 questions
Q21
Which of these is NOT a checked exception?
Answer: Option A
Explanation: RuntimeException and its subclasses are unchecked.
Q22
What happens if an exception is not caught?
Answer: Option A
Explanation: Uncaught exceptions propagate up the call stack.
Q23
Which method returns the description of an exception?
Answer: Option A
Explanation: getMessage() provides exception details.
Q24
What is the difference between error and exception?
Answer: Option A
Explanation: Errors are serious system problems, exceptions are application issues.
Q25
Which exception occurs when a file is not found?
Answer: Option A
Explanation: FileNotFoundException is a checked exception for missing files.
Q26
What is exception propagation in Java?
Answer: Option A
Explanation: Exceptions move up the call stack until caught.
Q27
Which class is used to create custom exceptions?
Answer: Option A
Explanation: Extend Exception class to create custom exceptions.
Q28
What is the purpose of the printStackTrace() method?
Answer: Option A
Explanation: Prints the stack trace to help debug exceptions.
Q29
Which exception occurs during arithmetic operations?
Answer: Option A
Explanation: ArithmeticException for math errors like division by zero.
Q30
What is the main advantage of exception handling?
Answer: Option A
Explanation: Prevents program termination and maintains normal flow.