Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Sanjivani Rural Education Society’s

SANJIVANI K. B. P. POLYTECHNIC
Department of Computer Technology
KOPARGAON – 423601, DIST: AHMEDNAGAR
2023-2024
/64
Sub : AJP (22517) Pratice Test: [Unit III – Event Handling] Date : / /2023
Name : Course Code : CM-5-I
Roll No : Set : II

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

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

3. EventObject class belongs to:


a. java.util b. java.awt c. java.lang d. java.sql

4. The ___________ interface handles list events:


a. ContainerListener b. FocusListener c. ActionListener d. ItemListener

5. The ___________ interface handles choice events:


a. ContainerListener b. ItemListener c. ActionListener d. WindowListener

6. The ___________ interface is used to handle checkbox events:


a. ContainerListener b. ItemListener c. ActionListener d. WindowListener

7. The ___________ interface is used to handle button events:


a. ContainerListener b. ItemListener c. ActionListener d. WindowListener

8. A push button is an active control that has a _____________ appearance


a. One dimensional b. Two dimensional c. Three dimensional d. None of these

9. ItemListener is defined by the _____________ method:


a. itemChangedState() b. itemStateChanged() c. itemChanged() d. itemState()

10. _____________ 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

11. 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 s d. None of these

12. The Delegation Event Model defines a ______________ approach to handle events:
a. Logical b. Physical c. Both a & b d. None of these

13.Which of the following event is called when the user presses the mouse button?
a)onMouseMove b)onMouseOut c)onMouseDown d)onMouseOver

14. Which of these interfaces define four methods?


a)ComponentListener b)ContainerListener c)ActionListener d)InputListener
15.Which of these methods will be invoked if a character is entered?
a)keyPressed() b)keyReleased() c)keyTyped() d)keyEntered()

16.Which of these interfaces define a method itemStateChanged()?


a)ComponentListener b)ContainerListener c)ActionListener d)ItemListener

17.Which of these methods is used to get x coordinate of the mouse?


a)getX() b)getXCoordinate() c)getCoordinateX() d)getPointX()

18.Which of these methods is used to obtain the object that generated a WindowEvent?
a)getMethod() b)getWindow() c)getWindowEvent() d)getWindowObject()

19. Which of these are integer constants of TextEvent class?


a)TEXT_CHANGED b)TEXT_FORMAT_CHANGED c)TEXT_VALUE_CHANGED d)TEXT_SIZE_CHANGED

20.Which of these methods can be used to change location of an event?


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

21.Which of these methods can be used to know the type of focus change?
a)typeFocus() b)typeEventFocus() c)isTemporary() d)isPermanent()

22.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()

23.Which of these methods can be used to change location of an event?


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

24.Which of these are integer constants of TextEvent class?


a.TEXT_CHANGED b.TEXT_FORMAT_CHANGED c.TEXT_VALUE_CHANGED d.TEXT_sIZE_CHANGED

25.Which of these methods is used to obtain the object that generated a WindowEvent?
a.getMethod() b.getWindow() c.getWindowEvent() d.getWindowObject()

26.MouseEvent is subclass of which of these classes?


a.ComponentEvent b.ContainerEvent c.ItemEvent d.InputEvent

27.Which of these is a superclass of all Adapter classes?


a.Applet b.ComponentEvent c.Event d.Input Event

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


a.ALT_MASK b.CTRL_MASK c.SHIFT_MASK d.All of the mentioned

29.Which of these methods can be used to obtain the coordinates of a mouse?


a.getPoint() b.getCoordinates() c.getMouseXY() d.getMouseCordinates()

30.Which of these methods can be used to know the type of focus change?
a.typeFocus() b.typeEventFocus() c.isTemporary() d.isPermanent()

31.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()

32.FocusEvent is subclass of which of these classes?


a.ComponentEvent b.ContainerEvent c.ItemEvent d.InputEvent
33.What interface should a class implement to respond to button clicks in Java Swing?
a) ActionListener b) MouseListener c) KeyListener d) WindowListener

