Paper Tayyari

Lecture 18: Java Graphics

MCQs, short and long questions from lecture 18.Lecture 18 ki MCQs, short aur long sawal.

6 MCQs · 9 short · 1 long question · 6 MCQs from past papers6 MCQs · 9 short · 1 long sawal · 6 MCQs past papers se

Start mock testMock test shuru karein
DoneHal kiye 0/6
– correctsahi
1.
★ Midterm Fall 2008

Which of the following methods are invoked by the AWT to support paint and repaint operations?

  1. Apaint( )
  2. Brepaint( )
  3. Cdraw( )
  4. Dredraw( )

The AWT system itself calls paint() when a component must be drawn; programs call repaint() to request it.

2.
★ Midterm Fall 2008

Which of the following are passed as an argument to the paint ( ) method?

  1. AA Canvas object
  2. BA Graphics object
  3. CAn Image object
  4. DA paint object

paint(Graphics g) receives a Graphics object used for drawing.

3.
★ Midterm Fall 2008

The code below draws a line. What color is the line? g.setColor(Color.red.green.yellow.red); g.drawLine(0, 0, 100,100);

  1. ARed
  2. BGreen
  3. CYellow
  4. DBlack

Each static field access through an instance just reads the named constant, so the last one, Color.red, is used.

4.
★ Final term 2012

Which of the following statement is true regarding paintComponent() method?

  1. AIt tells any components contained by this component to paint themselves.
  2. BIt tells the component to paint its border.
  3. CIt first paints the background and then performs custom painting.
  4. DIt first performs custom painting and then paints the background.

By default paintComponent paints the background, then the custom drawing is done.

5.
★ Final term 2012

Which of the following object is passed as an argument to paintComponent() method?

  1. AImage object
  2. BJpanel object
  3. CJFrame onject
  4. DGraphic object

paintComponent(Graphics g) receives a Graphics object.

6.
★ Final term 2012

Which of the following method of Graphics object is used to draw rectangle?

  1. ADrawRect(10,10,20,20);
  2. BdrawRect(10,10,20,20);
  3. CdrawReactangle(10,10,20,20);
  4. DDrawReactangle(10,10,20,20);

The Graphics method is drawRect(x, y, width, height).