0% found this document useful (0 votes)
13 views

Unit 3

Uploaded by

walkevarad66
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Unit 3

Uploaded by

walkevarad66
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Advance Java Programming

Unit 3 : Event Handling

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) A listener is a variable that is notified


when an event occurs
b) A listener is an object that is notified
when an event occurs
c) A listener is a method that is notified
when an event occurs
d) None of the mentioned
Q5.Which class serves as the superclass
of all the events in Java?

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) public abstract void setFont(Font font)


(b) public abstract void setColor(Color c)
(c) public abstract void drawString(String
str, int x, int y)
(d) None of the above
Q. 9 Which of the following method is
used to determine the type of
adjustment event?

(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) pressed and then released.


(b) pressed
(c) released
(d) none of the above
Q. 12 Which event is generated
when the position of scrollbar is
changed?

(a) KeyEvent
(b) MouseEvent
(c) ItemEvent
(d) AdjustmentEvent
Q. 13 The signature for the registration method for a
ActionEvent should be .

(a) public void addActionListener(ActionEvent L)


(b) public void setAction(ActionListener L)
(c) public void setActionListener(ActionListener L)
(d) public void addActionListener(ActionListener L)
Q. 14 Which of the following
component generates ActionEvent?

(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

You might also like