Bird
0
0

What is the main purpose of listening to the exit event on a worker in Node.js cluster module?

easy📝 Conceptual Q11 of 15
Node.js - Cluster Module
What is the main purpose of listening to the exit event on a worker in Node.js cluster module?
ATo log the worker's CPU usage
BTo start a new worker automatically
CTo send messages between workers
DTo detect when a worker crashes or stops running
Step-by-Step Solution
Solution:
  1. Step 1: Understand the exit event role

    The exit event is triggered when a worker process stops, either normally or due to a crash.
  2. Step 2: Identify the purpose of listening to exit

    Listening to exit helps detect unexpected worker crashes so the master can respond.
  3. Final Answer:

    To detect when a worker crashes or stops running -> Option D
  4. Quick Check:

    exit event = detect crash [OK]
Quick Trick: Remember: exit event means worker stopped or crashed [OK]
Common Mistakes:
  • Confusing exit event with message passing
  • Thinking exit event starts new workers automatically
  • Assuming exit event logs CPU usage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Node.js Quizzes