Sun Java Solaris Communities My SDN Account Join SDN
 
Quizzes

JDC Tech Tips Quiz

 

Quizzes Index


Duke Test your knowledge of Java programming language topics covered in some recent JDC Tech Tips, an electronic mailing containing tips, techniques, and sample code on various topics of interest to developers using the Java platform.
  1. Which of the following provides for multiple inheritance?
     A. A class
     B. An interface

     
  2. Can you access environment data from a Java program?
     A. Yes
     B. No
  3. What happens if you run the following program?
       import java.util.*;
                                
       public class IterDemo {
         public static void main(String args[]) {
           List list = new ArrayList();
           list.add("test1");
           list.add("test2");
           list.add("test3");
           list.add("test4");
                              
           Iterator iter = list.iterator();
           for (
             int index = 0; iter.hasNext(); index++) {
               String next = (String)iter.next();
               if (next.equals("test2")) {
                 list.remove(index);
               }
           }
       }
    }
    

     A. The "test2" entry is removed from the list, and the program completes successfully.
     B. The "test2" entry is not removed from the list, but the program completes successfully.
     C. The "test2" entry is removed from the list, but the program returns an exception.

  4. Which of the following is not a logical font name supported by the Java 2 Platform?
     A. Monospaced
     B. SansSerif
     C. BlockInput
     D. Dialog

     
  5. What is Java Web Start?
     A. A tool that starts Java in a Web browser.
     B. A Java command that starts a Web browser.
     C. A Web browser.
     D. A technology that launches an application from a Web browser.

     
  6. If you use a Collator to sort a list that includes the English word mantra and the Spanish word mañana, which would come first in the sort order?
     A. mañana
     B. mantra

     
  7. What new Swing class in Java 2 SDK, Standard Edition, v 1.4 allows you validate input to a text field?
     A. JTextValidate
     B. JFormattedTextField
     C. JTextInput
     D. There is no new class in Java 2 SDK, Standard Edition, v 1.4 that allows you validate input to a text field.

     
  8. To convert a string that contains the prefix "0x" to a hexadecimal number, which of the following methods should you use?
     A. java.lang.Integer.toHex
     B. java.lang.Byte.byteValue
     C. java.lang.Integer.decode
     D. java.lang.Math.abs

     
  9. Do all Swing components support tool tips?
     A. Yes
     B. No

     
  10. Which of the following methods tends to generate integer random numbers faster?
     A. The random() method of the java.lang.Math class
     B. The nextInt(range) method of the java.util.Random class


1 As used on this web site, the terms "Java virtual machine" or "JVM" mean a virtual machine for the Java platform.