Node.js Flashcards
What is Node.js?
Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine.
True or False: Node.js is single-threaded.
True
What is the primary use case for Node.js?
Building scalable network applications.
Fill in the blank: Node.js uses __________ for managing asynchronous calls.
event-driven architecture
What is npm?
npm is the package manager for Node.js.
True or False: Node.js can be used for front-end development.
False
What command is used to initialize a new Node.js project?
npm init
What is the purpose of the ‘require’ function in Node.js?
To import modules.
Multiple Choice: Which of the following is a core module in Node.js? A) express B) fs C) mongoose
B) fs
What does the ‘fs’ module in Node.js stand for?
File System
True or False: Node.js is ideal for I/O-heavy applications.
True
What is a callback function?
A function passed into another function as an argument that is executed after the first function completes.
Fill in the blank: Node.js uses a __________ model to handle requests.
non-blocking I/O
What is the default port for a Node.js application?
There is no default port; it can be set to any valid port.
Multiple Choice: Which of the following frameworks is built on top of Node.js? A) Angular B) React C) Express
C) Express
What is the purpose of middleware in Express.js?
Middleware functions are used to process requests and responses in the application.
True or False: Node.js can be used for database management.
True
What is the purpose of the ‘next’ function in Express middleware?
To pass control to the next middleware function.
Fill in the blank: The __________ method is used to send a response back to the client in Express.
res.send()
What does the ‘process’ object in Node.js represent?
The current Node.js process.
Multiple Choice: Which of the following is not a built-in module in Node.js? A) http B) url C) json
C) json
What is the purpose of the ‘package.json’ file?
To manage project dependencies and metadata.
True or False: Node.js supports promises and async/await for handling asynchronous code.
True
What is the event loop in Node.js?
The mechanism that allows Node.js to perform non-blocking I/O operations.