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

AJP Assignment No-3

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)
25 views

AJP Assignment No-3

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/ 7

Assignment No.

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. When slider of scrollbar was dragged, which event is generated?


a) TRACK
b) DRAGGED
c) DRAG
d) SCROLLBAR_MOVED

6. FocusEvent is subclass of …
a) ContainerEvent
b) ComponentEvent
c) ItemEvent
d) KeyEvent

7. When the InputEvent is not generated?


a) Key is entered through keyboard
b) Mouse is dragged
c) Mouse wheel is moved
d) None of the above

8. TextEvent defines the integer constant…


a) TEXT_CHANGED
b) TEXT_VALUE_CHANGED
c) TEXT_ADDED
d) TEXT_VALUE_ADDED

9. Which of the following is not event source?


a) MenuItem
b) CheckboxGroup
c) Window

10. 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
11. 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
12. EventObject class belongs to:
a. java.util
b. java.awt
c. java.lang
d. java.sql
13. The interface handles list events:
a. ContainerListener
b. FocusListener
c. ActionListener
d. ItemListener
14. The interface handles choice events:
a. ContainerListener
b. ItemListener
c. ActionListener
d. WindowListener
15. The interface is used to handle checkbox events:
a. ContainerListener
b. ItemListener
c. ActionListener
d. WindowListener
16. The interface is used to handle button events:
a. ContainerListener
b. ItemListener
c. ActionListener
d. WindowListener
17. A push button is an active control that has a appearance
a. One dimensional
b. Two dimensional
c. Three dimensional
d. None of these
18. ItemListener is defined by the method:
a. itemChangedState()
b. itemStateChanged()
c. itemChanged()
d. itemState()
19. 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
20. 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
21. The Delegation Event Model defines a approach to handle events:
a. Logical
b. Physical
c. Both a & b
d. None of these
22. The Delegation Event Model is based on the concept of
a. Source
b. Listener
c. Both a & b
d. None of these
23. 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
24. 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

25. 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

26. ItemListener event defines this method…


a) itemEventChanged( )
b) itemEventOcurred( )
c) itemValueChanged( )
d) itemStateChanged( )

27. KeyEvent is generated in following sequence…


a) Key typed, pressed, released
b) Key released, typed, pressed
c) Key pressed, typed, released
d) Key pressed, released, typed

28. Which method is not defined by MouseListener interface?


a) mouseDragged( )
b) mouseReleased(
mouseMoved( ) )
c) mouseEntered( )
d) mouseReleased(
none of this )

29. What is anonymous inner class?


a) An anonymous inner class is one that is not assigned a name.
b) An anonymous inner class is one that is not used for creating the objects
c) An anonymous inner class is one for which we can not create the object.
d) An anonymous inner class is one that which is declared but not used anywhere in the
program.

30. 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

31. What is an event is delegation event model used by Java programming


Language?
a) An event is an object that describes a state change in a source.
b) An event is an object that describes a state change in a processing.
c) An event is an object that describes any change by the user and
System
d) An event is a class used for defining object, to create events.

34. method are used to register a keyboard event listener.


(a) KeyListener( )
(b) addKistener()
(c) addKeyListener()
(d) eventKeyboardListener()

35. _ method are used to register a mouse motion listener.


(a) addMouseO
(b) addMouseListenerO
(c) addMouseMotionListnerO
(d) eventMouseMotionListenerO

36. What is a listener in context to event handling?


(a) A listener is a variable that is notified when an event occurs.
(b) A listener is a '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

37. In which library event class is defined ?


(a) java.io (b) java.util
(c) java.lang (d) java.net

38. Which of these methods can be used to determine the type of event ?
(a) getSoureeO (b) getEventO
(c) getIDO (d) getEventObjeetO

39 is super class of all the events.


(a) EventObjeet (b) EventClass
(c) AetionEvent (d) ItemEvent

40. If scroll bar is manipulated event will be notified.


(a) AetionEvent (b) ComponentEvent
(c) AdjustmentEvent (d) WindowEvent

41. if we close an applet's window generated. event will be


(a) ActionEvent (b) ComponentEvent
(c) AdjustmentEvent (d)WindowEvent

42. Which of these events is generated when a button is pressed?


(a) ActionEvent (b) KeyEvent
(c) Window Event (d) AdjustmentEvent

43. method can be used to obtain the command namefor invoking


ActionEvent object.
(a) getCommand() (b) getActionCommand()
(b) getActionEvent() (d) getActionEventCommand()

44. Which of these are integer constants defined in ActionEvent class?


(a) ALT_MASK (b) CTRL_MASK
(c) SHIFT_MASK (d) All ofthe mentioned
45. Which of these methods can be used to determine type of Event
(a)getID() (b)getSource()
(c ) getEvent() (d) getEventObject()

46. method can be used to determine the type of adjustment event.


(a) getType() (b) getEventType()
(c) getAdjustmentType() (d) getEventObjectType()

47. method can be used to know the degree of adjustment made by the user.
(a) getValue() (b) getAdjustmentType()
(c) getAdjustmentValue() (d) getAdjustmentAmount()

48. What are the KeyListener Interface?


(a) keyPressed (b) keyReleased
(c) keyTyped (d) All three.

49.When the size of component is changed, event is generated.


(a) ComponentEvent (b) ContainerEvent
(c) FocusEvent (d) InputEvent

50. When the component is added or removed ? Which of these events is generated
?
(a) ComponentEvent (b) ContainerEvent
c) FocusEvent (d) InputEvent

51. method can be used to obtain the reference to the container that
generated a ContainerEvent.
(a) getContainerO (b) getContainerCommandO
(c) getActionEventO (d) getContainerEventO
52. Which is the constant used for always providing the vertical scrollbar
(a) VERTICAL_SCROLLBAR_ALWAYS
(b)VERTICAL _SCROLLBAR_AS_NEEDED

53. Which is the method used for WindowsClosing Event?


(a)windowOpened() (b)windowClosed()
(c ) windowClosing() (d) windowDeactivated()

54. event is generated when computer gains or losses input focus.


(a) ComponentEvent (b) ContainerEvent
(c) FocusEvent (d) InputEvent

55.FocusEvent is subclass of which of these classes?


(a) ComponentEvent (b) ContainerEvent
(c) ItemEvent (d) InputEvent

56. can be used to know the type of focus change.


(a) typeFocus() (b) typeEventFocus()
(c) isTemporary() (d) isPermanent()

57. is superclass of Container Event class.


(a) WindowEvent (b) ComponentEvent
(c) ItemEvent (d) InputEvent

58. Which of the following method can be used to obtain the coordinates of a mouse?
(a) getPoint() (b) getCoordinates()
(c) getMouseXY() (d) getMouseCordinates()

59. method can be used to change location of an event.


(a) ChangePoint() (b) TranslatePoint()
(c) ChangeCordinates() (d) TranslateCordinates()

60. Which of the following is integer constants of TextEvent class?


a. TEXT_CHANGED
b. TEXT_FORMAT_CHANGED
c. TEXT_ VALUE_CHANGED
d. TEXT_SIZE_CHANGED

You might also like