O'Reilly logo

Java 2™ Programmer Exam Cram™ 2 (Exam CX-310-035) by Marcus Green, Bill Brogden

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 15. Sample Test Two

Question 1 What is the range of values that can be stored in a char primitive variable?
  • A. 0 to 255

  • B. 0 to 32767

  • C. –32768 to 32767

  • D. 0 to \uFFFF

Question 2 You are writing code for a class that will be in the default package and will use utility classes in the java.util package.

Select the most reasonable code fragment to start the source code file.

  • A.

    import java.util.* ;
    
  • B.

    package default ;
    import java.util.* ;
    
  • C.

    import java.util.* ;
    package default ;
    
  • D.

    import java.lang.* ;
    import java.util.* ;
    
Question 3 Trying to compile the following source code produces a compiler warning to the effect that the variable tmp may not have been initialized.
 1. class Demo{ 2. String msg = "Type is " ; 3. public void showType( ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required