Answers Latest Version 100% Pass
What happens if an exception is not caught in Java?
✔✔ The program terminates abnormally.
What is the parent class of all exceptions in Java?
✔✔ Throwable
Which block must be used with a try block in Java?
✔✔ Either catch or finally
What happens if a finally block has a return statement?
✔✔ It executes before returning from the method.
Can a catch block catch multiple exceptions?
✔✔ Yes, using multi-catch syntax.
1
,What will happen if an exception occurs in a catch block?
✔✔ It propagates up the call stack unless handled.
Can a try block exist without a catch block?
✔✔ Yes, if it has a finally block.
What happens if System.exit(0) is called inside a catch block?
✔✔ The finally block will not execute.
Can an exception be rethrown in Java?
✔✔ Yes, using the throw keyword.
What happens if an exception is thrown in a finally block?
✔✔ It overrides any previous exception.
Can we create custom exceptions in Java?
✔✔ Yes, by extending the Exception class.
2
, What is the difference between checked and unchecked exceptions?
✔✔ Checked exceptions must be handled or declared, unchecked exceptions don’t.
Can a try block be nested inside another try block?
✔✔ Yes, nested try blocks are allowed.
Is it possible to have multiple catch blocks for a single try block?
✔✔ Yes, multiple catch blocks can handle different exceptions.
Can we catch an exception and throw another one?
✔✔ Yes, exception chaining allows this.
What happens if a return statement is inside a finally block?
✔✔ It overrides any return statement from try or catch.
Which keyword is used to manually throw an exception?
✔✔ throw
3