<%@ include file="../../ga4.jsp" %> Event Communications [JavaBeans] - Quiz Explanation

JavaBeans Event Communications - Quiz Explanation

 
The correct answers are indicated below, along with the text that explains the correct answers.
1. Mouse drags and key presses are examples of: s
  A. Semantic events.
  B. Abstract events.
  C. Low-level events.
  The correct answer is C. Mouse drags and key presses are examples of low-level events. A is incorrect because semantic events are events that are based on the semantics of a particular Bean; mouse drags and key presses are common to all visual Beans. B is incorrect because there is no such thing as an abstract event.


2. A component capable of generating events is known as:
  A. An event listener.
  B. An event source.
  C. An event adapter.
  The correct answer is B. A component capable of generating events is known as an event source. A is incorrect because event listeners receive events, not generate them. C is incorrect because event adapters are used to help route and handle events, not generate them.

3. To receive event notifications from an event source, an object must:
  A. Register itself as an event listener by calling an event registration method on the event source.
  B. Implement the handleEvent() method.
  C. Constantly query the event source to see if any events have occurred.
  The correct answer is A. To receive event notifications from an event source, an object must register itself as an event listener by calling an event registration method on the event source. B is incorrect because the handleEvent() method isn't used under the Java 1.1 delegation event model. C is incorrect because an event listener never has to query an event source to find out about the occurrence of events.

4. If you try to register more than one event listener with a unicast event source, the event source will:
  A. Allow the registration and issue a warning.
  B. Disallow the registration and throw an exception.
  C. Allow the registration and throw an exception.
  The correct answer is B. If you try to register more than one event listener with a unicast event source, the event source will disallow the registration and throw an exception.

5. Which type of event delivery is more desirable in terms of Bean design?
  A. Asynchronous event delivery.
  B. Multicast event delivery.
  C. Unicast event delivery.
  The correct answer is B. Multicast event delivery is a more desirable form of event delivery in terms of Bean design because it supports the widest range of Bean usage. A is incorrect because there are no such things as asynchronous events in Java; all events are synchronous. C is incorrect because unicast event delivery is more limited than multicast delivery, and is therefore less desirable.

6. Unicast Beans allow only one:
  A. Event listener to be registered at any given time.
  B. Event to be broadcast at a time.
  C. Event listener interface to be used.
  The correct answer is A. Unicast Beans allow only one event listener to be registered at any given time. B is incorrect because unicast Beans can broadcast as many events as they want. C is incorrect because unicast Beans can support any EventListener derived interface.