Exception Mapping Hierarchy - Quiz Explanation

The answers you selected are indicated below, along with text that explains the correct answers.
 
1. The IDL system exception CORBA::NO_MEMORY is mapped to the Java class org.omg.CORBA_NO_MEMORY. Given that running out of memory is a serious error condition, from which of the following java.lang classes does CORBA_NO_MEMORY inherit?
Please select the best answer
  A. Error, Throwable
  B. Throwable, Error, RuntimeException, Exception
  C. Exception, Throwable, RuntimeException
  The correct answer is C. As a system exception, CORBA_NO_MEMORY inherits from org.omg.CORBA.SystemException, which inherits from RuntimeException, which inherits from Exception, which inherits from Throwable.
A is incorrect because CORBA exception classes do not inherit from Error. B is incorrect for the same reason.

2. Should user-defined IDL exceptions be mapped to checked or unchecked Java exceptions, and why?
Please select the best answer.
  A. They should be mapped to unchecked exceptions so that CORBA client code is not forced to put in try-catch blocks for server-side exceptions.
  B. They should be mapped to checked exceptions so that CORBA client code is forced to put in try-catch blocks for server-side exceptions.
  C. They should be mapped to checked exceptions so that CORBA server implementations are forced to put in try-catch blocks to handle exceptions.
  The correct answer is B. B is correct because IDL exceptions are defined so that they can be used in the raises clauses of operations in interfaces to indicate that clients must be able to handle them. Making the exceptions checked exceptions in Java retains this characteristic--the clients must then put in try-catch clauses. A is incorrect because the opposite is the true. C is incorrect because the exceptions are not handled in the server, the fact that they are defined in IDL means that they are propagated from the server to the clients.

3. All user-defined exceptions in IDL are mapped to children of org.omg.CORBA.UserException, with no additional layers of inheritance. Why might this be the case?
Please select the best answer.
  A. Java exceptions are never based on multiple layers of inheritance.
  B. IDL exceptions do not have inheritance.
  C. Neither IDL nor Java exceptions have or make use of inheritance.
  The correct answer is B. B is correct because in IDL, interfaces can express inheritance, not exceptions.
Thus, there is no deep inheritance to map to the corresponding Java code. A and C are incorrect because Java exceptions are often based on multiple layers of inheritance.