Page 1 :
Question Bank, Chapter No. 03, , : Advanced Java Programming (22517) Class, , : TYCM, , : Event Handling, , 1., , Which statement is false?, a) An event is an object that describes a state change in a source., b) An event can be generated as a consequence of a person interacting with the elements in a, graphical user interface., c) An event can be disabled by Java Runtime Environment., d) Entering a character via the keyboard generates an event., , 2., , 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., , 3., , At the root of Java event hierarchy, which class is located?, a), b), c), d), , AWTEvent, Event, EventObject, Events, , 4., , Action event is generated when…, a) Label is dragged, b) Button is pressed, c) Mouse is dragged, d) Window is opened, , 5., , 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., , 6., , When slider of scrollbar was dragged, which event is generated?, a) TRACK, b) DRAGGED, c) DRAG, d) SCROLLBAR_MOVED, , 7., , FocusEvent is subclass of …, a) ContainerEvent, b) ComponentEvent, c) ItemEvent
Page 2 :
d) KeyEvent, 8., , 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, , 9., , TextEvent defines the integer constant…, a) TEXT_CHANGED, b) TEXT_VALUE_CHANGED, c) TEXT_ADDED, d) TEXT_VALUE_ADDED, , 10. Which of the following is not event source?, a) MenuItem, b) CheckboxGroup, c) Window, 11. 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, 12. 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, 13. EventObject class belongs to:, a. java.util, b. java.awt, c. java.lang, d. java.sql, 14. The ___________ interface handles list events:, a. ContainerListener, b. FocusListener, c. ActionListener, d. ItemListener, 15. The ___________ interface handles choice events:, a. ContainerListener, b. ItemListener, c. ActionListener, d. WindowListener, 16. The ___________ interface is used to handle checkbox events:, a. ContainerListener, b. ItemListener
Page 3 :
17., , 18., , 19., , 20., , 21., , 22., , 23., , 24., , 25., , c. ActionListener, d. WindowListener, The ___________ interface is used to handle button events:, a. ContainerListener, b. ItemListener, c. ActionListener, d. WindowListener, A push button is an active control that has a _____________ appearance, a. One dimensional, b. Two dimensional, c. Three dimensional, d. None of these, ItemListener is defined by the _____________ method:, a. itemChangedState(), b. itemStateChanged(), c. itemChanged(), d. itemState(), _____________ 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, 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, The Delegation Event Model defines a ______________ approach to handle events:, a. Logical, b. Physical, c. Both a & b, d. None of these, The Delegation Event Model is based on the concept of _____________, a. Source, b. Listener, c. Both a & b, d. None of these, 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, 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
Page 4 :
c. Both a & b, d. None of these, , 26. _______ 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, 27. ItemListener event defines this method…, a) itemEventChanged( ), b) itemEventOcurred( ), c) itemValueChanged( ), d) itemStateChanged( ), 28. 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, 29. Which method is not defined by MouseListener interface?, a) mouseDragged( ), b) mouseMoved( ), c) mouseEntered( ), d) mouseReleased( ), 30. 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., 31., , 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, , 32. 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.
Page 5 :
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., (a) ActionEvent (b) ComponentEvent, (c) AdjustmentEvent (d)WindowEvent, , event will be, , 42. Which of these events is generated when a button is pressed?
Page 9 :
72., methods will be invoked if a charaeter is entered., (a) keyPressed(), (b) keyReleased(), (c) keyTyped(), (d) keyEntered(), 73., , methods is defined in MouseMotionAdapter class., (a) mouseDragged(), (b) mousePressed(), (c) mouseReleased(), (d)mouseClicked(), 74. Which method is used to have rollover icon?, (a)setDisabledIcon(), (b)setDisabled(), (c) setRollover(), (d)setRolloverIcon(), 75. ___, is the superclass of all Adapter classes., (a) Applet, (b) ComponentEvent, (c) Event, (d) InputEvent, 76. 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, 77. EventObject class belongs to:, (a) java.util, (b) java.awt, (c) java.lang (d) java.sql, 78. The Component class is an abstract class and so its are used to create components., (a) Subclasses, (b)Superclasses, (c)Both (a) and (b), (d)None of these., 79. The AWT classes can be roughly categorized into the following groups:, a. GUI component, b. Layouts, c. Graphics tools, d. All of these, 80. Window is used for windows., a) Creating, b) Handling, c) Modifying, d) Both (a) and (b)
Page 10 :
81. The interface is used to handle the menu events., a., ContainerListener, b., FocusListener, c., ActionListener, d., WindowListner, 82. The constructor that is defined by the Text Event class is:, a., b., c., d., , TextEvenet(Object source, int event_type ), textevent (Object source, int event_type ), textevent (object Source, float event_type), textevent (Object source, string event_type), , 83. The name of the event classes are:, a., b., c., d., , ActionEvent, ComponentEvent, ContainerEvent, FocusEvent, ItemEvevt, KeyEvent, All of these, , 84. Java packages such as, a., b., c., d., , support the Event handling mechanism., , Java.util, Java.awt, Java.awt.event, All of these, , 85. 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., 86. The, interface handles list events:, (a) ContainerListener, (b) ItemListener, (c) FocusListener, (d) ActionListener, 87. Which of the following are true?, a. The event-inheritance model has replaced the event- delegation model., b. The event-inheritance model is more efficient than the event-delegation model., c. The Event Delegation Model uses event listeners to define the methods of event Handling, classes, d. The event delegation model uses handleEvent() method to support event handling., , 88. Which of the following is the highest class in the event- delegation model ?, a., b., c., d., , java.util.EventListener, java.util.EventObject, java.awt.A WTEvent, java.awt.event.A WTEvent, , 89. 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.
Page 11 :
90. Which ofthe following are true?, a. A TextField object may generate an ActionEvent., b. A Button object may generate an ActionEvent., c. A MenuItem object may generate an ActionEvent., d. All of above, 91. Which of the following are true?, a., b., c., d., , The MouseListener interface defines methods for handling mouse clicks., The MouseMotionListener interface defines methods for handling mouse clicks., The ActionListener interface defines methods for handling the clicking of a button., Option (a) and (c), , 92. Suppose that you want to have an object "eh" to handle the TextEvent of a TextArea object., How should you add eh as the event handler to it?, a), b), c), d), , t.addTextListener(eh);, eh.addTextListener(t);, addTextListener(eh.t);, addTextListener(t,eh);, , 93. What is the preferred way to handle an object's events in Java 2?, a. Override the object's handleEvent( ) method., b. Add one or more event listeners to handle the events., c. Have the object override its processEvent() methods, d. Have the object override its dispatchEvent() methods., , 94. Which of the following are true?, (a) A component may handle its own events by adding itself as an event listener., (b)A component may handle its own events by overriding its event-dispatching method., (c) A component may not handle its own events., (d)Option (a) and (b), 95. The event delegation model, introduced in release 1.1 ofthe JDK, is fully compatible with the event model., , (a) True, 96., , (b) False, , A component subclass that has executed enableEvents() to enable processing of a certain kind of, event cannot also use an adapter as a listener for the same kind of event., (a) True (b) False