34.Which method is invoked when an ActionListener detects a button click?


a) actionPerformed() b) mouseClicked() c) keyTyped() d) windowClosing()

35. What is the purpose of the MouseListener interface in Java Swing?


a) Handling keyboard events b) Handling mouse events c) Handling window event d) Handling file I/O events

36.Which of the following methods is part of the MouseListener interface in Java?


a) keyPressed() b) mouseClicked() c) actionPerformed() d) windowOpened()

37. How many mouse buttons are typically supported by the MouseListener interface?
a) 1 b) 2 c) 3 d) 4

38. What is the primary purpose of the MouseAdapter class in Java Swing?
a) To handle keyboard events
b) To handle window events
c) To provide default implementations of the MouseListener interface
d) To provide default implementations of the ActionListener interface

39. Which event is typically generated when the mouse pointer enters a component?
a) mouseClicked b) mouseEntered c) mousePressed d) mouseExited

40. Which listener interface should you use to respond to mouse drag events in Java Swing?
a) MouseAdapter b) MouseMotionListener c) ActionListener d) KeyListener

41. In Java Swing, what is the primary purpose of the actionPerformed() method?
a) Handling keyboard input
b) Handling mouse clicks
c) Handling button clicks and other action even
d) Handling window resizing

42. Which method is used to register anActionListener with a JButton in Java Swing?
a) addButtonListener() b) addActionEvent() c) addActionListener() d) addListenerToButton()

43. Which method returns the item where the event occurred ?
a. getItemSelectable() b. getItem() c. getStateChange() d. none of these

44. Which method returns the state change type which generated the event ?
a. getItemSelectable() b. getItem() c. getStateChange() d. none of these

45. In item event class which constant marks the last integer id for the range of item ?
a. LAST_Item b. Last_Item c. ITEM_LAST d. Item_last

46. Which method returns the item selectable object where this event originated ?
a. getItemSelectable() b. getItem() c. getStateChange() d. none of these

47. An event is generated when the internal state of the event source is ___________.
a. detected b. origin c. changed d. none of these

48. EventObject contains two important methods:________ and___________


a. getSource() b. toString() c. both a & b d. none of these
49. Focus events are fired whenever a component _____________the focus
a. gains b. loses c. both a & b d. none of these

50. Which class is used for this Processing Method processActionEvent( )?


a. Button b. List c. MenuItem d. All of these

51. Which Method Is used to register a mouse Motion Listner


a. addMouseMotionListener() b. addMouseListener c. both a & b d. none of these

52. Which of these not a constants defined in ComponentEvent class?


a. COMPONENT_HIDDEN b. COMPONENT_VISIBLE c. COMPONENT_SIZED d. All of these

53. Which of these methods is defined in MouseMotionAdapter class.


(a) mouseDragged() (b) mousePressed() (c) mouseReleased() (d)mouseClicked()

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

55. In Java, events are all the activities that occur between:
(a)The user (b) The application (c) Both (a) and (b) (d) None of the above

56. The constructor that is defined by the Text Event class is:
a. TextEvenet(Object source, int id ) b. textevent (Object source, int event_type )
c. textevent (object Source, float event_type) d. textevent (Object source, string event_type)

57. An event is generated when the internal state of the event source is
(a) Not changed (b) Changed (c) Either changed or not (d) None of these

58. When two or more objects are added as listeners for the same event, which listener is first
invoked to handle the event?
(a) The first object that was added as listener.
b) The last object that was added as listener.
(c) There is no way to determine which listener will be invoked first.
(d) It is impossible to have more than one listener for a given event.

59. Which interfaces define a method itemStateChanged().


(a)ComponentListner (b)ContainerListener (c)ActionListener (d)ItemListener

60._______ 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

61. ItemListener event defines this method...


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

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

63. The Delegation Event Model is based on the concept of _____________


a. Source b. Listener c. Both a & b d. None of these

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

You might also like