Create Software Components 

Using Java Level 2

 

 

Course Info

Scheme

Resources

Tutorials

Java Demos

Utilities

Links


 

    Quiz 7

Graphics Methods

There are 10 questions

Question 1.       

Which graphics method statement below would you use to create a circle of radius 20, with the top left point of a rectangle containing the circle at x=60 and y=60.?

 

(a)  g.drawOval(60,20,60,20);

(b)  g.filloval (20,20,60,60);

(c)  g.filloval (60,60,40,40);  

(d)  g.drawOval (60,60,40,40);

Question 2.       

Which graphics method statement below would you use to create an arc with....

  • an arc angle of 90 and the starting point of the arc at 0

  • fill color

  • height and width of 50

  • the top left point of a rectangle containing the arc at x=10 and y=10.

 

(a)  g.drawArc(10,10,50,50, 0, 90);

(b)  g.fillArc (10,10,50,50, 0, 90);

(c)  g.fillArc (10,10,0,90,50,50);  

(d)  g.drawArc (10,50,10,50,0,90);  

Question 3.       

Which graphics method statement below would you use to create a raised rectangle with fill color?

 

(a)  g.fillRect(10,10,100,100);

(b)  g.drawRect (10,10,100,100);

(c)  g.fill3DRect (10,10,100,100, true);  

(d)  g.draw3DRect (10,10,100,100, true);  

Question 4.       

Which graphics method statement below would you use to create a rectangle without fill color.

 

(a)  g.fillRect(10,10,100,100);

(b)  g.drawRect (10,10,100,100);

(c)  g.fill3DRect (10,10,100,100, true);  

(d)  g.draw3DRect (10,10,100,100, true);  

Question 5.       

Which graphics method statement below would you use to create a vertical line, 100 pixels long? 

 

(a)  g.drawLine(10,10,110,110);

(b)  g.drawLine(10,10,110,10);

(c)  g.drawLine(10,10,100,100);  

(d)  g.drawLine(10,10,10,110);  

Question 6.       

Write down the Graphics method commonly used to draw text to an Applet window.  (Don't include the g part or the arguments, just the method name.)

d__________________

Question 7.       

Write down the Graphics method commonly used to set the color of the graphics object g.  (Don't include the g part or the arguments, just the method name.)

__________________

Question 8.       

To create an instance of a Font class, which of the following is correct?

 

(a)  aFont = new Font( myFont );

(b)  Font( "Arial", Font.BOLD + Font.ITALIC, 12 );

(c)  Font new Font( "Arial", Font.BOLD + Font.ITALIC, 12 );  

(d)  Font aFont = new Font( "Arial", Font.BOLD + Font.ITALIC, 12 );  

Question 9.       

Write down the Graphics method commonly used to set the font of the graphics object g.  (Don't include the g part or the arguments, just the method name.)

__________________

Question 10.       

To create an a custom Color object - that will produce a dark shade of red, which of the following is correct?

 

(a)  Color aColor = new Color( 50,0,0 );

(b)  Color aColor = new Color( 0,50,0 );

(c)  Color aColor = new Color( 0,0,50 );  

(d)  Color aColor = new Color( 0,0,0 );  

 

        

 

  Site Home 

Java Home   

  Forum  

Course Info

Welcome

Overview

Assessment

Qualification

Scheme of Work

Assignments

Resources

Information

Blackboard

Learning Center

Web Materials

Reading

Java Demos

Utilities

Links

Lecture Materials

Tutorials & Notes

Exercises

Activities

Quizzes

 

Site Home

Top

Unit Home

ADR 2002