Java MCQ
Java MCQ
a. Graphics class
b. Component class
c. Both A & B
d. None of the above
2) Implement the Listener interface and overrides its methods is required to perform
in event handling.
a. True
b. False
3) Which is the container that doesn't contain title bar and MenuBars but it can have
other components like button, textfield etc?
a. Window
b. Frame
c. Panel
d. Container
6) Which method is used to set the graphics current color to the specified color in
the graphics class?
a. public abstract void setFont(Font font)
b. public abstract void setColor(Color c)
c. public abstract void drawString(String str, int x, int y)
d. None of the above
7) The Java Foundation Classes (JFC) is a set of GUI components which simplify the
development of desktop applications.
a. True
b. False
8) In Graphics class which method is used to draws a rectangle with the specified
width and height?
a. public void drawRect(int x, int y, int width, int height)
b. public abstract void fillRect(int x, int y, int width, int height)
c. public abstract void drawLine(int x1, int y1, int x2, int y2)
d. public abstract void drawOval(int x, int y, int width, int height)
9) Which object can be constructed to show any number of choices in the visible
window?
a. Labels
b. Choice
c. List
d. Checkbox
10) Which is used to store data and partial results, as well as to perform dynamic
linking, return values for methods, and dispatch exceptions?
a. Window
b. Panel
c. Frame
d. Container
13) Which is a component in AWT that can contain another components like buttons,
textfields, labels etc.?
a. Window
b. Container
c. Panel
d. Frame
14) AWT has more powerful components like tables, lists, scroll panes, color
chooser, tabbed pane etc.
a. True
b. False
15) Which are passive controls that do not support any interaction with the user?
a. Choice
b. List
c. Labels
d. Checkbox
16) How many types of controls does AWT support?
a. 7
b. 6
c. 5
d. 8
18) The ActionListener interface is not used for handling action events.
a. True
b. False
19) Which package provides many event classes and Listener interfaces for event
handling?
a. java.awt
b. java.awt.Graphics
c. java.awt.event
d. None of the above
20) Swing is not a part of JFC (Java Foundation Classes) that is used to create GUI
application
a. True
b. False
25) The ActionListener interface is not used for handling action events
a. True
b. False
26) The Swing Component classes that are used in Encapsulates a mutually exclusive
set of buttons?
a. AbstractButton
b. ButtonGroup
c. JButton
d. ImageIcon
36) How many line input takes from user in Text Field in AWT.
a. 3
b. 2
c. 1
d. None of Above
38) Which abstract class is the super class of all menu related classes?
a. MenuBar
b. CheckboxMenuItem
c. MenuItem
d. MenuComponent
39) Which can be used to represent a checkbox with a textual label that can appear in
a menu?
a. MenuBar
b. Menu
c. CheckboxMenuItem
d. MenuItem
Which layout is used for the container has a row of components that should all be
displayed at the same size, filling the container entire area?
a. FlowLayout
b. GridLayout
c. CardLayout
d. None of Above
47) Which layout is used to arrage components in a line left to right on after another?
a. FlowLayout
b. GridLayout
c. BorderLayout
d. CardLayout
60) The Swing Component classes that are used in Encapsulates a mutually exclusive
set of buttons?
a. ButtonGroup
b. JButton
c. AbstractButton
d. ImageIcon
65) Which of following method will respond when we click by mouse in frame?
a. mousePressed()
b. mouseEntered()
c. mouseClicked()
d. All of Above
66) Which of following method will be invoked if a character is entered from
keyboard?
a. keyTyped()
b. keyPressed()
c. keyReleased()
d. keyEntered()
70) Which of the methods are used to register a mouse motion listener?
a. addMouse()
b. addMouseListener()
c. addMouseMotionListner()
d. None of Above
77) What is an event in delegation event model used by Java programming language?
a. An event is an object that describes a state change in a source
b. An event is an object that describes a state change in processing
c. An event is an object that describes any change by the user and system
d. An event is a class used for defining object, to create events
80) Which of these methods can be used to determine the type of event?
a. getID()
b. getSource()
c. getEvent()
d. getEventObject()