Unit 3
Unit 3
Presented By :
Varad Rajesh Walke
Q1.Which of these packages 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
Q2.Which of these methods is used to
register a keyboard event listener?
a) KeyListener()
b) addListener()
c) addKeyListener()
d) eventKeyboardListener()
Q3.Which of these methods is used to
register a mouse motion listener?
a) addMouse()
b) addMouseListener()
c) addMouseMotionListener()
d) eventMouseMotionListener()
Q4.What is a listener in the context of
event handling?
a) EventObject
b) EventClass
c) ActionEvent
d) ItemEvent
Q6.Which interface defines the
method actionPerformed()?
a) ComponentListener
b) ContainerListener
c) ActionListener
d) InputListener
Q7.Which method will respond
when you click any button with the
mouse?
a) mouseClicked()
b) mouseEntered()
c) mousePressed()
d) All of the mentioned
Q. 8 In Graphics class Which method is
used to set the graphics current color to
the specified color?
(a) getType( )
(b) getEventType( )
(c) getAdjustmentType( )
(d) getEventObjectType( )
Q. 10 TextField generates event.
(a) ActionEvent,ItemEvent
(b) ActionEvent, TextEvent
(c) ScrollEvent,TextEvent
(d) ActionEvent, ScrollEvent
Q. 11 void keyTyped(KeyEvent ke)
called when a key on the keyboard
is .
(a) KeyEvent
(b) MouseEvent
(c) ItemEvent
(d) AdjustmentEvent
Q. 13 The signature for the registration method for a
ActionEvent should be .
(a) Window
(b) RadioButton
(c) ScrollBar
(d) None
Q. 15 method is used to register a
keyboard event listener.
(a) KeyListener( )
(b) addKeyListener( )
(c) addKeyListenerEvent( )
(d) eventKeyboardListener( )
Q. 16 Name the method defined in
EventObject class that returns the
object generated from the event.
(a) getEvent( )
(b) getObject( )
(c) getId( )
(d) getSource( )
Q. 17 The MouseListener interface is
used to make mouse handling.
(a) True
(b) False
Q. 18 ActionEvent is applied on
(a) Frame
(b) Checkbox, Choice, List
(c) Scrollbar
(d) Button, TextField, List, Menu
Q. 19 ComponentEvent is the
super class of .
(a) FocusEvent
(b) MouseEvent
(c) WindowEvent
(d) All of the above
Q. 20 If we close an applet window
events will be generated.
(a) ActionEvent
(b) ComponentEvent
(c) AdjustmentEvent
(d) WindowEvent
Answers :
1. d 6. c 11. a 16. d
2. c 7. a 12. d 17. a
3. c 8. b 13. d 18. d
4. b 9. c 14. d 19. d
5. a 10. b 15. b 20. d