Chapter 61 --- Quiz

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 method is used to initialize the size of a Frame() object?
a.    setsize(int width, int height)
b.    setsize(int height, int width)
c.    setSize(int width, int height)
d.    SetSize(int height, int width)

2. What method is used to prevent a user from changing the size of a Frame() object?
a.    setResizable( true )
b.    setResizable( false )
c.    setResizeable( true )
d.    setEditable( false )

3. What pattern does the FlowLayout layout manager use to add components to a container?
a.    Left to right, top to bottom
b.    bottom to top, right to left
c.    top to bottom, centered in each row
d.    any old order

4. Which of the following are container classes?
a.    Frame and Button
b.    Button and Label
c.    Frame and TextField
d.    Frame and Panel

5. What layout manager do Panels use by default?
a.    GridLayout
b.    FlowLayout
c.    no default layout manager
d.    the same layout manager as the Frame

6. After adding components to the Panels of a GUI, what must be done next?
a.    Nothing---the GUI work is done.
b.    The components must be instantiated.
c.    The Panels must be added to the Frame.
d.    The layout manager must now be set.

7. Can GUI components inside of a Panel have a registered listener?
a.    No---only those components directly added to a Frame can have listeners.
b.    No---only Frames can have listeners.
c.    Yes---it doesn't matter if a component is contained in a Panel.
d.    Yes---but the Panel must be the listener.

8. Say that a Frame contains three Panels. Could each Panel have a different layout manager?
a.    No---they must all use the default layout manager.
b.    No---they must all use the same layout manager.
c.    Yes---each one must be different.
d.    Yes---each one can use setLayout() with any layout manager.

9. Which of the following commands will set a layout manager that divides the container into 3 rows of 4 columns?
a.    setLayout( new GridLayout(3, 4) );
b.    setLayout( new GridLayout(4, 3) );
c.    setLayout( 4, 3 );
d.    setLayout( new FlowLayout(4, 3) );

10. How many GUI components can go into each cell with GridLayout?
a.    None
b.    1
c.    Only one Panel per cell.
d.    As many as you need.


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.)


Click here to go back to the main menu.