unit 3 java mcq
unit 3 java mcq
The following steps are required to perform: 1) Implement the Listener interface and
override its methods. 2) Register the component with the Listener.
Answer Options:
o A. Exception Handling
o B. String Handling
o C. Event Handling
o D. None of the above
Correct Answer: C.
2. What is an event in the delegation event model used by Java programming language?
Answer Options:
o A. An event is an object that describes a state change in a source.
o B. An event is an object that describes a state change in processing.
o C. An event is an object that describes any change by the user and system.
o D. An event is a class used for defining objects to create events.
Correct Answer: A
4. The ActionListener interface is used for handling action events. For example, it's used
by
Answer Options:
o A. JButton
o B. JCheckBox
o C. JMenuItem
o D. All of these
Correct Answer: D
5. We use the inner class concept in event handling in Java by Adapter classes.
Answer Options:
o A. TRUE
o B. FALSE
Correct Answer: A
6. The event Delegation Model consists of the following steps: 1. Component generates
events. 2. Event object is prepared and passed to registered listener who will handle
the event.
Answer Options:
o A. Only 1 follows
o B. Only 2 follows
Correct Answer: B
7. The Following steps are required to perform: 1) Implement the Listener interface and
override its methods. 2) Register the component with the Listener.
Answer Options:
o A. Exception Handling
o B. String Handling
o C. Event Handling
o D. Action Handling
Correct Answer: C
8. To listen to mouse click events, the listener must implement the __________ interface
or extend the _______ adapter.
Answer Options:
o A. MouseListener / MouseAdapter
o B. MouseMotionListener / MouseMotionAdapter
o C. WindowListener / WindowAdapter
o D. ComponentListener / ComponentAdapter
Correct Answer: A
10. A source generates an event and sends it to ___________ listeners that can handle the
event.
Answer Options:
o A. One
o B. Two
o C. One or more
o D. None of these
Correct Answer: C
11. The Delegation Event Model is based on the concept of ____________
Answer Options:
o A. Source
o B. Listener
o C. Both a & b
o D. None of these
Correct Answer: C
12. Which of the following package contains all the classes and methods required for
event handling in Java.
Answer Options:
o A. java.awt
o B. java.event
o C. java.awt.event
o D. All of these
Correct Answer: C