revised: 10/05/03

on on Swing Frames

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. In Java, what do you call an area on the screen that has nice borders and various buttons along the top border?

A.    A window.
B.    A screen.
C.    A box.
D.    A frame.

2. What is the name of the Swing class that is used for frames?

A.    Window
B.    Frame
C.    JFrame
D.    SwingFrame

3. What method sets the size of the displayed JFrame?

A.    setSize( int width, int height)
B.    setSize( int height, int width)
C.    setVisible( int width, int height)
D.    setVisible( int height, int width)

4. The size of a frame on the screen is measured in:

A.    inches
B.    nits
C.    dots
D.    pixels

5. What is a container object in GUI programming?

A.    A container is another name for an array or vector.
B.    A container is any class that is made up of other classes.
C.    A container is a primitive variable that contains the actual data.
D.    A container is an object like a frame that has other GUI components placed inside of it.

6. Fill in the blanks so that this program displays a JFrame:

import java.awt.*;

public class microGUI
  public static void main ( String[] args )
    JFrame frm = new ___________();
    frm.___________( 150, 100 );
    frm.___________( true );

A.    Form, setVisible, setOn
B.    JFrame, setSize, setVisible
C.    Frame, setVisible, setSize
D.    Window, setSize, paint

7. Which of the following sets the frame to 300 pixels wide by 200 high?

A.    frm.setSize( 300, 200 );
B.    frm.setSize( 200, 300 );
C.    frm.paint( 300, 200 );
D.    frm.setVisible( 300, 200 );

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.