creation: 02/18/05


Quiz on JPanels and Box Layout

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 is the part of a frame that holds the graphical components?

A.    content pane
B.    content provider
C.    data frame
D.    window pane

2. What type of object determines where GUI components are placed in a container?

A.    The layer organizer.
B.    The component manager.
C.    The frame manager.
D.    The layout manager.

3. What method of a frame prevents (or allows) a user to change the size of the frame?

A.    setResizable()
B.    setStretch()
C.    clearSizable()
D.    clearUser()

4. How does FlowLayout() put components into the content frame?

A.    By rows starting at the top, then left to right in each row.
B.    Starts at the bottom, then right to left in each row.
C.    Starts at the center, then spirals outward.
D.    Puts the first component in the center, then squeezes the rest in around it.

5. What type of component is a JPanel()?

A.    Container
B.    JFrame
C.    JButton
D.    JWindow

6. What is the default layout manager for JPanel?

A.    PanelLayout
B.    FrameLayout
C.    FlowLayout
D.    BoxLayout

7. Which alignment directions may be used with BoxLayout?

A.    Horizontal only.
B.    Horizontal and Vertical.
C.    Left aligned and Right aligned.
D.    Centered and Justified.

8. Can a JPanel be placed inside another JPanel?

A.    Yes.
B.    No, only visible components may be placed in JPanels.
C.    No, JPanel can't be nested.
D.    Yes, but only one JPanel may be placed inside another.

9. Can a different layout manager type be picked for each JPanel in a content pane?

A.    No, only one type of layout manager is used for the entire frame.
B.    Yes, each container has its own layout manager, independent of any others.
C.    No, all JFrames in a frame use the same layout manager.
D.    Yes, but only if JPanels are nested.

10. How are components added to a JPanel?

A.    With the set() method.
B.    With the add() method.
C.    With the put() method.
D.    With the setComponent() method.

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.