Quiz 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. What method of a Frame object is used to place a GUI component (such as a button) into the Frame?
a.    insert( Component c )
b.    add( Component c )
c.    draw( Component c )
d.    click( 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 set 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 Frame 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 it has made a change to what should be displayed in the Frame.
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:   

(If you have just 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 on reload to clear the old answers.) )


Click here to go back to the main menu.