Learn Node Js MCQs
Prepare Node Js MCQs (Multiple choice Questions) for exam and job interviews.
How do you parse URL parameters in Express.js?
1) Using `req.params`
2) Using `req.query`
3) Using `req.body`
4) Using `req.headers`
Answer : Option 1
What is the purpose of the `crypto` module in Node.js?
1) To provide cryptographic functionalities
2) To handle HTTP requests
3) To manage file systems
4) To parse URLs
Answer : Option 1
How do you use the `debug` module in Node.js?
1) By requiring and setting up the debug namespace
2) By using `console.log()`
3) By using `process.env.DEBUG`
4) By using `console.debug()`
Answer : Option 1
Which module is used to manage child processes in Node.js?
1) child_process
2) process
3) os
4) events
Answer : Option 1
What is the purpose of the `npm link` command?
1) To symlink a package into your project
2) To install a package globally
3) To update a package
4) To uninstall a package
Answer : Option 1
How do you handle multiple async tasks in parallel?
1) Using `Promise.all()`
2) Using `async/await`
3) Using `for` loop
4) Using `setTimeout()`
Answer : Option 1
What does `npm run test` do?
1) Runs the test script defined in package.json
2) Installs dependencies
3) Updates packages
4) Starts the server
Answer : Option 1
How do you set up a Node.js application to use HTTPS?
1) By configuring an HTTPS server with the `https` module
2) By using `http` module with SSL certificates
3) By using `express` module
4) By configuring middleware
Answer : Option 1
What is the purpose of the `vm` module in Node.js?
1) To compile and run code within V8 Virtual Machine
2) To manage file systems
3) To handle HTTP requests
4) To manage processes
Answer : Option 1
How do you ensure that a Node.js application only has a single instance?
1) Using a singleton pattern or clustering
2) Using multiple instances
3) Using `process` module
4) Using `async/await`
Answer : Option 1