What are the events generated by the Node objects called?
a) generators
b) emitters
c) dispatchers
d) highevents
Explanation: There are two classes of events one is called event listener and the other is called event emitter. Node objects that generate events (known as event emitters) define an on() method for registering handlers.
What is the function used to deregister event handler âfâ?
a) deleteAllListeners(name)
b) deleteListener(name,f)
c) removeListener(name,f)
d) removeAllListeners(name)
Explanation: The removeEventListener() method removes an event handler that has been attached with the addEventListener() method. The removeListeners(name,f) is used to deregister event handler f represented as :
emitter.removeListener(name,f)
What is the function used to remove all handlers for name events?
a) deleteAllListeners(name)
b) deleteListener(name,f)
c) removeListener(name,f)
d) removeAllListeners(name)
Explanation: The removeAllListeners(name) is used to remove all handlers from name events represented as :
emitter.removeAllListeners(name)
Which function is a synonym for on()?
a) addListener()
b) listeners()
c) once()
d) add()
Explanation: The on() method is used for registering handlers. addListener() is a synonym for on().
Which of the following is an event emitter?
a) once
b) process
c) listeners
d) on
Explanation: The process object is an event emitter. The Node defines other important globals under the process namespaces that contain properties of that object like version, argv, env, pid, getuid(), cwd(), chdir() and exit().
When do uncaught exceptions generate events?
a) When handlers are registered
b) When handlers are deregistered
c) When handler functions are called
d) When handlers do not have a matching catch clause
Explanation: The on() method and addListener() method perform the same task of acting as an event emitter. The on() and addListener() method is used for registering handlers.