Java Mapping - Quiz Explanation

The correct answers are indicated below, along with text that explains the correct answers.
 
1. How does the following operation signature in IDL map to a method signature in Java? long myOperation();
Please select the best answer.
  A. public java.lang.Long myOperation();
  B. public long myOperation();
  C. public int myOperation();
  D. public org.omg.CORBA.Long myOperation();
  The correct answer is C;
The Java mapping for the IDL long myOperation(); is public int myOperation();. Operations map to methods directly, preserving the operation name exactly. The return value is mapped according to the mapping for primitive types. A, B, and D are incorrect because they do not use the correct mapping for the return value.

2. How does the following operation signature in IDL map to a method signature in Java? void myOperation(in object foo); Please select the best answer.
  A. public void myOperation(org.omg.CORBA.Object foo);
  B. public void myOperation(java.lang.Object foo);
  C. public void myOperation(int objectID,String foo);
  D. public void myOperation(in Object foo);
  The correct answer is A;
the IDL void myOperation(in object foo); maps to public void myOperation(org.omg.CORBA.Object foo); in Java. The IDL type object refers to an object reference. The generic interface for all object references is org.omg.CORBA.Object. All CORBA stubs will implement this interface, so it is used as the type for generic object references. B is incorrect because the class java.lang.Object is the generic reference for all Java objects and does not supply the generic methods for remote object references. C is incorrect because in Java there is no need to split a single parameter into multiple parameters. D is incorrect because Java does not use parameter passing modes in method signatures.

3. What would be the Java mapping for this IDL const definition?
module MyMod {
     const unsigned long myConst=55;
};
Please select the best answer.
  A. package MyMod; public class MyMod { public static final long myConst=55; }
  B. package MyMod; public class MyModConstants { public static final long myConst=55; }
  C. package MyMod; public class myConst { public static final long value=55; }
  D. package MyMod; public class myConst { public long value() { return 55; } }
  The correct answer is C.
For each constant defined on the module level, a class is created with the name of that constant. The value of the constant is assigned to a variable named value. A is incorrect because a class is not named for the module, but is named for each constant. B is incorrect because each constant gets its own class. D is incorrect because the value is assigned to a variable not returned from a method call.