Interview Q&A

Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.

4616 total questions 4516 technical 100 career & HR 4346 from PDF library

Showing 1–25 of 49

Career & HR topics

By tech stack

Junior PDF
How do you connect Node.js to MongoDB? You typically use the MongoDB Node.js driver or an ODM like Mongoose. Basic connection example with native driver: const { MongoClient } = require('mongodb');

sync function connect() { const uri = 'mongodb://localhost:27017/mydatabase'; const client = new MongoClient(uri); try { wait client.connect(); console.log('Connected to MongoDB'); const db = client.db('mydatabase'); //…

Node.js Read answer
Junior PDF
What is clustering in Node.js? Node.js runs on a single thread by default, which means it can handle only one operation at

time per process. Clustering allows you to create multiple Node.js processes (workers) that share the same server port. This way, your app can utilize multiple CPU cores and handle more requests concurrently. 📌 Example:…

Node.js Read answer
Junior PDF
What is Node.js?

Node.js is an open-source, cross-platform runtime environment that allows you to run JavaScript on the server side. It’s built on the V8 JavaScript engine developed by Google (the same one used in Chrome). With Node.js,…

Node.js Read answer
Junior PDF
What is the EventEmitter class? How do you create and use custom events?

EventEmitter allows objects to emit named events and listen for them. Example: const EventEmitter = require('events'); const emitter = new EventEmitter(); emitter.on('greet', (name) => { console.log(`Hello, ${name}!`)…

Node.js Read answer
Junior PDF
What is process management and why is PM2 useful?

Process management means keeping your app running reliably, restarting it if it crashes, and managing multiple instances. PM2 is a popular Node.js process manager that: Restarts apps on crashes or code changes Manages cl…

Node.js Read answer
Junior PDF
What is Mongoose and how is it used?

Mongoose is an ODM (Object Data Modeling) library for MongoDB in Node.js. It provides: Schema-based data modeling Validation Middleware (hooks) Easy querying and relationship management You define schemas and models to i…

Node.js Read answer
Junior PDF
How do you define schemas and models with Mongoose? const mongoose = require('mongoose'); const userSchema = new mongoose.Schema({ name: { type: String, required: true }, email: { type: String, required: true, unique: true },

ge: Number, createdAt: { type: Date, default: Date.now } }); const User = mongoose.model('User', userSchema); // Usage example sync function createUser() { const user = new User({ name: 'Alice', email: 'alice@example.com…

Node.js Read answer
Junior PDF
What is Mocha? Mocha is a test runner that executes your test files, organizes tests in suites (describe),

Answer: nd allows async testing. It does not provide assertions, so it’s often paired with assertion libraries like Chai. What interviewers expect A clear definition tied to Node.js in Node.js projects Trade-offs (perfor…

Node.js Read answer
Junior PDF
What is PM2 and why is it used?

PM2 is a popular production process manager for Node.js applications. It helps you: Manage and keep apps alive forever (auto-restart on crashes). Run apps in cluster mode easily. Monitor resource usage (CPU, memory). Han…

Node.js Read answer
Junior PDF
What is the V8 engine?

The V8 engine is a high-performance JavaScript engine developed by Google for Chrome. Node.js uses it to compile and run JavaScript code on the server side. It converts JS code into machine code, making it fast and effic…

Node.js Read answer
Junior PDF
What is load balancing and how does it apply to Node.js?

Load balancing distributes incoming requests across multiple server instances to: Improve performance Increase availability and fault tolerance In Node.js, you can: Use the cluster module to spawn workers on multiple CPU…

Node.js Read answer
Junior PDF
What is Chai? Chai is an assertion library for Node.js that lets you write readable tests with different styles: Expect style (most popular): expect(result).to.equal(5); ● Should style: result.should.equal(5); ●

ssert style: ssert.equal(result, 5); What interviewers expect A clear definition tied to Node.js in Node.js projects Trade-offs (performance, maintainability, security, cost) When you would and would not use it in produc…

Node.js Read answer
Junior PDF
What is the difference between PUT and PATCH in REST APIs?

PUT: Replaces the entire resource with the data sent. If a field is missing in the request, it may get erased. Idempotent (same request repeated yields same result). PATCH: Applies partial updates to the resource. Only c…

Node.js Read answer
Junior PDF
What is Sequelize?

Sequelize is a popular ORM for relational databases like MySQL, PostgreSQL, SQLite, and MSSQL. It allows you to: Define models with JavaScript classes Handle migrations and schema changes Write complex queries using Java…

Node.js Read answer
Junior PDF
What is Supertest and how is it used?

Supertest is a library for testing HTTP APIs, especially Express apps. It allows you to simulate HTTP requests and assert on responses. Example: const request = require('supertest'); const app = require('../app'); // You…

Node.js Read answer
Junior PDF
What is backpressure in Streams?

Backpressure happens when data is produced faster than it can be consumed downstream. In Node.js streams, it's a built-in mechanism to: Pause the readable stream when the writable stream is overwhelmed. Prevent memory ov…

Node.js Read answer
Junior PDF
What is the role of async/await in Node.js?

sync/await provides a cleaner syntax for handling asynchronous code, making it look synchronous and easier to read compared to nested callbacks or promise chains. sync function fetchData() { try { const data = await some…

Node.js Read answer
Junior PDF
What is the event loop in Node.js? The event loop is the core of Node.js's non-blocking I/O operations. It handles all

synchronous operations in a single thread, constantly checking for events (e.g., incoming data, timers) and executing associated callbacks. 📌 Example: setTimeout(() => { console.log('Executed after 2 seconds'); }, 20…

Node.js Read answer
Junior PDF
What is the difference between CommonJS and ES Modules (ESM) in Node.js? ● CommonJS (CJS): Uses require() and module.exports. Synchronous module loading. ● ES Modules: Uses import/export syntax. Supports asynchronous and static

nalysis. ESM is the modern standard but Node.js supports both. What interviewers expect A clear definition tied to Node.js in Node.js projects Trade-offs (performance, maintainability, security, cost) When you would and…

Node.js Read answer
Junior PDF
What is dotenv and how is it used?

Answer: dotenv is a library to load environment variables from a .env file into process.env. What interviewers expect A clear definition tied to Node.js in Node.js projects Trade-offs (performance, maintainability, secur…

Node.js Read answer
Junior PDF
What is test coverage and how do you measure it?

Test coverage shows how much of your code is tested (lines, branches, functions). Tools to measure: Istanbul/nyc: Most popular coverage tool. Jest: Has built-in coverage reports. Run coverage with nyc: nyc mocha It outpu…

Node.js Read answer
Junior PDF
What is the role of nodemon?

Answer: nodemon is a development tool that automatically restarts your Node.js app when file changes are detected—great for faster development cycles. It’s not recommended for production. Usage: nodemon app.js What inter…

Node.js Read answer
Junior PDF
What is the difference between synchronous and asynchronous functions?

Synchronous functions block the execution until they finish. Asynchronous functions allow other code to run while waiting for operations (like I/O) to complete. // Synchronous (blocks event loop) const data = fs.readFile…

Node.js Read answer
Junior PDF
What is the purpose of the main field in package.json?

Answer: It specifies the entry point file of a package (default is index.js). When someone imports your package, Node.js loads the file in main. What interviewers expect A clear definition tied to Node.js in Node.js proj…

Node.js Read answer
Junior PDF
What is CI/CD and how can it be applied to a Node.js project?

CI/CD stands for Continuous Integration and Continuous Deployment. CI: Automatically build and test your Node.js app every time you push code (e.g., GitHub Actions, Jenkins). CD: Automatically deploy the app to productio…

Node.js Read answer

Node.js Node.js Tutorial · Node.js

sync function connect() {

const uri = 'mongodb://localhost:27017/mydatabase';
const client = new MongoClient(uri);

try {

wait client.connect();

console.log('Connected to MongoDB');

const db = client.db('mydatabase');

// Use `db` to query collections

} catch (err) {

console.error(err);

} finally {

wait client.close();

}
}

connect();

Permalink & share

Node.js Node.js Tutorial · Node.js

time per process. Clustering allows you to create multiple Node.js processes (workers)

that share the same server port. This way, your app can utilize multiple CPU cores and

handle more requests concurrently.

📌 Example: Using the built-in cluster module, you can fork multiple workers.

Permalink & share

Node.js Node.js Tutorial · Node.js

Node.js is an open-source, cross-platform runtime environment that allows you to run

JavaScript on the server side. It’s built on the V8 JavaScript engine developed by Google

(the same one used in Chrome). With Node.js, you can build scalable and high-performance

web applications, APIs, and even real-time services like chat apps.

📌 Example:

If you write a simple HTTP server in Node.js, you can serve a webpage without using a

traditional web server like Apache:

const http = require('http');

http.createServer((req, res) => {

res.end('Hello from Node.js server!');

}).listen(3000);

Permalink & share

Node.js Node.js Tutorial · Node.js

EventEmitter allows objects to emit named events and listen for them.

Example:

const EventEmitter = require('events');
const emitter = new EventEmitter();

emitter.on('greet', (name) => {

console.log(`Hello, ${name}!`);

});

emitter.emit('greet', 'Alice');

Output: Hello, Alice!

It’s fundamental for asynchronous communication in Node.js.

Permalink & share

Node.js Node.js Tutorial · Node.js

Process management means keeping your app running reliably, restarting it if it crashes, and

managing multiple instances.

PM2 is a popular Node.js process manager that:

  • Restarts apps on crashes or code changes
  • Manages clustering (multi-core usage)
  • Offers logs and monitoring dashboards
  • Supports zero-downtime reloads

Run your app with PM2 like this:

pm2 start app.js

pm2 monit

Permalink & share

Node.js Node.js Tutorial · Node.js

Mongoose is an ODM (Object Data Modeling) library for MongoDB in Node.js. It provides:

  • Schema-based data modeling
  • Validation
  • Middleware (hooks)
  • Easy querying and relationship management

You define schemas and models to interact with MongoDB more intuitively.

Permalink & share

Node.js Node.js Tutorial · Node.js

ge: Number,

createdAt: { type: Date, default: Date.now }

});

const User = mongoose.model('User', userSchema);

// Usage example

sync function createUser() {

const user = new User({ name: 'Alice', email: 'alice@example.com',

ge: 25 });

wait user.save();

console.log('User saved');

}
Permalink & share

Node.js Node.js Tutorial · Node.js

Answer: nd allows async testing. It does not provide assertions, so it’s often paired with assertion libraries like Chai.

What interviewers expect

  • A clear definition tied to Node.js in Node.js projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Node.js application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Node.js architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Node.js Node.js Tutorial · Node.js

PM2 is a popular production process manager for Node.js applications. It helps you:

  • Manage and keep apps alive forever (auto-restart on crashes).
  • Run apps in cluster mode easily.
  • Monitor resource usage (CPU, memory).
  • Handle zero-downtime reloads.

npm install pm2 -g

pm2 start app.js -i max # Runs in cluster mode with max CPU cores

Permalink & share

Node.js Node.js Tutorial · Node.js

The V8 engine is a high-performance JavaScript engine developed by Google for Chrome.

Node.js uses it to compile and run JavaScript code on the server side. It converts JS code

into machine code, making it fast and efficient.

📌 Use Case:

When you run a .js file with Node.js, the V8 engine compiles your code into machine code

behind the scenes.

Permalink & share

Node.js Node.js Tutorial · Node.js

Load balancing distributes incoming requests across multiple server instances to:

  • Improve performance
  • Increase availability and fault tolerance

In Node.js, you can:

  • Use the cluster module to spawn workers on multiple CPU cores.
  • Use external load balancers like Nginx, HAProxy, or cloud load balancers.
  • PM2 also supports clustering with:

pm2 start app.js -i max

Permalink & share

Node.js Node.js Tutorial · Node.js

ssert style: ssert.equal(result, 5);

What interviewers expect

  • A clear definition tied to Node.js in Node.js projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Node.js application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Node.js architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Node.js Node.js Tutorial · Node.js

  • PUT: Replaces the entire resource with the data sent.
  • If a field is missing in the request, it may get erased.
  • Idempotent (same request repeated yields same result).
  • PATCH: Applies partial updates to the resource.
  • Only changes the fields specified.
  • Not necessarily idempotent.

Example: Updating user email.

  • PUT /users/1 with { "name": "Alice" } replaces whole user — email might

get removed.

  • PATCH /users/1 with { "email": "new@example.com" } updates just the

email.

Permalink & share

Node.js Node.js Tutorial · Node.js

Sequelize is a popular ORM for relational databases like MySQL, PostgreSQL, SQLite, and

MSSQL.

It allows you to:

  • Define models with JavaScript classes
  • Handle migrations and schema changes
  • Write complex queries using JavaScript instead of raw SQL
Permalink & share

Node.js Node.js Tutorial · Node.js

Supertest is a library for testing HTTP APIs, especially Express apps.

It allows you to simulate HTTP requests and assert on responses.

Example:

const request = require('supertest');
const app = require('../app'); // Your Express app

describe('GET /users', () => {

it('should return 200 and a list of users', (done) => {

request(app)

.get('/users')

.expect(200)

.expect('Content-Type', /json/)

.end((err, res) => {

if (err) return done(err);

done();

});

});

});

Permalink & share

Node.js Node.js Tutorial · Node.js

Backpressure happens when data is produced faster than it can be consumed downstream.

In Node.js streams, it's a built-in mechanism to:

  • Pause the readable stream when the writable stream is overwhelmed.
  • Prevent memory overload and crashes.

This flow control allows producers and consumers to work in sync.

Permalink & share

Node.js Node.js Tutorial · Node.js

sync/await provides a cleaner syntax for handling asynchronous code, making it look

synchronous and easier to read compared to nested callbacks or promise chains.

sync function fetchData() {

try {

const data = await someAsyncFunction();

console.log(data);

} catch (err) {

console.error(err);

}
}
Permalink & share

Node.js Node.js Tutorial · Node.js

synchronous operations in a single thread, constantly checking for events (e.g., incoming

data, timers) and executing associated callbacks.

📌 Example:

setTimeout(() => {

console.log('Executed after 2 seconds');

}, 2000);

This callback is scheduled by the event loop and executed when the time is up.

Permalink & share

Node.js Node.js Tutorial · Node.js

nalysis. ESM is the modern standard but Node.js supports both.

What interviewers expect

  • A clear definition tied to Node.js in Node.js projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Node.js application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Node.js architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Node.js Node.js Tutorial · Node.js

Answer: dotenv is a library to load environment variables from a .env file into process.env.

What interviewers expect

  • A clear definition tied to Node.js in Node.js projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Node.js application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Node.js architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Node.js Node.js Tutorial · Node.js

Test coverage shows how much of your code is tested (lines, branches, functions).

Tools to measure:

  • Istanbul/nyc: Most popular coverage tool.
  • Jest: Has built-in coverage reports.

Run coverage with nyc:

nyc mocha

It outputs stats like:

  • % of lines covered
  • % of functions covered
  • % of branches covered

Security in Node.js

Permalink & share

Node.js Node.js Tutorial · Node.js

Answer: nodemon is a development tool that automatically restarts your Node.js app when file changes are detected—great for faster development cycles. It’s not recommended for production. Usage: nodemon app.js

What interviewers expect

  • A clear definition tied to Node.js in Node.js projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Node.js application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Node.js architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Node.js Node.js Tutorial · Node.js

  • Synchronous functions block the execution until they finish.
  • Asynchronous functions allow other code to run while waiting for operations (like

I/O) to complete.

// Synchronous (blocks event loop)

const data = fs.readFileSync('file.txt');

// Asynchronous (non-blocking)

fs.readFile('file.txt', (err, data) => {

if (err) throw err;

console.log(data);

});

Permalink & share

Node.js Node.js Tutorial · Node.js

Answer: It specifies the entry point file of a package (default is index.js). When someone imports your package, Node.js loads the file in main.

What interviewers expect

  • A clear definition tied to Node.js in Node.js projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Node.js application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Node.js architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Node.js Node.js Tutorial · Node.js

CI/CD stands for Continuous Integration and Continuous Deployment.

  • CI: Automatically build and test your Node.js app every time you push code (e.g.,

GitHub Actions, Jenkins).

  • CD: Automatically deploy the app to production or staging after tests pass.

Benefits:

  • Catch bugs early
  • Fast, repeatable releases
  • Automated testing and deployment pipelines

Typical pipeline steps:

Permalink & share
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details