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


rotten apple on Applets

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. Why does an applet have no main() method?

A.    The browser acts as the main. The applet provides methods for the browser.

B.    The paint() method is like the main method for an applet.

C.    Programs that do graphics don't need a main.

D.    Only simple programs need a main.


2. What class must be extended when you code an applet?

A.    AWT

B.    JDK

C.    JApplet

D.    Graphics


3. What is the role of the Graphics object?

A.    It represents the area the applet can draw in and provides drawing methods.

B.    It can be omitted, but is sometimes used for file i/o.

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

D.    It contains a list of commands from the browser to your applet.


4. The width and height of the drawing area correspond to coordinates:

A.    X and Y, with (0,0) in the lower left corner

B.    X and Y, with (0,0) in the upper left corner

C.    Y and X, with (0,0) in the lower left corner

D.    Y and X, with (0,0) in the lower right corner


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 set of tags is embedded in a text file to tell the browser how to treat each section of text?

A.    HTTP

B.    TCP

C.    HTML

D.    VRML


8. Which of the following is a correct web page for the applet MyApplet?

A.   

<html>
<body>
<applet code="MyApplet.class">
</applet>
</body>
</html>

B.   

<html>
<body>
<applet code="MyApplet.class"  width="250" height="200">
</body>
</html>

C.   

<html>
<applet code="MyApplet.class"  width="250" height="200">
</applet>
</html>

D.   

<html>
<body>
<applet code="MyApplet.class"  width="250" height="200">
</applet>
</body>
</html>


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.