revised: 10/05/03


on Buttons

This is a practice quiz. The results are not recorded anywhere and do not affect your grade. The questions on this quiz might not appear in any quiz or test that does count toward your grade.

Instructions: For each question, choose the single best answer. Make your choice by clicking on its button. You can change your answers at any time. When the quiz is graded, the correct answers will appear in the box after each question.



1. What three types of software are needed in a complete GUI program

A.    GUI Components, Event Listeners, Application Code
B.    Action Events, Window Objects, Containers
C.    Frames, Windows, Containers
D.    Libraries, Toolkits, Interfaces

2. How is a GUI component (such as a button) placed into a JFrame?

A.    insert( Component c )
B.    getContentPane().add( Component c )
C.    draw( Component c )
D.    getContentPane().put( Component c )

3. What is the Java software that determines how the components of a container are displayed?

A.    Display Manager
B.    Component Manager
C.    Stage Manager
D.    Layout Manager

4. Which manager displays components row-by-row, in the order in which they were added to the Frame?

A.    CardLayout
B.    FlowLayout
C.    GridLayout
D.    BorderLayout

5. What method of a Frame is used to choose the layout manager?

A.    setLayout()
B.    add()
C.    actionPerformed()
D.    setVisible()

6. What interface must a class implement in order to be a listener for button ActionEvents?

A.    TextListener
B.    Runnable
C.    ActionListener
D.    ImageConsumer

7. What method must be implemented in a listener for button events?

A.    paint()
B.    windowClosing()
C.    addActionListener()
D.    actionPerformed()

8. What method of a content pane changes its color?

A.    setBackground( Color c )
B.    setForeground( Color c )
C.    add()
D.    getBackground()

9. When should your program call repaint()?

A.    Never--that is the system's job.
B.    Only once when the frame is created.
C.    Whenever a change has been made that should result in a new picture.
D.    Always---whenever any method finishes.

10. What method will immediately stop a program?

A.    System.gc()
B.    System.exit( 0 )
C.    System.setErr()
D.    return()

The number you got right:       Percent Correct:       Letter Grade:   


Click here

If you have returned here from another page, or have re-loaded this page, you will need to click again on each of your choices for the grading program to work correctly. You may want to press the SHIFT KEY while clicking to clear the old answers.