Saturday, May 25, 2019

Chapter-2 (MCQ:1-100)



Chapter:2
Event Handling
Applets are event-driven programs. Thus, event handling is at the core of
successful applet programming. Most events to which our applet will respond
are generated by the user. These events are passed to our applet in a variety ofways, with the specific method depending upon the actual event. There are
several types of events. The most commonly handled events are those
generated by the mouse, the keyboard, and various controls, such as a push
button. Events are supported by the java.awt.event package.


1 ----------------------Is super class of all the events = EventObject

2. Which of these packages contains all the classes and methods required for even handling in
Java?= java.awt.event

3 2. Which of these events is generated when the a window is closed? = WindowEvent

4 3 ________method are used to register a keyboard event listener = addKeyListener()

5 3. Which of these methods can be used to know the degree of adjustment made by the user? = getValue()

6 A MenuItem object can generate __________ events. = ActionEvent

7 A source generates an event and sends it to ___________ listeners that can handle the event=1 One or more

8 A ________________ is an object that is notified when an event occurs=Listener

9A ________________________ is generated when a component is added to or removed from a
container.= ContainerEvent

10 ActionEvent Class is used for Which Controll ?= Button , List ,MenuItem

11 Adapter class belongs to the package = java.awt.event

12 Adapter Class provides_____________________________ =Empty implementation of all methods of a listener

13 An event is generated when the internal state of the event source is ___________.= Changed

14 An object that would like to be notified of and respond to an event is = EventListener

15At the root of the Java event class hierarchy is ___________which is the superclass for all
events.= EventObject

16 Change in the state of an object is known as __________ = Event

17 CheckBox implements following Listener Interface = ItemListener

18 ComponenetEvent is the superclass of _______________. = All of the above

19 Event class is defined in which of these libraries? = java.awt.event

20 Event Listeners are____________________________________ = Interfaces

21 EventObject class present in__________package. = java.util

22 EventObject contains two important methods:________ and___________ = getSource() and toString()

23 Events are supported by the _____________ = java.awt.event

24 Focus events are fired whenever a component _____________________the focus = gains or loses

25 FocusEvent is subclass of which of these calsses ? = ComponenEvent

26Generated when a window is activated, de-activated, closed, de-activated,de-iconified, iconified,
opened or quit= WindowEvent

27 getID() method is provided by __________ class. = AWTEvent

28 getKeyChar( ) and getkeyCode( ) methods belongs to which event class? = KeyEvent

29 getSource() is method of which class = EventObject

30 How many types of component events are in Java? = 4

31 How to obtain the command name for invoking ActionEvent? = Using getActionCommand( ) method.

32 How to remove the event listener? = Using removeTypeListener( ) method.

33 If a class extends the ActionListener interface, it must contain a method called. __________. = actionPerformed()

34 If scroll bar is manipulated………….. event will be notified. = AdjustmentEvent

35 If we close an applet’s window _________ event will be generated. = WindowEvent

36 If _____________is manipulated AdjustmentEvent event will be notified . = ScrollBar

37 In EventObject, which method is used to determine the type of event? = getSource()

38 In java an event is an _________ which specifies the change of state in the source. = Object

39 In Java, events are all the activities that occur between = A and B

40 In which package class AWTEvent defined = java.awt package;

41 In which package the methods for receiving and processing events are defined = java.awt.event

42 In which places can put the event handling code = All mentioned above

43 Interface used to handle menu events is = ActionListner

44 ItemListener event defines this method… = itemStateChanged()

45 KeyEvent is a subclass of ________ = InputEvent

46 KeyListener interface has got _______________methods = 3

47 mouseDragged() method present in which listener = MouseMotionListener

48 MouseEvent is subclass of which of these classes? = InputEvent

49 Name the event that gets generated when a button is clicked. = ActionEvent

50Name the method defined in EventObject class that returns the Object generated from the
event.select the one correct answer.= getSource()

51 On which awt component event listener can not be aplied = Label

52 public void mouseMoved(MouseEvent me) is method of _______________ = MouseMotionListener

53 Scrollbar control generates ……………………………. Event. = AdjustmentEvent

54 Select the proper constructor of EventObject class = EventObject(Object src)

55 Some of the event listener interfaces are_____________ = All of these

56 Source object can register only one listener = False

57 Text changed ( ) method is used for______. = when there is changes in text occurs

58 TextEvent defines the following integer constatnt: = TEXT_VALUE_CHANGED

59 TextField generates which events = ActionEvent,TextEvent

60 The constructor which the Text Event class defines. = TextEvent(Object source, int event_type)

61 The default layout of the contentPane of a JApplet is __________. = BorderLayout

 62 The delegation Event model is based on the concept of = Both A and B

63 The delegation model is used as a standard for = Event Listeneing

64 The Following are event classes = Action Event,FocusEvent ,Container Event

65 The Following are method of mouse event class = getClickCount ( )

66 The following method is an abstract method of TextListener interface. = textChanged(TextEvent obj)

67 The following method must be overriden in order to handle KeyEvent. = All of the mentioned

68 The method in the ActionEvent ________ returns the action command of the button = getActionCommand()

69 The method that is used for registering keyboard event is knows as ____________________. = addKeyListener ()

70 The MouseEvent class does not defines the _____________integer constant. = MOUSE_WHEELMOVE

71 The MouseListener interface is used to make mouse handling = True


72 The MouseListener's _______________ method is called after mouse button is released = public void mouseClicked(MouseEvent e)

73 The MouseMotionListener Interface has __________________ method. = void mouseDragged(MouseEvent me)

74 The signature for the registration method for an ActionEvent should be = public void addActionListener(ActionListener l)

75 The superclass of ContainerEvent, FocusEvent and WindowEvent is _______________ . = ComponentEvent

76 The ________ interface is used to handle button events: = ActionListener r

78 The __________________interface handles choice events. = ItemListener

79 Till now two models have been introduced in java for: = Receiving and pro
cessing events

80 To write event driven programs using AWT or Swings, Use? = Option A and B

81 What is a listener in context to event handling? = A listener is a object that is notified when an event occurs.

82 What is a listener in the context to event handling? = A listener is an object that notified when event had occurred.

83 What is an event in Delegation Event model ? = An event is an object that describes a state change in a source.

84 What is event handling? = Controling Event

85 What is use of MouseMotion Listener Interface? = mouseDragged()

86 What kind of event is fired when the user selects an item from a menu? = an ActionEvent

87 When a component obtains keyboard focus, which method is invoked? = void focusGained(FocusEvent fe)

88 When component is added or a removed from container,…………… generated? = ContainerEvent

89 When key is pressed which event is occurred = Both A and B


90 When list item is double clicked, which event is generated? = ActionEvent

91 When the size of component is changed ,----------------------- event is generated = ComponentEvent

92When two or more objects are added as listeners for the same event, which listener is first
invoked to handle the event?
= There is no way to determine which listener will be invoked first.
93 when we need to use check boxes or item from the list or use a checkable menu,an
_________________is generated.
= ItemEvent
94 Which of the following are true =The event - inheritance model is more efficient than the event -
delegation model.

95 Which among the following is not an AWT Event = AdjustEvent

96 Which among the following is true for Adaptor Classes? = Adaptor classes reduce Complexity of event Listener.

97 Which are various methods of WindowListener interface from following? = All above

98 Which are WindowEvent class defines integer constants ? = All The Above

99 Which class is at the root in Java event class hierarchy? = EventObject

1 comment:

java program (Tree)