created: 01/22/00 revised: 10/04/03, 02/12/06, 12/04/2010, 10/30/2012, 07/04/2016

rotten apple on Graphics

Instructions: For each question, choose the single best answer. Make your choice by clicking on its button. To grade the quiz, click on the button at the bottom.

1. What is the name of the package that contains many of the graphical components?

A.    Swing

B.    Slide

C.    Awk

D.    JFC

2. What class represents a window?

A.    JPanel

B.    Frame

C.    JApplet

D.    JFrame

3. What is the role of the Graphics object?

A.    It represents the drawing area of a component and provides drawing methods.

B.    It holds methods that react to clicks on the maximize, minimize, and close buttons of the window.

C.    It represents the entire screen of the computer monitor.

D.    It is where the main logic of a graphical application is put.

4. The getWidth() method returns a value for

A.    the width of the component in inches

B.    the width of the component in number of pixels

C.    the maximum length of a line that may be drawn in the panel

D.    the width of the component in ems.

5. What is a location in a digital image called?

A.    pipin

B.    pickerel

C.    pixel

D.    pickel

6. Which of the following draws a line from the upper left corner of the drawing area to the center? Assume that graph holds a Graphics object reference and that the width of the drawing area is 300 and the height is 400.

A.    graph( 0, 0, 300/2, 400/2);

B.    drawLine( graph, 0, 0, 300/2, 400/2);

C.    graph.drawLine( 300-1, 400-1, 300/2, 400/2);

D.    graph.drawLine( 0, 0, 300/2, 400/2);

7. What methods is used to say what operation is performed when the user clicks on the "close" button of the frame?

A.    setCloseOperation()

B.    setDefaultClose()

C.    setDefaultCloseOperation()

D.    setOperation()

8. Which of the following should be used to add a panel of class MyPanel to a frame?


frame.add( new MyPanel() );


(new DemoPanel() ).add( frame );


frame.pack( new MyPanel() )


frame.getContentPane().add( new MyPanel() );

9. Which of the following draws a circle with a radius of 50 at X=10, Y=20?

A.    graph.drawCircle( 50 );

B.    graph.drawOval( 50, 50 );

C.    graph.drawOval( 10, 20, 50, 50 );

D.    graph.drawCircle( 50, 50, 10, 20 );

10. Which of the following sets the pen color to blue?

A.    set( BLUE );

B.    setPen( Color.BLUE );

C.    setColor( Color.BLUE );

D.    setColor( BLUE );

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.