Answers Rated A+
Can a method override another method that declares an exception?
✔✔A) Yes, but the overriding method cannot throw a broader exception than the superclass
method
B) No, overridden methods cannot throw exceptions
C) Yes, the overriding method can throw any exception
D) No, Java does not allow overriding methods with exceptions
What happens if an exception is thrown inside a catch block?
✔✔A) The new exception replaces the original one
B) The original exception is ignored
C) The catch block prevents the new exception from propagating
D) Java does not allow exceptions inside catch blocks
Which of the following statements about the Error class is true?
✔✔A) Errors are usually caused by system failures and should not be handled
B) Errors are a type of checked exception
1
,C) Errors can be handled using try-catch
D) Errors must be declared using the throws keyword
Which of the following best describes multi-catch in Java?
✔✔A) A single catch block can handle multiple exception types
B) Multiple try blocks can be used in a single method
C) A catch block must handle only one type of exception
D) A catch block must always be followed by a finally block
Can you nest try-catch blocks in Java?
✔✔A) Yes, a try block can contain another try-catch block inside it
B) No, nested try-catch blocks are not allowed
C) Only two levels of nesting are allowed
D) A nested try block cannot throw an exception
What happens if a catch block has a superclass exception type before a subclass exception type?
✔✔A) The subclass exception will never be reached, causing a compilation error
B) The program will throw an error at runtime
2
, C) The program will run normally
D) The subclass exception will be caught first
What is the recommended way to handle exceptions in Java?
✔✔A) Catch specific exceptions instead of using a generic Exception
B) Always use a throws clause instead of handling exceptions
C) Ignore exceptions to keep the code clean
D) Use only finally blocks to manage errors
What is the difference between Exception and Error?
✔✔A) Exceptions are recoverable, while Errors are usually not
B) Errors must be handled using try-catch
C) Errors occur due to programming mistakes
D) Exceptions cannot be caught
What is the primary purpose of exception handling in Java?
A) To stop program execution when an error occurs
✔✔B) To gracefully handle runtime errors and continue execution
3