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( ...

Get Java 2™ Programmer Exam Cram™ 2 (Exam CX-310-035) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.