Node.js - Child ProcessesWhich of the following is the correct way to create a child process in Node.js?Aconst child = require('child_process').fork('script.js');Bconst child = require('child_process').start('script.js');Cconst child = require('child_process').run('script.js');Dconst child = require('child_process').execute('script.js');Check Answer
Step-by-Step SolutionSolution:Step 1: Recall Node.js child process methodsThe 'child_process' module has methods like fork(), spawn(), exec(), but not start() or run().Step 2: Identify correct method for creating a child process running a scriptfork() is used to create a new Node.js process running a script file.Final Answer:const child = require('child_process').fork('script.js'); -> Option AQuick Check:fork() creates child process = A [OK]Quick Trick: Use fork() to create child Node.js processes [OK]Common Mistakes:Using non-existent methods like start() or run()Confusing exec() with fork() for script processesForgetting to require 'child_process' module
Master "Child Processes" in Node.js9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Node.js Quizzes Debugging and Profiling - Common memory leak patterns - Quiz 10hard Debugging and Profiling - Heap snapshot for memory leaks - Quiz 9hard Error Handling Patterns - Promise catch for async errors - Quiz 3easy Error Handling Patterns - Try-catch for synchronous errors - Quiz 1easy Error Handling Patterns - Custom error classes - Quiz 7medium Error Handling Patterns - Graceful shutdown on errors - Quiz 4medium HTTP Module - Response methods and status codes - Quiz 5medium HTTP Module - Response methods and status codes - Quiz 2easy Timers and Scheduling - setTimeout and clearTimeout - Quiz 5medium Worker Threads - Passing data to workers - Quiz 9hard