Previous | Home | Next |
(a). g.setColor(Color.cyan);
(b). g.setCurrentColor(cyan);
(c). g.setColor("Color.cyan");
(d). g.setColor("cyan’);
(d). g.setColor(new Color(cyan));
Answer: (a). g.setColor(Color.cyan);
g.setColor(Color.red.green.yellow.red.cyan);
g.drawLine(0, 0, 100,100);
(a). Red
(b). Green
(c). Yellow
(d). Cyan
(e). Black
Answer: (d). Cyan
g.setColor(Color.black);
g.drawLine(10, 10, 10, 50);
g.setColor(Color.RED);
g.drawRect(100, 100, 150, 150);
(a). A red vertical line that is 40 pixels long and a red square with sides of 150 pixels
(b). A black vertical line that is 40 pixels long and a red square with sides of 150 pixels
(c). A black vertical line that is 50 pixels long and a red square with sides of 150 pixels
(d). A red vertical line that is 50 pixels long and a red square with sides of 150 pixels
(e). A black vertical line that is 40 pixels long and a red square with sides of 100 pixel
Answer: (b). A black vertical line that is 40 pixels long and a red square with sides of 150 pixels
(a). A polyline is always filled.
(b). A polyline can not be filled.
(c). A polygon is always filled.
(d). A polygon is always closed
(e). A polygon may be filled or not filled
Answer:
(b). A polyline can not be filled.
(d). A polygon is always closed
(e). A polygon may be filled or not filled
(a). new Font(Font.SERIF, 24,Font.BOLD);
(b). new Font("SERIF", 24, BOLD");
(c). new Font("BOLD ", 24,Font.SERIF);
(d). new Font("SERIF", Font.BOLD,24);
(e). new Font(Font.SERIF, "BOLD", 24);
Answer: (d). new Font("SERIF", Font.BOLD,24);
Public void paint(Graphics g) { g.drawString("question #6",10,0); }
(a). The string "question #6", with its top-left corner at 10,0
(b). A little squiggle coming down from the top of the component, a little way in from the left edge
Answer: (b). A little squiggle coming down from the top of the component, a little way in from the left edge
Public void paint(Graphics g) { g.drawString("question #6",10,0); }
(a). A circle at (100, 100) with radius of 44
(b). A circle at (100, 44) with radius of 100
(c). A circle at (100, 44) with radius of 44
(d). The code does not compile
Answer: (d). The code does not compile
Answer: A Canvas object provides access to a Graphics object via its paint( ) method.
Answer: The Canvas, Frame, Panel and Applet classes support painting.
Answer: The paint( ) method supports painting via a Graphics object. The repaint( ) method is used to cause paint( ) to be invoked by the AWT painting method.
Answer: The FontMetrics class is used to define implementation-specific properties, such as ascent and descent, of a Font object.
(a). A Canvas object
(b). A Graphics object
(c). An Image object
(d). A paint object
Answer: (b). A Graphics object
Q.13 Which of the following methods are invoked by the AWT to support paint and repaint operations?
(a). paint( )
(b). repaint( )
(c). draw( )
(d). redraw( )
Answer: (a). paint( )
(a). Canvas
(b). Image
(c). Frame
(d). Graphics
Answer:
(a). Canvas
(c). Frame
(a). drawRect( )
(b). drawImage( )
(c). drawPoint( )
(d). drawString( )
Answer:
(a). drawRect( )
(b). drawImage( )
(d). drawString( )
(a). ascent
(b). leading
(c). case
(d). height
Answer:
(a). ascent
(b). leading
(d). height
(a). The AWT automatically causes a window to be repainted when a portion of a window has been minimized and then maximized.
(b). The AWT automatically causes a window to be repainted when a portion of a window has been covered and then uncovered.
(c). The AWT automatically causes a window to be repainted when application data is changed.ascent
(d). The AWT does not support repainting operations.
Answer:
(a). The AWT automatically causes a window to be repainted when a portion of a window has been minimized and then maximized.
(b). The AWT automatically causes a window to be repainted when a portion of a window has been covered and then uncovered.
Answer: getSize( ) method.
Answer: setForeground( ) and setBackground( ) methods.
public void paint(Graphics g) { g.drawString("Dolly",50,10); }
What will be the result when you attempt to compile and run the program?
(a). The string "Dolly" will be displayed at the centre of the frame
(b). An error at compilation complaining at the signature of the paint method
(c). The lower part of the word Dolly will be seen at the top of the form, with the top hidden.
(d). The string "Dolly" will be shown at the bottom of the form
Answer: (c). The lower part of the word Dolly will be seen at the top of the form, with the top hidden.
g.fillArc(45,90,50,50,90,180);
(a). An arc bounded by a box of height 45, width 90 with a centre point of 50,50, starting at an angle of 90 degrees traversing through 180 degrees counter clockwise.
(b). An arc bounded by a box of height 50, width 50, with a centre point of 45,90 starting at an angle of 90 degrees traversing through 180 degrees clockwise.
(c). An arc bounded by a box of height 50, width 50, with a top left at coordinates of 45, 90, starting at 90 degrees and traversing through 180 degrees counter clockwise.
(d). An arc starting at 45 degrees, traversing through 90 degrees clockwise bounded by a box of height 50, width 50 with a centre point of 90, 180.
Answer: (c). An arc bounded by a box of height 50, width 50, with a top left at coordinates of 45, 90, starting at 90 degrees and traversing through 180 degrees counter clockwise.
import java.awt.*; public class SetF extends Frame { public static void main(String argv[]) { SetF s = new SetF(); s.setSize(300,200); s.setVisible(true); } }
How could you set the frame surface color to pink
(a). s.setBackground(Color.pink);
(b). s.setColor(PINK);
(c). s.Background(pink);
(d). s.color=Color.pink
Answer: (a). s.setBackground(Color.pink);
Previous | Home | Next |