Test Your Knowledge of Java Technology

By John O'Conner, Robert Eckstein, Ed Ort, and Dana Nourie, December 2006  
Duke

In 2006, java.sun.com staff authors published articles about Java technologies, such as JavaServer Faces technology and the Java API for XML-Based Web Services, as well as about new methods such as getFreeSpace() and getUsableSpace() that were added to the familiar java.io.File class. Additionally, the Java platform has added new capabilities, such as the ability to use scripting languages. See how well you do on this online quiz.

Choose the best answer for each question, then click Submit to see how you scored.

 

  1. The following code injects EntityManager instances into an application-scoped JavaServer Faces technology-based managed bean. Why is this not a good approach to persisting data?
         public class BookBean {
                @PersistenceContext EntityManager em;
            ...
                public String placeOrder() {
            ...
                   em.persist(order);
            ...
                }
         }
    

     A. The approach is not thread safe.
     B. The approach does not persist data.
     C. The approach cannot be used with container-managed persistence.
     D. You can't inject EntityManager instances into an application-scoped JavaServer Faces technology-based managed bean.


  2. Fill in the blank: Java API for XML-Based Web Services (JAX-WS) 2.0 defines two types of handlers, protocol handlers and ____________.
     A. Envelope handlers
     B. Context handlers
     C. Logical handlers
     D. Error handlers


  3. Java Architecture for XML Binding (JAXB) 2.0 includes a number of important improvements to JAXB 1.0. Which of the following is a feature that was already supported in JAXB 1.0?
     A. Smaller runtime libraries
     B. Support for all W3C XML Schema features
     C. Additional validation capabilities through the JAXP 1.3 validation APIs
     D. Support for structural unmarshaling


  4. What is the purpose of the java.awt.SystemTray and java.awt.TrayIcon classes in Java Platform, Standard Edition 6 (Java SE 6)?
     A. These classes give you the ability to add graphics, pop-up menus, and floating tip functionality to the system tray.
     B. They give you the ability to add items to the Start menu or the equivalent.
     C. They allow you to start default desktop applications, such as email and browsers.
     D. Nothing. They do not exist.


  5. What is the correct annotation to use to export a class as a web service operation using JAX-WS 2.0?
     A. @WebService
     B. @WebMethod
     C. @WSMethod
     D. @WSService


  6. What is the difference between the methods getFreeSpace() and getUsableSpace() in the java.io.File class?
     A. There is no difference between these methods.
     B. The getFreeSpace() method is deprecated. Programmers are now encouraged to use getUsableSpace().
     C. The getUsableSpace() method is deprecated. Programmers are now encouraged to use getFreeSpace().
     D. The getUsableSpace() method typically returns a more accurate number of unallocated bytes.


  7. What important addition did the Java SE 6 platform make to the JTabbedPane class?
     A. The ability to add a tooltip to the tab
     B. The ability to add an icon to the tab
     C. The ability to substitute a Component as a tab's identifier
     D. The ability to add and remove tabs


  8. How do you determine the number of characters in a String?
     A. Use String's length() method.
     B. Convert the String to a byte[] and use the arrays length property.
     C. Use String's codePointCount method.
     D. None of the above.


  9. How can you make sure your applications handle the U.S. Daylight Savings Time (DST) changes that take effect in 2007?
     A. Set your local host clock back to 2006.
     B. Ignore the time changes.
     C. Download an updated Java Runtime Environment (JRE), or use the Tzupdater tool.
     D. Write your congressman.


  10. What new layout manager in the Java SE 6 platform helps you create great-looking GUIs with NetBeans IDE 5.5?
     A. GridBagLayout
     B. GroupLayout
     C. FlowLayout
     D. BorderLayout


Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve
JavaOne Banner Java 8 banner (182)