Bird
0
0

Which method is used to create a new worker process in the Node.js cluster module?

easy📝 Conceptual Q2 of 15
Node.js - Cluster Module
Which method is used to create a new worker process in the Node.js cluster module?
Acluster.createWorker()
Bcluster.spawn()
Ccluster.fork()
Dcluster.newProcess()
Step-by-Step Solution
Solution:
  1. Step 1: Recall cluster API methods

    The official method to create a worker is cluster.fork(), which spawns a new process.
  2. Step 2: Eliminate incorrect options

    Methods like spawn(), createWorker(), or newProcess() do not exist in the cluster module.
  3. Final Answer:

    cluster.fork() -> Option C
  4. Quick Check:

    Worker creation = cluster.fork() [OK]
Quick Trick: Use cluster.fork() to spawn workers [OK]
Common Mistakes:
  • Using non-existent cluster.spawn() method
  • Confusing with child_process.spawn()
  • Assuming cluster.createWorker() exists

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Node.js Quizzes