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
 
Quizzes Index
JDC Programming Quiz

(June 1998)

Hi Everyone! Take a few minutes for this trivia quiz compiled by the JDC staff, and test your general knowledge of JavaTM programming. If you do not know an answer, take a guess. The right answers and a link to supporting information come up when you select the Submit button.
Compiled by JDC staff members (past and present): Calvin Austin, Sara Louis, Rama Roberts, Greg Layer, Greg Voss, and Monica Pawlan

1. A thread is at a wait statement and is notified by another thread that has the lock on that object to proceed. Under what conditions can the thread at the wait statement continue?
 A. Right away. It has been notified, and it can now go.
 B. The wait thread can continue once the notify thread has exited its synchronized block.
 C. The thread can continue once the notify thread has exited its synchronized block, and the wait thread has obtained the lock on that object.
 D. Right away. The wait thread is handed the object lock from the notify thread.

2. What is required when writing a JavaBeanTM?
 A. A JavaBean must extend the java.beans.Beans class.
 B. A JavaBean must use strict naming conventions for its accessor and mutator methods.
 C. A JavaBean must define the getBeanType() method.
 D. None of the above.

3. You are trying to change the string on a label from "short string" to "some very long-winded, verbose string," but the new label is always truncated. What you see is something like "some very l...". How do you fix this?
 A. Invalidate the object whose label you are changing and force its parent container to validate itself.
 B. Call the repaint method on the parent container.
 C. Call the validate method on the parent container.
 D. Make the new label larger by calling its setSize method.

4. Which of the following statements is true about JDK 1.1?
 A. Programs that use JDK 1.1 features can run in JDK 1.0 runtimes.
 B. The event model is different from JDK 1.0.
 C. You cannot compile JDK 1.0 code with the JDK 1.1 compiler.
 D. There are no deprecated APIs.

5. You are writing JDK 1.1 code that can be called by JDK 1.0 and you need to override a deprecated method. How can you be sure your code will work?
 A. Override the deprecated method only.
 B. Override the replacement method only.
 C. Override the deprecated method to call the replacement method, and override the replacement method to implement the required functionality.
 D. Override the deprecated and replacement method to implement the required functionality.

6. A Java program can set up its own configurable program attributes to specify things like startup parameters and preferred window size. What are the mechanisms for Java programs to set their own set of program attributes?
 A. Reflection and introspection.
 B. Serialization and byte streams.
 C. Keys, signatures, and policy files.
 D. Properties, command-line arguments, and applet parameters.

7. Knowing the height and width of an image can be helpful when creating web pages or designing user interfaces. What class provides a way to get information on an image including its height and width?
 A. java.awt.Toolkit
 B. java.awt.image.ImageConsumer
 C. java.awt.ImageFilter
 D. java.awt.ImageProducer

8. Which one of the following will not pick up the pressed JRadioButton? All of the examples use the following object: RadioButton myButton = new JRadioButton();
 A.
  RadioListener myListener = new RadioListener();
  myButton.addActionListener(myListener);

  class RadioListener implements ActionListener {
    public void actionPerformed(ActionEvent e) { }
  }

 B.
  RadioListener myListener = new RadioListener();
  ButtonModel mymodel= new DefaultButtonModel();
  mymodel.addActionListener(myListener);
  myButton.setModel(mymodel);

  class RadioListener implements ActionListener {
    public void actionPerformed(ActionEvent e) { }
  }

 C.
  ButtonModel mymodel=myButton.getModel();
  mymodel.addChangeListener(new ChangeListener() {
    public void stateChanged(ChangeEvent e){ }
  });

 D.
  ButtonModel mymodel=myButton.getButtonModel();
  mymodel.addActionListener(myListener);
  myButton.setModel(mymodel);

  class RadioListener implements ActionListener {
    public void actionPerformed(ActionEvent e) { }
  }

9. Which of the following is not a Bean property?
 A. Simple.
 B. Action.
 C. Bound.
 D. Constrained.
 E. Indexed.

10. What is a Beans Event Adapter?
 A. An object that interposes between action sources and action listeners to provide added control over event delivery.
 B. A window that becomes visible for each Bean that is selected in a builder tool.
 C. A simple and transparent means of persisting Java objects.
 D. An object that interposes between event sources and event listeners to provide added control over event delivery.
 E. Used to build programs outside the Beanbox.


Print Button
[ This page was updated: 27-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.