Server Side And Client Side Scripting(Computer Science > Javascript ) Questions and Answers

Question 1. What are the events generated by the Node objects called?
  1.    generators
  2.    emitters
  3.    dispatchers
  4.    highevents
Explanation:-
Answer: Option B. -> emitters

Question 2. What is the function used to remove all handlers for name events?
  1.    deleteAllListeners(name)
  2.    deleteListener(name,f)
  3.    removerListener(name,f)
  4.    removeAllListeners(name)
Explanation:-
Answer: Option D. -> removeAllListeners(name)

Question 3. What is the function used to deregister event handler ‘f’?
  1.    deleteAllListeners(name)
  2.    deleteListener(name,f)
  3.    removerListener(name,f)
  4.    removeAllListeners(name)
Explanation:-
Answer: Option C. -> removerListener(name,f)

Question 4. Which of the following is an event emitter?
  1.    once
  2.    process
  3.    listeners
  4.    on
Explanation:-
Answer: Option B. -> process

Question 5. Which function is a synonym for on()?
  1.    addListener()
  2.    listeners()
  3.    once()
  4.    add()
Explanation:-
Answer: Option A. -> addListener()

Question 6. When do uncaught exceptions generate events?
  1.    When handlers are registered
  2.    When handlers are deregistered
  3.    When handler functions are called
  4.    When handlers do not have a matching catch clause
Explanation:-
Answer: Option A. -> When handlers are registered

Question 7. Which among the following POSIX signals generate events?
  1.    SIGDOWN
  2.    SIGFLOAT
  3.    SIGINT
  4.    SIGSHORT
Explanation:-
Answer: Option C. -> SIGINT

Question 8. When the “end” event fires on EOF when no more data will arrive, which function is called?
  1.    s.on("data",f);
  2.    s.on("end",f);
  3.    s.on("error",f);
  4.    s.on("default",f);
Explanation:-
Answer: Option B. -> s.on("end",f);

Question 9. What is the method used to pause “data” events?
  1.    s.pause();
  2.    s.stop();
  3.    s.halt();
  4.    s.wait();
Explanation:-
Answer: Option A. -> s.pause();

Question 10. What will be the return value of the write() method when the Node cannot write the data immediately and has to buffer it internally?
  1.    0
  2.    1
  3.    True
  4.    False
Explanation:-
Answer: Option D. -> False