Dan Chisholm's
Java Programmer Certification Mock Exam

Please Help Save a Tree!

The pages of this web site are not formatted to conserve paper, but my new book (ISBN: 0-9745862-0-X) is formatted to save paper, save your printer cartridge, save a loose-leaf binder, and save money. If you prefer to work my exams from printed pages, then give your printer a rest and buy my new book.

Today, you can find my book at BookSurge.com.

Are you a university student studying Java programming? Do you agree that my book would serve as a helpful workbook and companion to be used along with the Java fundamentals textbook that is currently being used in your class? If so, then please ask your professor to consider using my book in future classes.

If you have any questions or comments concerning my mock exams or my book, then please send an e-mail to me at scjpexam2000@yahoo.com.

I would also like to read your response to the following questions.

Answers: Java Programmer Certification Mock Exam
No.AnswerRemark
1None 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[].  
2Compile-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.  
3None of the above  All array types implement the Serializable interface and may be assigned to a reference of type Serializable.  
4 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 An array of primitive type can not be cast to an array of a different primitive type.  
6None 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.  
 
Ask a Question
Send an email to me.
 
Java Question and Answer Forums
JavaRanch Big Moose Saloon
Marcus Green's Discussion Forum
java.sun.com Forums, Chat and User Groups
 
Other Resources
Java Language Specification
Java Virtual Machine Specification
Java 2 Platform, Standard Edition, v 1.4.0 API Specification
 
Tutorials
Learning the Java Language
Operator Precedence Chart, Expressions, Statements, Blocks
Programming with Assertions
 

Copyright © 2002-2004, Dan Chisholm
All rights reserved.