Quiz on Basic GUI

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 it called when a program is written to respond to the button clicks, menu selections, and other actions of the user in whatever order the user does them?
a.    Event-driven programming.
b.    Action-driven programming.
c.    User-driven programming.
d.    Mouse-driven programming

2. Usually GUI programs are written by using existing software components provided in a toolkit. The Java toolkit used in this chapter is the:
a.    GUI toolkit
b.    Abstract Windowing Toolkit
c.    Graphics Event Toolkit
d.    Java Enhancement Toolkit

3. The three software parts of a GUI program are:
a.    Windows, Buttons, Mice
b.    GUI Components, Graphics, Code
c.    GUI Components, Event Listeners, Application Code
d.    Frames, Code, Events

4. What is the one component that nearly all GUI programs will have?
a.    Frame
b.    Mouse
c.    Monitor
d.    Button

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 Frame:
import java.awt.*;

public class microGUI
{
  public static void main ( String[] args )
  {
    Frame frm = new ___________();
    frm.___________( 150, 100 );
    frm.___________( true );
  }
}
a.    Form, setVisible, setOn
b.    Frame, 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 );

8. Fill in the blanks so that the following draws a Frame containing "Hello".
import java.awt.*; 

class helloFrame ___________ Frame
{
  public void ___________( Graphics g )
  {
    g.___________("Hello", 10, 50 );                                                 
  }
}

public class Tester
{
  public static void main ( String[] args )
  {
    helloFrame frm = new helloFrame();  
    frm.setSize( 150, 100 ); 
    frm.setVisible( true );
  }
}
a.    import, drawString, paint
b.    extends, paint, drawString
c.    extends, draw, paint
d.    include, drawString, paint

9. When is the paint() method of a frame object called?
a.    The user calls it to display the frame.
b.    The main() method calls it once when the program starts.
c.    The Java system calls it every time it decides to display the frame.
d.    The Java system calls it once when the program starts.

10. What is a Graphics object?
a.    The Graphics object represents the part of the Frame that you can draw on.
b.    The Graphics object represents the whole Frame.
c.    The Graphics object represents the entire monitor.
d.    The Graphics object represents the graphics board.

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.