Event Hand
Event Hand
C. A type of exception
D. A data type
A. An event listener
A. `java.util`
B. `java.swing`
C. `java.awt.event`
D. `java.io`
5. In Java, which method is used to register an event listener with an event source?
A. `addEventListener()`
B. `addEventSource()`
C. `addActionListener()`
D. `addEventHandler()`
6. What is the purpose of the `ActionEvent` class in Java event handling?
A. It represents an exception
7. In Java event handling, what is the purpose of the `getSource()` method of the
`ActionEvent` class?
8. Which event listener interface is used for handling action events in Java?
A. `ActionHandler`
B. `EventHandler`
C. `EventListener`
D. `ActionListener`
9. In Java, how do you specify that an event should trigger a particular method for event
handling?
10. What is the purpose of the `ItemEvent` class in Java event handling?
B. It represents an item event generated by components like checkboxes and radio buttons
A. `handleCheckbox()`
B. `onItemEvent()`
C. `itemStateChanged()`
D. `checkboxSelected()`
12. What is the purpose of the `MouseListener` interface in Java event handling?
A. It represents an exception
13. In Java event handling, what is the purpose of the `MouseEvent` class?
B. It represents an exception
14. Which method is used to handle mouse clicks in Java event handling?
A. `clickEvent()`
B. `onMouseClick()`
C. `handleClick()`
D. `mouseClicked()`
15. In Java event handling, what is the purpose of the `KeyEvent` class?
A. It represents an exception
A. `WindowHandler`
B. `WindowListener`
C. `WindowEvent`
D. `WindowHandler`
17. What is the purpose of the `WindowEvent` class in Java event handling?
D. It represents an exception
18. In Java event handling, which method is used to handle window closing events?
A. `closeWindow()`
B. `onWindowClose()`
C. `handleClose()`
D. `windowClosing()`
A. It provides a string that describes the action command associated with an event
B. It handles exceptions
20. In Java event handling, which event is generated when a button is clicked?
A. KeyEvent
B. WindowEvent
C. MouseEvent
D. ActionEvent
21. Which method is used to handle mouse drag events in Java event handling?
A. `handleDrag()`
B. `onMouseDrag()`
C. `mouseDragged()`
D. `dragEvent()`
22. What is the purpose of the `FocusEvent` class in Java event handling?
23. In Java event handling, which method is used to handle focus gained events?
A. `focusEvent()`
B. `onFocusGained()`
C. `focusGained()`
D. `handleFocus()`
24. What is the purpose of the `KeyEventDispatcher` interface in Java event handling?
A. It represents an exception
25. In Java event handling, what is the purpose of the `MouseWheelEvent` class?
B. It represents an exception
26. Which method is used to handle mouse wheel events in Java event handling?
A. `wheelEvent()`
B. `onMouseWheelMove()`
C. `handleMouseWheel()`
D. `mouseWheelMoved()`
27. In Java event handling, what is the purpose of the `WindowAdapter` class?
A. It represents an exception
B. It represents an event source
28. What is the purpose of the `InputEvent` class in Java event handling?
29. Which method is used to handle input events in Java event handling?
A. `processInput()`
B. `onInputEvent()`
C. `inputEvent()`
D. `handleInput()`
30. In Java event handling, what is the purpose of the `MouseListenerAdapter` class?
A. It represents an exception
A. WindowEvent
B. ComponentEvent
C. ItemEvent
D. InputEvent
33. Which of these methods can be used to know the degree of adjustment made by the user?
A. getValue()
B. getAdjustmentType()
C. getAdjustmentValue()
D. getAdjustmentAmount()
34. Which of these packages contains all the event handling interfaces?
A. java.lang
B. java.awt
C. java.awt.event
D. java.event
A. ComponentListener
B. ContainerListener
C. ActionListener
D. ItemListener
A. WindowEvent
B. ComponentEvent
C. ItemEvent
D. InputEvent
A. TEXT_CHANGED
B. TEXT_FORMAT_CHANGED
C. TEXT_VALUE_CHANGED
D. TEXT_SIZE_CHANGED
38. What is an event in delegation event model used by Java programming language?
C. An event is an object that describes any change by the user and system
A. COMPONENT_HIDDEN
B. COMPONENT_MOVED
C. COMPONENT_RESIZE
D. All of the mentioned
A. WINDOW_ACTIVATED
B. WINDOW_CLOSED
C. WINDOW_DEICONIFIED
41. 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
42. Which of these methods are used to register a mouse motion listener?
A. addMouse()
B. addMouseListener()
C. addMouseMotionListner()
D. eventMouseMotionListener()
A. TextEvent
B. MouseEvent
C. FocusEvent
D. WindowEvent
44. Which of these packages contains all the classes and methods required for even handling in Java?
A. java.applet
B. java.awt
C. java.event
D. java.awt.event
45. Which of these methods can be used to know which key is pressed?
A. getKey()
B. getModifier()
C. getActionKey()
D. getActionEvent()
A. ActionEvent
B. KeyEvent
C. WindowEvent
D. AdjustmentEvent
47. Which of these methods can be used to know the type of focus change?
A. typeFocus()
B. typeEventFocus()
C. isTemporary()
D. isPermanent()
A. keyPressed()
B. keyReleased()
C. keyTyped()
D. keyEntered()
49. Which of these methods can be used to determine the type of adjustment event?
A. getType()
B. getEventType()
C. getAdjustmentType()
D. getEventObjectType()
A. mouseDragged()
B. mousePressed()
C. mouseReleased()
D. mouseClicked()
A. ActionEvent
B. ComponentEvent
C. AdjustmentEvent
D. WindowEvent
52. MouseEvent is subclass of which of these classes?
A. ComponentEvent
B. ContainerEvent
C. ItemEvent
D. InputEvent
A. java.io
B. java.lang
C. java.net
D. java.util
A. ActionEvent
B. KeyEvent
C. WindowEvent
D. AdjustmentEvent
55. Which of these events is generated when the size of an event is changed?
A. ComponentEvent
B. ContainerEvent
C. FocusEvent
D. InputEvent
56. Which of these methods can be used to determine the type of event?
A. getID()
B. getSource()
C. getEvent()
D. getEventObject()
A. ChangePoint()
B. TranslatePoint()
C. ChangeCordinates()
D. TranslateCordinates()
58. Which of these events is generated when computer gains or loses input focus?
A. ComponentEvent
B. ContainerEvent
C. FocusEvent
D. InputEvent
A. getX()
B. getXCoordinate()
C. getCoordinateX()
D. getPointX()
60. Which of these interfaces handles the event when a component is added to a container?
A. ComponentListener
B. ContainerListener
C. FocusListener
D. InputListener
61. Which of these methods can be used to obtain the command name for invoking ActionEvent
object?
A. getCommand()
B. getActionCommand()
C. getActionEvent()
D. getActionEventCommand()
62. Which of these methods can be used to get reference to a component that was removed from a
container?
A. getComponent()
B. getchild()
C. getContainerComponent()
D. getComponentChild()
A. ALT_MASK
B. CTRL_MASK
C. SHIFT_MASK
B. ContainerListener
C. ActionListener
D. InputListener
A. ComponentEvent
B. ContainerEvent
C. ItemEvent
D. InputEvent
66. Which of these methods are used to register a keyboard event listener?
A. KeyListener()
B. addKistener()
C. addKeyListener()
D. eventKeyboardListener()
A. Applet
B. ComponentEvent
C. Event
D. InputEvent
68. Which of these events is generated when the component is added or removed?
A. ComponentEvent
B. ContainerEvent
C. FocusEvent
D. InputEvent
69. Which of these methods is used to obtain the object that generated a WindowEvent?
A. getMethod()
B. getWindow()
C. getWindowEvent()
D. getWindowObject()
A. ComponentListener
B. ContainerListener
C. ActionListener
D. InputListener
71. Which of these methods can be used to obtain the coordinates of a mouse?
A. getPoint()
B. getCoordinates()
C. getMouseXY()
D. getMouseCordinates()
72. Which of these methods can be used to obtain the reference to the container that generated a
ContainerEvent?
A. getContainer()
B. getContainerCommand()
C. getActionEvent()
D. getContainerEvent()
A. ActionEvent
B. ComponentEvent
C. AdjustmentEvent
D. WindowEvent
74. Which of these methods will respond when you click any button by mouse?
A. mouseClicked()
B. mouseEntered()
C. mousePressed()
A. EventObject
B. EventClass
C. ActionEvent
D. ItemEvent