Professional Documents
Culture Documents
MCQ Unit-1
MCQ Unit-1
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
Answer: Option C
• A. AbstractButton
• B. ButtonGroup
• C. JButton
• D. ImageIcon
Answer: Option B
3. 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
Answer: Option C
4. In Graphics class which method is used to draws a rectangle with the specified
width and height?
Answer: Option A
5. Name the class used to represent a GUI application window, which is optionally
resizable and can have a title bar, an icon, and menus.
• A. Window
• B. Panel
• C. Dialog
• D. Frame
Answer: Option D
Answer: Option D
7. Which is a component in AWT that can contain another component like buttons,
text fields, labels etc.?
• A. Window
• B. Container
• C. Panel
• D. Frame
Answer: Option B
8. 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
Answer: Option C
• A. Labels
• B. Pushbuttons
• C. Checkboxes
• D. Choice lists
• E. All of these
Answer: Option E
Answer: Option B
• A. java.awt
• B. java.Graphics
• C. java.awt.Graphics
• D. None of the above
Answer: Option C
12. By which method You can set or change the text in a Label?
• A. setText()
• B. getText()
• C. Both A & B
• D. None of the above
Answer: Option A
13. Which class can be used to represent a checkbox with a textual label that can
appear in a menu.
• A. MenuBar
• B. MenuItem
• C. CheckboxMenuItem
• D. Menu
Answer: Option C
• A. Swing
• B. AWT
• C. Both A & B
• D. None of the above
Answer: Option A
15. The Java Foundation Classes (JFC) is a set of GUI components which simplify
the development of desktop applications?
• A. True
• B. False
• C. All of these
• D. None
Answer: Option A
16. How many types of controls does AWT supports these controls are subclasses
of component?
• A. 7
• B. 6
• C. 5
• D. 8
Answer: Option A
17. Which are passive controls that do not support any interaction with the user?
• A. Choice
• B. List
• C. Labels
• D. Checkbox
Answer: Option C
• A. 1
• B. 2
• C. 3
• D. 4
Answer: Option C
19. The following way is used to create a frame is by creating the object of Frame
class?
• A. inheritance
• B. association
• C. Both A & B
• D. None of the above
Answer: Option B
20. Which of the following classes are derived from the Component class.
• A. Container
• B. Window
• C. List
• D. MenuItem
Answer: Option D
Ans : C
Explanation: AWT stands for Abstract Window Toolkit and infact it is a package –
java.awt. The classes of this package give the power of creating a GUI
environment to the programmer in Java.
A. system
B. component
C. container
D. component manager
Ans : B
A. java.all.Component
B. all.awt.Component
C. java.awt.Component
D. awt.Component
Ans : C
Explanation: It is java.awt.Component.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
Ans : A
A. 2
B. 3
C. 4
D. 5
Ans : D
A. border layout
B. grid layout
C. panel
D. layout manager
Ans : D
27. Which method used to place some text in the text field?
A. getText(String str)
B. setText(String str)
C. putText(String str)
D. None of the above
Ans : B
A. java.awt.ActionListener interface
B. java.awt.event.ActionListener
C. awt.event.ActionListener interface
D. java.awt.event.ActionListener interface
Ans : D
29. Which method used to change the foreground (text) color of components like
text field?
A. setBackground(Color clr)
B. setForeground(Color clr)
C. setColor(Color clr)
D. setEditable(boolean state)
Ans : B
A. Yes
B. No
C. Can be yes or no
D. Can not say
Ans : A
31. Which of the following classes in Java contains swing version of an applet?
1. JButton
2. JCheckBox
3. JApplet
4. AbstractButton
5. JLabel
Correct Option: C
Explanation:
Correct Option: D
Explanation:
Explanation:
Correct Option: B
Explanation:
Correct Option: A
Explanation:
This component in Java swing is represented by a rectangular area in which a
component may be viewed.
36. Which of the following classes in java.awt package describes a graphics
device such as a screen or printer?
1. Canvas
2. GraphicsDevice
3. Frame
4. None of these
Correct Option: B
Explanation:
Correct Option: C
38. What is invoked via HTTP on the Web server computer when it responds to
requests from a user's Web browser?
1. A Java application
2. A Java applet
3. A Java servlet
4. None of these
Correct Option: C
39. Which component of an event is the object that generates the event?
1. Event object
2. Event source
3. Event handler
4. None of these
Correct Option: B
Explanation:
Correct Option: A
Explanation:
Correct Option: B
Explanation:
Correct Option: C
43. Which event is generated when a checkbox or a list item is clicked or when a
check menu item is selected or deselected?
1. Container Event
2. Component Event
3. Focus Event
4. Item Event
Correct Option: D
Explanation:
Item Event is generated when a check box or a item list is clicked or when a check
menu item is selected or deselected.
44. Swing elements are preceded by the letter
1. S
2. A
3. X
4. J
Correct Option: D
45. Which of the following user interfaces defines how should components be
arranged in a container?
1. Component
2. Container
3. Layout manager
4. None of these
Correct Option: C
Explanation: