about us   Contact Us   advertise
Test Your Knowledge of Java Topics

By Emmett Dulaney

Are you ready to take the Sun Certified Programmer for Java 2 Platform Exam (#310-025)? This exam consists of a combination of 59 multiple-choice, short-answer and drag-and-drop questions. The following eight questions are spread across the first eight objective categories and will help you gauge your readiness for this certification exam.

Click on the question to see the correct answer.

Questions

1. Which of the following primitive data types should be used to represent a 16-bit unsigned integer?

A. int
B. char
C. short
D. byte
E. long

2. What is the output of the following program?

public class Example { 
static int c = 3; 
public static void main(String [] args) { 
System.out.print("Kristin wants "); 
try { 
System.out.print("a bike, "); 
if(c > 0) { 
throw new Exception(); 
} 
System.out.print("a robot, "); 
} 
catch (Exception e) { 
System.out.print("a dollhouse, "); 
System.exit(0); 
} 
finally { 
System.out.print("and an American Girl doll."); 
} 
} 
}

A. Kristin wants a bike, a robot, a dollhouse, and an American Girl doll.
B. Kristin wants a bike, a robot, a dollhouse,
C. Kristin wants a bike, a robot,
D. Kristin wants a bike,
E. Kristin wants
F. Kristin wants a bike, a dollhouse,
G. Kristin wants a bike, a dollhouse, and an American Girl doll.

3. Evan has written a memory-intensive Java program. After a particular portion of the program has run, he wants to free/recycle the memory that was in use. How can he accomplish this?

A. Use the code: finalize()
B. Use the code: System.runFinalization
C. Declare the process as “protected.”
D. He cannot control this.

4. Which of the following is the default value for a primitive data type of “float”?

A. False
B. 0.0d
C. 0.0f
D. 0

5. What is the output of the following program?

public class ExampleTwo { 
public static void main(String [] args) { 
String y1 = new String("Spencer"); 
if (y1 != "Spencer") { 
System.out.println("You will be picked up early on Tuesday"); 
} 
else { 
System.out.println("You will need to stay all day Tuesday"); 
} 
} 
}

A. You will need to stay all day Tuesday.
B. You will be picked up early on Tuesday.
C. The output is blank.
D. The code generates a compilation error.

6. In regard to constructors, how can you prevent a class from being instantiated?

A. Use the private declaration.
B. Use anonymous classes.
C. Employ overloading.
D. Use only static inner classes.

7. Karen recently moved from C language programming to Java. She is currently having difficulty with threads and their states. Which of the following are valid states that a thread can be in? (Choose all that apply.)

A. Dead
B. Stale
C. Waiting
D. Ready
E. Set
F. Running

8. Within the java.awt package, which interface must be implemented to receive events when the mouse is dragged?

A. MouseDragged
B. MouseMoved
C. KeyEvent
D. MouseMotionListener

Sun markets a practice exam for the Sun Certified Programmer for the Java 2 Platform Exam. The practice exam is available online for a 90-day subscription only, at $75. You can find it at: suned.sun.com/US/catalog/courses/WGS-PREX-J025B.html

Sun also offers a free, 10-question practice exam. It can be found online at https://tmn.sun.com/WLC/servlet/GuestLoginServlet?cmd=login1&loginType=1&language=en&id=programmer0000

Emmett Dulaney is StudyGuide editor for Certification Magazine, author of more than 30 books and one of the founders of D S Technical Solutions. Emmett can be reached at edulaney@certmag.com.

 

Contact Us | Privacy Statement | Subscribe Free | Home

PLEASE VISIT OUR SPONSORS

Create a new subscription or update your current information here! Select A Community Visit the CertMag.Com Discussion Boards Back to CertMag.com HomePage
Article Index