Chapter2QB
Chapter2QB
a) getKey( ) d) getActionEvent( )
b) getModifier( )
c) getActionKey( )
Answer: b
54.Which of these methods can be used to determine the type of adjustment
event?
a) getType( ) d) getEventObjectType( )
b) getEventType( )
c) getAdjustmentType( )
Answer: c
55.Which of these methods can be used to know the degree of adjustment made
by the user?
a) getValue( ) d) getAdjustmentAmount( )
b) getAdjustmentType( )
c) getAdjustmentValue( )
Answer: a
56.Which of these constant value will change when the button at the end of
scroll bar was clicked to increase its value?
a) BLOCK_DECREMENT d) UNIT_INCREMENT
b) BLOCK_INCREMENT
c) UNIT_DECREMENT
Answer: d
57.Which of these events is generated when the size position an event is
changed?
a) ComponentEvent d) InputEvent
b) ContainerEvent
c) FocusEvent
Answer: a
58.Which of these events is generated when the component is added or
removed?
a) ComponentEvent d) InputEvent
b) ContainerEvent
c) FocusEvent
Answer: b
59.Which of these methods can be used to obtain the reference to the container
that generated
a ContainerEvent? c) getActionEvent( )
a) getContainer( ) d) getContainerEvent )
b) getContainerCommand( )
Answer: d
60.Which of these methods can be used to get reference to a component that
was removed from a container?
a) getComponent( ) d) getComponentChild( )
b) getChild( )
c) getContainerComponent( )
Answer: b
61.Which of these are integer constants of ComponentEvent class?
a) COMPONENT_HIDDEN
b) COMPONENT_MOVED
c) COMPONENT_RESIZE
d) All of the mentioned
ANSWER: d
62.Which of these events is generated when computer gains or losses input
focus?
a) ComponentEvent c) FocusEvent
b) ContainerEvent d) InputEvent
Answer: c
63.FocusEvent is subclass of which of these classes?
a) ComponentEvent d) InputEvent
b) ContainerEvent
c) ItemEvent
Answer: a
64.Which of these methods can be used to know the type of focus change?
a) typeFocus( ) d) isPermanent( )
b) typeEventFocus( )
c) isTemporary( )
Answer: c
65.Which of these is superclass of ContainerEvent class?
a) WindowEvent d) InputEvent
b) ComponentEvent
c) ItemEvent
Answer: b
66.Which of these interfaces define a method actionPerformed( )?
a) ComponentListener d) InputListener
b) ContainerListener
c) ActionListener
Answer: c
67.Which of these interfaces define four methods?
a) ComponentListener d) InputListener
b) ContainerListener
c) ActionListener
Answer: a
68.Which of these methods can be used to obtain the coordinates of a mouse?
a) getPoint( ) d) getMouseCordinates( )
b) getCoordinates( )
c) getMouseXY( )
Answer: a
69.Which of these methods can be used to change location of an event?
a) ChangePoint( ) d) TranslateCordinates( )
b) TranslatePoint( )
c) ChangeCordinates( )
Answer: b
70.Which of these are integer constants of TextEvent class?
a) TEXT_CHANGED
b) TEXT_FORMAT_CHANGED
c) TEXT_VALUE_CHANGED
d) TEXT_sIZE_CHANGED
Answer: b
71.Which of these methods is used to obtain the object that generated a
WindowEvent?
a) getMethod() d) getWindowObject()
b) getWindow()
c) getWindowEvent()
Answer: b
72.Which of these methods is used to get x coordinate of the mouse?
a) getX() d) getPointX()
b) getXCoordinate()
c) getCoordinateX()
Answer: b
73.Which of these is superclass of WindowEvent class?
a) WindowEvent d) InputEvent
b) ComponentEvent
c) ItemEvent
Answer: b
74.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 oits own events.
d) A component may handle its own events only if it implements the
handleEvent( ) method.
Answer: a and b.
75.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.
Answer: c.
a) ComponentEvent c) FocusEvent
b) ContainerEvent d) InputEvent
Answer: a
a) TextEvent c) FocusEvent
b) MouseEvent d) WindowEvent
Answer: d
83.Which of these methods can be used to obtain the coordinates of a mouse?
a) getPoint()
b) getCoordinates()
c) getMouseXY()
d) getMouseCordinates()
Answer: a
84.MouseEvent is subclass of which of these classes?
a) ComponentEvent c) ItemEvent
b) ContainerEvent d) InputEvent
Answer: d
85.Which of these packages contains all the event handling interfaces?
a) java.lang c) java.awt.event
b) java.awt d) java.event
Answer: c
86.Which of these interfaces handles the event when a component is added to a
container?
a) ComponentListener c) FocusListener
b) ContainerListener d) InputListener
Answer: b
87.The Following steps are required to perform
1) Implement the Listener interface and overrides its methods
2) Register the component with the Listener
A) Exception Handling
B) String Handling
C) Event Handling
D) None of the above
Answer: C) Event Handling
88.In which places can put the event handling code
A) JButton
B) JCheckbox
C) JMenuItem
D) All of these
Answer: D) All of these
91. Implement the Listener interface and overrides its methods is required to
perform in event handling?
A) TrueB) False
Answer: A) True
95. Which of these methods can be used to obtain the command name for invoking
ActionEvent object?
a) getCommand()
b) getActionCommand()
c) getActionEvent()
d) getActionEventCommand()
Answer: b