135k views
2 votes
Which of the following statements is true?

I. a source object fires an event
II. a handler object fires an event
III. a handler is registered with source object for processing an event

a. i and iii only
b. ii and iii only
c. i, ii, and iii
d. i and ii only

User GnanaJeyam
by
7.1k points

1 Answer

5 votes

Final answer:

The true statements are that a source object fires an event and a handler is registered with the source object for processing the event; a handler object does not fire an event.

Step-by-step explanation:

Regarding the question of which statements are true about events in programming:

  • The source object indeed fires an event. This happens when the object encounters a particular interaction or reaches a certain state, triggering the event to announce that action or state change.
  • A handler object does not fire an event; quite the contrary, the handler is the method or function that responds to the event once it has been fired by the source object.
  • Finally, a handler is registered with the source object to process an event. This registration connects the event to the method that will execute when the event occurs, thus allowing the program to handle the event appropriately.

Therefore, the correct answer is: a. i and iii only.

User Omri Bernstein
by
8.4k points