Top 250+ Solved Java Programming MCQ Questions Answer

From 241 to 255 of 285

Q. A ------------- is a component that can hold other components.

a. A window

b. a container

c. A control

d. a form

  • b. a container

Q. The method that returns the selected item from a List component is

a. getSelected()

b. getSelectedString()

c. getSelectedItem()

d. getSelectedData()

  • c. getSelectedItem()

Q. The class used to make a standalone application in java.

a. Applet

b. Panel

c. Frame

d. Form

  • c. Frame

Q. ------------------- is an example of container class

a. Label

b. Panel

c. TextField

d. Button

  • b. Panel

Q. The class used to encapsulate fonts is

a. Graphics

b. Font

c. Applet

d. Component

  • b. Font

Q. The method used to set Fonts is

a. setFontName()

b. setFont()

c. setFontText()

d. none of these

  • b. setFont()

Q. The method setFont() is defined in---------- class

a. Applet

b. Font

c. Container

d. Component

  • d. Component

Q. The layout manager that lets you align components at north, south, east, west directions is

a. BorderLayout

b. GridLayout

c. FlowLayout

d. GridBagLayout

  • a. BorderLayout

Q. The layout manager that lays out a container's components in a rectangular grid.

a. BorderLayout

b. GridLayout

c. FlowLayout

d. GridBagLayout

  • b. GridLayout

Q. The class used for drawing graphics in an application is

a. Canvas

b. Graphics

c. Layer

d. Container

  • b. Graphics

Q. The method in Graphics class to draw a circle/oval with specified width and height.

a. drawCircle()

b. drawShape()

c. drawOval()

d. none of these

  • c. drawOval()

Q. The method in Graphics class to set the drawing color

a. setForeground()

b. setDrawingColor()

c. setBrushColor()

d. setColor()

  • d. setColor()

Q. The method used to draw an ellipse is

a. drawEllipse()

b. drawCircle()

c. drawOval()

d. none of these

  • c. drawOval()

Q. Which of the following statements is legal in Java?(i) mysRef = (Mystery) mySecret; (ii) mysRef = (Mystery) secRef;

a. Only (i)

b. Only (ii)

c. Both (i) and (ii)

d. None of these

  • b. Only (ii)
Subscribe Now

Get All Updates & News