Top 250+ Solved Java Programming MCQ Questions Answer
Q. A ------------- is a component that can hold other components.
a. A window
b. a container
c. A control
d. a form
Q. The method that returns the selected item from a List component is
a. getSelected()
b. getSelectedString()
c. getSelectedItem()
d. getSelectedData()
Q. The layout manager that lets you align components at north, south, east, west directions is
a. BorderLayout
b. GridLayout
c. FlowLayout
d. GridBagLayout
Q. The layout manager that lays out a container's components in a rectangular grid.
a. BorderLayout
b. GridLayout
c. FlowLayout
d. GridBagLayout
Q. The class used for drawing graphics in an application is
a. Canvas
b. Graphics
c. Layer
d. Container
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
Q. The method in Graphics class to set the drawing color
a. setForeground()
b. setDrawingColor()
c. setBrushColor()
d. setColor()
Q. The method used to draw an ellipse is
a. drawEllipse()
b. drawCircle()
c. drawOval()
d. none of these
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
Q. In a ____ control structure, the computer executes particular statements depending on some condition(s).
a. looping
b. repetition
c. selection
d. sequence