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
 

AWT Fundamentals
Quiz

by jGuru

Duke This AWT Fundamentals Quiz offers a way to test the knowledge you learned about the Abstract Window Toolkit API from the AWT Fundamentals Short Course. Some questions refer back to the Effective Layout Management tutorial also on the JDC from jGuru.

This quiz should also help you prepare for the JavaTM Programmer Certification exam, as that requires an understanding of the AWT facilities.


  1. To have a TextArea display scrollbars, you need to place it within a ScrollPane?
     A. True
     B. False
  2. To respond to paint events (events of type PaintEvent), you should attach a PaintListener to the component?
     A. True
     B. False
  3. Which of the following will cause a beeping sound to be emitted?
     A. System.out.println("\u0005"); // CTRL-E
     B. aComponent.beep(); // where aComponent is of type Component
     C. aToolkit.beep(); // where aToolkit is of type Toolkit
     D. anApplet.beep(); // where anApplet is of type Applet
  4. Which of the following is Applet not a subclass of?
     A. Object
     B. Component
     C. Container
     D. Panel
     E. Window
  5. The  CheckboxGroup is a subclass of Component.
     A. True
     B. False
  6. Which of the following can contain a MenuBar?
     A. Applet
     B. Frame
     C. Panel
     D. Window
  7. Using new TextField(10) will create a TextField that only accepts 10 characters of input.
     A. True
     B. False
  8. You can freely intermix the JavaTM 1.0 containment event model with the JavaTM 1.1 delegation-based event model?
     A. True
     B. False
  9. Given the following code fragment, which listener will be notified first?
    ActionListener al1 = new MyActionListener();
    ActionListener al2 = new MyActionListener();
    ActionListener al3 = new MyActionListener();
    Button b =  new Button("Hit Me");
    b.addActionListener(al1);
    b.addActionListener(al2);
    b.addActionListener(al3);
    
     A. al1 
     B. al2
     C. al3
     D. Indeterminable
  10. Given the following code fragment, which listener will be notified first?
    ActionListener al1 = new MyActionListener();
    ActionListener al2 = new MyActionListener();
    Button b =  new Button("Ouch");
    b.addActionListener(al1);
    b.addActionListener(al2);
    b.addActionListener(al2);
    b.removeActionListener(al2);
    
     A. al1
     B. al2
     C. Indeterminable
  11. Given the following code fragment, what size will the button be?
    Button b = new Button("Hello");
    Panel p1 = new Panel();
    p1.add(b);
    Panel p2 = new Panel(new GridLayout(1,2));
    p2.add(p1);
    frame.add(p2, BorderLayout.NORTH);
    
     A. The button's preferred size
     B. The button's preferred height but as wide as the frame
     C. Half the height of the frame and as wide as the frame
     D. Half the width of the frame and as tall as the frame!!
  12. What is the default layout manager of an Applet?
     A. AppletLayout 
     B. BorderLayout
     C. FlowLayout 
     D. GridLayout 
  13. What is the default layout manager of a Frame?
     A. BorderLayout
     B. FrameLayout
     C. FlowLayout
     D. GridLayout
  14. When using the CardLayout manager, how is the card size determined?
     A. The component with the largest area determines the size for all
     B. The widest component is combined with the shortest component to determine the size
     C. The tallest component is combined with the narrowest component to determine the size
     D. The widest component is combined with the tallest component to determine the size
  15. If all five areas of a BorderLayout contain a button with the same label, which of the areas will contain the widest button?
     A. CENTER 
     B. BEFORE_LINE_BEGINS 
     C. BEFORE_FIRST_LINE 
     D. WEST 
  16. Which of the following layout managers can be used to resize some components along one axis while leaving them unchanged along the other when their container is resized on both axes?
     A. CardLayout
     B. FlowLayout
     C. GridLayout
     D. GridBagLayout
  17. Can a container have multiple layout managers?
     A. Yes 
     B. No
  18. Using only AWT classes, what is the simplest way to reserve space for a border around a component?
     A. Set the Insets of the component
     B. Add the component to a container and set the Insets of the container
     C. Set the Border of the component
     D. Add the component to a container and set the Border of the container
  19. What is the default alignment for a FlowLayout?
     A. FlowLayout.CENTER
     B. FlowLayout.LEFT
     C. FlowLayout.RIGHT
  20. If the height of a BorderLayout panel is too short to display both the North and South components, what happens?
     A. Both components equally share the space available
     B. The South component isn't shown
     C. The North component isn't shown
     D. The South component gets its preferred height, shrinking the North component
     E. The North component gets its preferred height, shrinking the South component
     F. The North and South components are both given their preferred heights, but one of them is not completely visible.
     G. Undefined


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.