Graphics Self Test With Answers


1) Which of the following statements is not correct?

a) AWT and GUI are different names for the same background thread.
b) The Event thread is separate from the GUI thread and just deals with
    event handling.
c) Java uses the graphics toolkit of each platform the java virtual machine
    is running on to render graphics.
d) The Graphics context is abstract and therefore cannot be instantiated.

( b )
 

2) Which of the following statements is not correct?

a) The GUI thread is also called the Event thread.
b) the methods to render component are all defined in the Container class
c) The GUI thread is responsible for painting and handling events
d) The GUI thread is a background thread like the garbage collector thread.

( b ) // Comment: the painting methods are defined in Component class

3) Which of the following statements is not correct?

a) A Color can be specified using the dot operator as in Color.darkGray
b) An alpha value of 0 is totally transparent while a value of 255 is a solid color
c)  Java supplies constructors to build colors on both the RGB and HSB models.
d)  HSB stands for hue saturation and brightness.      ( c )

// Comment: Java has no constructors that receive colors specified in HSB but
// does supply methods to convert between HSB and RGB

4) Which of the following may be located on, over or under the locations where
     characters are drawn.

a) MaxDescent
b) Leading
c) BaseLine
d) Ascent                                                            ( c )

//Comment: The baseline may be over under or centered characters locations.

5) Which of the following would draw a right angle triangle?

int[] x=new int[]{ 50, 50, 100, 100 }
int[] y=new int[]{ 50,100,100, 50 }

a) drawPolyline(x,y,3);
b) drawPolygon(x,y,3);
c) drawPolyline(x,y,4);
d) drawPolygon(x,y,4);                              ( b )

6) Select the correct answer. drawOval(150,200, 100, 200); will create an oval

a) whose center is located at the x,y coordinate (150,200) with a horizontal diameter
   of 100 pixels and vertical diameter of 200 pixels
b) bounded by an imaginary rectangle whose center is located at the x,y coordinate
    (150,200) and whose height is 100pixels and width is 200 pixels
c) bounded by an imaginary rectangle whose upper left corner is located at x,y
    coordinates (150,200) and whose height is 100 pixels and whose width is 200 pixels
d) bounded by an imaginary rectangle whose upper left corner is located at x,y
    coordinates (150,200) and whose height is 200 pixels and whose width is 100 pixels
( d )