Bird
0
0

Which object in a worker thread holds the data passed from the main thread?

easy📝 Conceptual Q2 of 15
Node.js - Worker Threads
Which object in a worker thread holds the data passed from the main thread?
Aprocess.env
BworkerData
CparentPort
Dglobal
Step-by-Step Solution
Solution:
  1. Step 1: Identify data container in worker

    The workerData object contains the data passed from the main thread when the worker is created.
  2. Step 2: Differentiate from other objects

    parentPort is for messaging, process.env holds environment variables, and global is not shared between threads.
  3. Final Answer:

    workerData -> Option B
  4. Quick Check:

    Data in worker = workerData object [OK]
Quick Trick: Access passed data inside worker via workerData [OK]
Common Mistakes:
  • Confusing parentPort with data storage
  • Trying to use global or process.env for passed data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Node.js Quizzes