Tutorial 3
1. How to remove the event listener?
a) Using removeListener( ) method.
b) Using removeTypeListener( ) method.
c) Using removeEvent( ) method.
d) It is not possible to remove the event listener
2. At the root of Java event hierarchy, which class is located?
a) AWTEvent
b) Event
c) EventObject
d) Events
3. Action event is generated when…
a) Label is dragged
b) Button is pressed
c) Mouse is dragged
d) Window is opened
4. How to obtain the command name for invoking ActionEvent?
a) Using getActionCommand( ) method.
b) Using getCommand( ) method.
c) Using getAction( ) method.
d) Using obtainAction( ) method.
5. TextEvent defines the integer constant…
a) TEXT_CHANGED
b) TEXT_VALUE_CHANGED
c) TEXT_ADDED
d) TEXT_VALUE_ADDED
6. An event is generated whe the internal state of the event source is________ 0
a. Not changed
b. Changed
c. Either changed or not
d. None of these
7. EventObject class belongs to:
a. java.util
b. java.awt
c. java.lang
d. java.sql
8. The ___________ interface handles choice events:
a. ContainerListener
b. ItemListener
c. ActionListener
d. WindowListener
9. The ___________ interface is used to handle checkbox events:
a. ContainerListener
b. ItemListener
c. ActionListener
d. WindowListener
10. The ___________ interface is used to handle button events:
a. ContainerListener
b. ItemListener
c. ActionListener
d. WindowListener
11. ItemListener is defined by the _____________ method:
a. itemChangedState()
b. itemStateChanged()
c. itemChanged()
d. itemState()
12. _____________ is a superclass of TextField and TextArea classes that is used to create
single-line or multiline textfields respectively:
a. TextBox
b. CheckBox
c. TextComponent
d. Choice
13. A label is a simple control which is used to display_____________ on the window:
a. Text(non-editable)
b. Text(editable)
c. Both a & b
d. None of these
14. The Delegation Event Model is based on the concept of _____________
a. Source
b. Listener
c. Both a & b
d. None of these
15. 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
16. _______ 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
17. KeyEvent is generated in following sequence…
a) Key typed, pressed, released
b) Key released, typed, pressed
c) Key pressed, typed, released
d) pressed, Key released, typed
18. Which method is not defined by MouseListener interface?
a) mouseDragged( )
b) mouseMoved( )
c) mouseEntered( )
d) mouseReleased( )
19. ……….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
20. method are used to register a keyboard event listener.
(a) KeyListener( )
(b) addKistener()
(c) addKeyListener()
(d) eventKeyboardListener()
21. _____ method are used to register a mouse motion listener.
(a) addMouseO
(b) addMouseListenerO
(c) addMouseMotionListnerO
(d) eventMouseMotionListenerO
22. if we close an applet's window generated. event will be
(a) ActionEvent
(b) ComponentEvent
(c) AdjustmentEvent
(d)WindowEvent
23. Which of these are integer constants defined in ActionEvent class?
(a) ALT_MASK
(b) CTRL_MASK
(c) SHIFT_MASK (d) All of the mentioned
24. What are the KeyListener Interface?
(a) keyPressed
(b) keyReleased
(c) keyTyped (d) All three
25. Which of these are constants defined in WindowEvent class?
a. WINDOW_ACTIVATED
b. WINDOW_CLOSED
c. WINDOW _DEICONIFIED
d. All of the mentioned
26. interface define a method actionPerformed().
(a) ComponentListener
(b) ContainerListener
(c) ActionListener
(d) InputListener
27. 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
28. methods will be invoked if a charaeter is entered.
(a) keyPressed()
(b) keyReleased()
(c) keyTyped()
(d) keyEntered()
29.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)