| No. | Answer | Remark | |
|---|---|---|---|
| 1 | g | None of the above | The null literal is converted to an int array type with the value null. All array types implement the Cloneable interface, so any array reference can be assigned to a reference of type Cloneable. The int array object referenced by the Cloneable reference, c, can be assigned to a reference of the int array type, int[]. |
| 2 | e | Compile-time error at line 3. | Although the referenced object is indeed an array of type int, an explicit cast is necessary to cast the obj reference to an int array. |
| 3 | g | None of the above | All array types implement the Serializable interface and may be assigned to a reference of type Serializable. |
| 4 | c | 3 | The length member of the array type is an attribute. A compile-time error is generated as a result of the attempt to access length as though it were a method. |
| 5 | d | 4 | An array of primitive type can not be cast to an array of a different primitive type. |
| 6 | f | None of the above | The program compiles and runs without error and prints 112. It is necessary to remember that arrays are Cloneable objects. Furthermore, a two dimensional array is also a single dimensional array of single dimensional arrays. At line 2, a two dimensional array of int primitives is converted to a single dimensional array with components of type Object where each Object is a single dimensional array. The loop iterates through each element of the Object array. Since each element is actually a reference to a single dimensional array of integer primitives a conversion from type Object to an int array is legal. |