Assignment 4 Event Handling
Assignment 4 Event Handling
:- 4
Event Handling
11. Till now, two models have been introduced in Java for
a. Receiving and Processing events
b. Deleting and Processing events
c. Receiving and Deleting events
d. Modifying and Receving events
12. An event is generated whe the internal state of the event source is________
a. Not changed
b. Changed
c. Either changed or not
d. None of these
22. The Delegation Event Model defines a ______________ approach to handle events:
a. Logical
b. Physical
c. Both a & b
d. None of these
24. A source generates an event and sends it to ___________ listeners that can handle
the event:
a. One
b. Two
c. One or more
d. None of these
25. Applet is a small program written in the Java programming language that
performs:
a. A specific task
b. May or may not be a part of a larger program
c. Both a & b
d. None of these
26. _______ generates action events when an item is double-clicked, generate action
events when an item is selected or deselected.
a. List
b. Check box
c. Menu item
d. Text box Label
27. ItemListener event defines this method...
a) itemEventChanged( )
b) itemEventOcurred( )
c) itemValueChanged( )
d) itemStateChanged( )
31. package contains all the classes and methods required for Event handling in java.
(a) java.applet
(b) java.awt
(c)java.event
(d)java.awt.event
38. Which of these methods can be used to determine the type of event ?
(a) getSoureeO
(b) getEventO
(c) getIDO
(d) getEventObjeetO
47. method can be used to know the degree of adjustment made by the user.
(a) getValue()
(b) getAdjustmentType()
(c) getAdjustmentValue()
(d) getAdjustmentAmount()
49. Which of these constant value will change when the button at the end of scroll bar was
clicked to increase its value?
(a) BLOCK_DECREMENT
(b) BLOCK_INCREMENT
(c) UNIT_DECREMENT
(d) UNIT_INCREMENT
51. When the component is added or removed ? Which of these events is generated
?
(a) ComponentEvent
(b) ContainerEvent
c) FocusEvent
(d) InputEvent
52. method can be used to obtain the reference to the container that generated a
ContainerEvent.
(a) getContainerO
(b) getContainerCommandO
(c) getActionEventO
(d) getContainerEventO
53. Which is the constant used for always providing the vertical scrollbar
(a) VERTICAL_SCROLLBAR_ALWAYS
(b)VERTICAL _SCROLLBAR_AS_NEEDED
58. Which of the following method can be used to obtain the coordinates of a mouse?
(a)getPoint()
(b) getCoordinates()
(c) getMouseXY()
(d) getMouseCordinates()
66. Which of these packages contains all the event handling interfaces?
(a) java.lang
(b) java.awt
(c) java.awt.event
(d) java.event
67. When a component is added to a container which of these interfaces handles the event?
a. ComponentListener
b. ContainerListener
c. FocusListener
d. InputListener
71. Which method from the following methods will respond when you click any button by
mouse?
(a) mouseClicked()
(b) mouseEntered()
(c) mousePressed()
(d) All of the mentioned
76. In Java, events are all the activities that occur between:
(a)The user
(b) The application
(c) Both (a) and (b)
(d) None of the above
78. The Component class is an abstract class and so its are used to create components.
(a) Subclasses
(b)Superclasses
(c)Both (a) and (b)
(d)None of these.
79. The AWT classes can be roughly categorized into the following groups:
a. GUI component
b. Layouts
c. Graphics tools
d. All of these
82. The constructor that is defined by the Text Event class is:
a. TextEvenet(Object source, int event_type )
b. textevent (Object source, int event_type )
c. textevent (object Source, float event_type)
d. textevent (Object source, string event_type)
85. An event is generated when the internal state of the event source is
(a) Not changed
(b) Changed
(c) Either changed or not
(d) None of these.
88. Which of the following is the highest class in the event- delegation model ?
a. java.util.EventListener
b. java.util.EventObject
c. java.awt.A WTEvent
d. java.awt.event.A WTEvent
89. When two or more objects are added as listeners for the same event, which listener is first
invoked to handle the event?
(a) The first object that was added as listener.
(b) The last object that was added as listener.
(c) There is no way to determine which listener will be invoked first.
(d) It is impossible to have more than
92. Suppose that you want to have an object "eh" to handle the TextEvent of a TextArea object.
How should you add eh as the event handler to it?
a) t.addTextListener(eh);
b) eh.addTextListener(t);
c) addTextListener(eh.t);
d) addTextListener(t,eh);
95. The event delegation model, introduced in release 1.1 ofthe JDK, is fully compatible with the
event model.
(a) True
(b) False
96. A component subclass that has executed enableEvents() to enable processing of a certain
kind of event cannot also use an adapter as a listener for the same kind of event.
(a) True
(b) False