MCQ Questions
Browse through our collection of questions with detailed explanations
How to export a function in Node.js?
NodeJS Tutorials & BlogsExplanation
module.exports
is used to export functions/objects.
What does the 'fs' module stand for?
NodeJS Tutorials & BlogsExplanation
fs
is used to handle file system operations.
What is npm?
NodeJS Tutorials & BlogsExplanation
npm helps manage Node.js packages and dependencies.
Which file extension is used for Node.js modules?
NodeJS Tutorials & BlogsExplanation
Node modules are written in .js
files.
Which method is used to create a server in Node.js?
NodeJS Tutorials & BlogsExplanation
http.createServer()
creates a new web server.
Which of the following is true about Node.js?
NodeJS Tutorials & BlogsExplanation
Node.js is asynchronous and single-threaded.
Which object is used to handle events in Node.js?
NodeJS Tutorials & BlogsExplanation
EventEmitter is part of the events
module.
Which function is used to import a module in Node.js?
NodeJS Tutorials & BlogsExplanation
require()
loads built-in, local or 3rd-party modules.
Which of the following is not a Node.js core module?
NodeJS Tutorials & BlogsExplanation
express
is a third-party framework, not built-in.
Node.js is best suited for...
NodeJS Tutorials & BlogsExplanation
Node is single-threaded, so it's ideal for non-blocking, I/O-heavy tasks.
Which module is used to create a web server in Node.js?
NodeJS Tutorials & BlogsExplanation
http
module helps create HTTP server and handle requests/responses.
Node.js is built on which JavaScript engine?
Explanation
V8 is Google's open-source JS engine used in Chrome and Node.js.
What is Node.js?
NodeJS Tutorials & BlogsExplanation
Node.js is a runtime built on Chrome's V8 engine for running JS on the server side.
Which method converts a JSON string to a JavaScript object?
Explanation
JSON.parse()
takes a JSON string and turns it into a JS object.
Explanation
Due to floating-point precision, 0.1 + 0.2 results in 0.30000000000000004, not exactly 0.3.