Subscribe Us

Core Java - Interview Questions and Answers

441. Which constructor creates a TextArea with 10 rows and 20 columns?
a) new TextArea(10, 20)
b) new TextArea(20, 10)
c) new TextArea(new Rows(10), new columns(20))
d) new TextArea(200)

Ans : a.
(Usage is TextArea(rows, columns)

442. Which of the following creates a List with 5 visible items and multiple selection enabled?
a) new List(5, true)
b) new List(true, 5)
c) new List(5, false)
d) new List(false,5)

Ans : c.

443. Which are true about the Container class?
a) The validate( ) method is used to cause a Container to be laid out and redisplayed.
b) The add( ) method is used to add a Component to a Container.
c) The getBorder( ) method returns information about a Container’s insets.
d) The getComponent( ) method is used to access a Component that is contained in a Container.

Ans : a, b and d.

444. Suppose a Panel is added to a Frame and a Button is added to the Panel. If the Frame’s font is set to 12-point TimesRoman, the Panel’s font is set to 10-point TimesRoman, and the Button’s font is not set, what font will be used to dispaly the Button’s label?
a) 12-point TimesRoman
b) 11-point TimesRoman
c) 10-point TimesRoman
d) 9-point TimesRoman

Ans : c.

445. A Frame’s background color is set to Color.Yellow, and a Button’s background color is to Color.Blue. Suppose the Button is added to a Panel, which is added to the Frame. What background color will be used with the Panel?
a) Colr.Yellow
b) Color.Blue
c) Color.Green
d) Color.White

Ans : a.

446. Which method will cause a Frame to be displayed?
a) show( )
b) setVisible( )
c) display( )
d) displayFrame( )

Ans : a and b.

447. All the component classes and container classes are derived from _________ class.

Ans : Object.

448. Which method of the container class can be used to add components to a Panel.

Ans : add ( ) method.

449. What are the subclasses of the Container class?

Ans : The Container class has three major subclasses.
They are :
Window
Panel
ScrollPane

450. The Choice component allows multiple selection.
True. / False.

Ans : False.


Post a Comment

3 Comments

  1. This comment has been removed by a blog administrator.

    ReplyDelete
    Replies
    1. This comment has been removed by a blog administrator.

      Delete
  2. This comment has been removed by a blog administrator.

    ReplyDelete