MCQ Answers Updated
MCQ Answers Updated
MCQ Answers Updated
1. 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: CheckboxMenuItem
a. ComponentListener
B .ContenerListener
c. ActionListener
d. InputListener
Answer: ActionListener
a.Only i
b.Only ii
c. Both
d. None of Above
Answer: Both
4. Which of the following sets the frame, say frame, to 300 pixels wide by 200 high?
b. f.setSize( 200,300 );
d. None of these
a. TreeNode
d.None
Answer: DefaultMutableTreeNode
c.The user I/O is not performed using java stream I/O class.
a. javax.swing
b. java.awt
c. java.util
d. java.applet
Answer: javax.swing
8. The following: a) It is lightweight. b) It supports pluggable look and feel. c) It follows MVC
(Model View Controller) architecture are the advantages of _____.
a. Swing
b. AWT
c.ActionEvent
d. None of above
Answer: Swing
Answer: The KeyListener should be added either in init() or the main method
10. The MouseListener interface specifies the following methods: mouseClicked,
mouseEntered, mouseExited, mousePressed, and mouseReleased. In order to use a
MouseListener in your code, you must provide an implementation for which of the
following?
11. The ActionListener interface is not used for handling action events.
a) True
b) False
Answer: False
12. Which Method of the component class is used to set the position and size of the
component?
a. setPosition
b.setBounds
c.setSize
d.none of above
Answer: setBounds
13. In Swing ____ Gives Visual Representation of the Component
a. Model
b.View
c.Controller
d.none of above
Answer: View
14. What does the following line of code do? TextField text = new TextField(20);
d.Invalid Code
15. Using a FlowLayout manager, which is the correct way to add elements to a container?
a) add (component);
b) add(“Center”, component);
b) add(x, y, component);
d) set(component);
Answer: add(component)
Answer: AWT controls include elements like Buttons, Labels, Checkboxes, etc.
16. Which of these method interfaces define a method `itemStateChanged()`?
a. ComponentListener
b.ContenerListener
c.ActionListener
d.ItemListener
Answer: ItemListener
a.ActionEvent b.KeyEvent
c.WindowEvent d.AdjustmentEvent
Answer: AdjustmentEvent
a.keyPressed() b.keyReleased()
c.keyTyped() d.keyEntered()
Answer: keyTyped()
Answer: Component
Answer: java.awt
23. AWT is used for creating a GUI in Java. AWT stands for
Answer: java.awt