Event Handling in PHP , Java , ASP .Net , C# or C sharp eventhandlers
Event Handling interview questions and answer in php asp .net , java, c# or c sharp for freshers and experienced with eventhandler
Event Handling Interview Questions and Answers are given below
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.
True
False Answers : b.
What is the highest-level event class of the event-delegation model? Answers : The java.util.eventObject class is the highest-level class in the
event-delegation hierarchy.
What interface is extended by AWT event listeners? Answers : All AWT event listeners extend the java.util.EventListener interface.
What class is the top of the AWT event hierarchy? Answers : The java.awt.AWTEvent class is the highest-level class in the AWT
event class hierarchy.
What event results from the clicking of a button? Answers : The ActionEvent event is generated as the result of the clicking of a
button.
What is the relationship between an event-listener interface and an
event-adapter class? Answers : An event-listener interface defines the methods that must be
implemented by an event
handler for a particular kind of event.
An event adapter provides a default implementation of an event-listener
interface.
In which package are most of the AWT events that support the event-delegation
model defined? Answers : Most of the AWTrelated events of the event-delegation model are
defined in the
java.awt.event package. The AWTEvent class is defined in the java.awt
package.
What is the advantage of the event-delegation model over the earlier event-inheritance
model? Answers : The event-delegation has two advantages over the event-inheritance
model. They are :
It enables event handling by objects other than the ones that generate the
events. This
allows a clean separation between a components design and its use.
It performs much better in applications where many events are generated.
This
performance improvement is due to the fact that the event-delegation model
does not
have to repeatedly process unhandled events, as is the case of the event-inheritance
model.
What is the purpose of the enableEvents( ) method? Answers :The enableEvents( ) method is used to enable an event for a particular
object.
Which of the following are true?
The event-inheritance model has replaced the event-delegation model.
The event-inheritance model is more efficient than the event-delegation
model.
The event-delegation model uses event listeners to define the methods of
event-handling classes.
The event-delegation model uses the handleEvent( ) method to support event
handling. Answers : c.
Which of the following is the highest class in the event-delegation model?
java.util.EventListener
java.util.EventObject
java.awt.AWTEvent
java.awt.event.AWTEvent Answers : b.
When two or more objects are added as listeners for the same event, which
listener is first invoked to handle the event?
The first object that was added as listener.
The last object that was added as listener.
There is no way to determine which listener will be invoked first.
It is impossible to have more than one listener for a given event. Answers : c.
Which of the following components generate action events?
Buttons
Labels
Check boxes
Windows Answers : a.
Which of the following are true?
A TextField object may generate an ActionEvent.
A TextArea object may generate an ActionEvent.
A Button object may generate an ActionEvent.
A MenuItem object may generate an ActionEvent. Answers : a,c and d.
Which of the following are true?
The MouseListener interface defines methods for handling mouse clicks.
The MouseMotionListener interface defines methods for handling mouse
clicks.
The MouseClickListener interface defines methods for handling mouse clicks.
The ActionListener interface defi