Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Quizzes

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
Print Button
 

Essentials of the JavaTM Programming Language
(Part II)

by Dana Nourie and Monica Pawlan

Duke The Essentials of the JavaTM Programming Language is a great resource to explore the JavaTM platform. Take this short quiz to test your knowledge of exceptions, applet and database permissions, and RMI from Part I, and keywords, graphic user interfaces, and collection interfaces from Part II.

  1. Select the answer that best describes the purpose of the following catch block:
    try {
       // Write to file
       // Read from file
    } catch (java.lang.IOException e) {
      // Do something if . . .
    }
    

     A. Closes the file that has been written to and read.
     B. Catches an exception if the file is not available for reading or writing.
     C. Catches an exception if the System.getProperty call fails.

  2. Two methods from the exception and error classes are useful for debugging an application during development. One of the methods is called a printStackTrace(). Another useful method for understanding errors is toString. Select the best description for the following block of code.
    } catch(java.io.IOException e) {
      System.out.println(e.toString());
    }
      
     A. This catch block is best for development to alert the programmer to errors or abnormal conditions.
     B. This catch block is best for deployment because it alerts the user to a problem and prints a meaningful message to the screen.
     C. This catch block does not serve any useful purpose.

  3. The JavaTM 2 platform security imposes restrictions on applets without explicit permissions to do the following:
     A. Display images
     B. Accept user input
     C. Write to system files
     D. Initialize data in the browser

  4. In order to determine what permissions an applet's policy file needs to access a database, read the error messages from the:
     A. IOException method
     B. stack trace
     C. IllegalActionException Statement
     D. Datagram Packet

  5. In Lesson 7, the database application prevents outside classes from accessing the database driver, the user name, and the password by declaring these variables as:
     A. public final
     B. protected final
     C. private final
     D. primitive data types

  6. To run the RMI application in Lesson 8, you must first start:
     A. RMI Client 1
     B. RMI Registry
     C. Remote Server
     D. Send.java

  7. What does a multithreaded server do?
     A. Handles threads for each communication it accepts from a client
     B. Uses and throws built-in IOExceptions
     C. Listens and handles events through the ActionListner interface
     D. Restricts threads with accessEventQueue

  8. The synchronized keyword is used to:
     A. Run threads simultaneously
     B. Obtain a lock on an object
     C. Instantiate multiple objects
     D. Instantiate methods concurrently

  9. The actionPerformed method in a user interface handles action events such as:
     A. Button-clicks and text field returns
     B. Data passing from GUI to server
     C. Multithread handling
     D. Database entries

  10. The List interface implementation permits duplicate elements in a collection object.
     A. True
     B. False


Print Button
[ This page was updated: 21-Sep-2000 ]
Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary | Feedback | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-2000 Sun Microsystems, Inc.
All Rights Reserved. Terms of Use. Privacy Policy.