Interview Q&A

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

4608 total questions 4508 technical 100 career & HR 4272 from PDF library

Showing 2826–2850 of 3281

Career & HR topics

By tech stack

Popular tracks

Mid PDF
What are transactions and how are they handled?

Short answer: Transactions allow multiple database operations to execute atomically — either all succeed or none do — ensuring data consistency. In MongoDB (using Mongoose): const session = await mongoose.startSession();…

Node.js Read answer
Mid PDF
How does error handling work in async/await?

Short answer: You handle errors using try/catch blocks around await statements. async function getUser() { try { const user = await getUserFromDB(); return user; } catch (error) { console.error('Error fetching user:', er…

Node.js Read answer
Mid PDF
Explain the non-blocking I/O model in Node.js.

Short answer: Non-blocking I/O means the application doesn't wait for a task (like reading a file or querying a database) to complete before moving to the next one. Node.js uses callbacks, promises, or async/await to han…

Node.js Read answer
Mid PDF
How does the async queue work in Node.js?

Short answer: sync queues (e.g., with libraries like async.queue) allow you to: Control concurrency (limit how many async tasks run simultaneously). Explain a bit more Queue tasks and process them in order. sync queues (…

Node.js Read answer
Mid PDF
How do you monitor performance in a Node.js app?

Short answer: Use monitoring tools like New Relic, Datadog, AppDynamics, or open-source tools like Prometheus + Grafana. Track metrics: response time, CPU/memory usage, error rates. Use Node.js built-in profilers or clin…

Node.js Read answer
Mid PDF
What are transactions and how are they handled?

Short answer: wait User.create([{ name: 'Bob' }], { session }); wait Order.create([{ userId: user._id }], { session }); wait session.commitTransaction(); } catch (error) { wait session.abortTransaction(); } finally { ses…

Node.js Read answer
Mid PDF
How does error handling work in async/await?

Short answer: sync function getUser() { try { const user = await getUserFromDB(); return user; } catch (error) { console.error('Error fetching user:', error); } } Without try/catch, unhandled promise rejections can crash…

Node.js Read answer
Mid PDF
Explain the non-blocking I/O model in Node.js. Non-blocking I/O means the application doesn't wait for a task (like reading a file or querying

Short answer: database) to complete before moving to the next one. Explain a bit more Node.js uses callbacks, promises, or sync/await to handle the results when they're ready. database) to complete before moving to the n…

Node.js Read answer
Mid PDF
How does Node.js resolve modules when you call require()?

Short answer: Node.js searches in this order: Real-world example (ShopNest) A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront. Say this in the interview Define — one clear sentence (the…

Node.js Read answer
Mid PDF
How do you prevent Cross-Site Scripting (XSS)?

Short answer: Sanitize user inputs and outputs. Use libraries like DOMPurify for front-end. Use HTTP headers like Content Security Policy (CSP) via Helmet. Escape data before rendering in HTML. Real-world example (ShopNe…

Node.js Read answer
Mid PDF
What are global objects in Node.js?

Short answer: Global objects are available in all modules without the need to import them. Examples include: __dirname: Directory name of the current module __filename: Full path of the current module global: Similar to…

Node.js Read answer
Mid PDF
How do you secure user passwords?

Short answer: Always hash passwords before storing (never store plaintext). Use strong, slow hashing algorithms like bcrypt, argon2, or scrypt. Add a salt to each password (bcrypt does this automatically). Use libraries…

Node.js Read answer
Mid PDF
How do you optimize Node.js applications for high throughput?

Short answer: Avoid blocking the event loop. Use asynchronous APIs. Use clustering or worker threads. Cache results where possible. Profile and fix bottlenecks. Use load balancers for scaling horizontally. Real-world exa…

Node.js Read answer
Mid PDF
How do you emit and listen for events?

Short answer: const EventEmitter = require('events'); const emitter = new EventEmitter(); emitter.on('greet', (name) => { console.log(`Hello, ${name}!`); }); emitter.emit('greet', 'Alice'); // Output: Hello, Alice! Ex…

Node.js Read answer
Mid PDF
How do you install a package globally vs locally?

Short answer: Local Installation (default): Installs the package into the node_modules folder of your current project. npm install lodash ✅ Used when the package is needed as part of your app's code. Global Installation:…

Node.js Read answer
Mid PDF
Explain clustering and how it improves Node.js app performance.

Short answer: Clustering runs multiple Node.js instances on different CPU cores sharing the same server port. This spreads load and uses full CPU capacity, increasing concurrency. Real-world example (ShopNest) A ShopNest…

Node.js Read answer
Mid PDF
How does Node.js handle concurrency?

Short answer: Node.js uses a single-threaded event loop to handle many I/O operations asynchronously, allowing it to handle thousands of concurrent connections efficiently without creating threads per connection. Real-wo…

Node.js Read answer
Mid PDF
How do you scale Node.js horizontally?

Short answer: Deploy multiple instances on different machines or containers. Use a load balancer to distribute traffic. Share state externally (e.g., Redis) since instances are stateless. Say this in the interview Define…

Node.js Read answer
Mid PDF
How does Node.js handle concurrency?

Short answer: llowing it to handle thousands of concurrent connections efficiently without creating threads per connection. Real-world example (ShopNest) A ShopNest BFF in Node.js aggregates catalog and price APIs for th…

Node.js Read answer
Mid PDF
What are some common causes of memory leaks in Node.js?

Short answer: Global variables holding references. Event listeners not removed. Closures holding onto variables. Caches growing without limits. Security & Best Practices Real-world example (ShopNest) A ShopNest BFF i…

Node.js Read answer
Mid PDF
How do you update a package in Node.js?

Short answer: To update all packages to their latest safe versions based on semver: npm update To update a specific package to its latest version: npm install express@latest For a more interactive way: npx npm-check-upda…

Node.js Read answer
Mid PDF
How do you create a custom Node.js module?

Short answer: You can create a custom module by writing logic in a separate .js file and exporting it using module.exports. Explain a bit more 📌 Example: mathUtils.js function add(a, b) { return a + b; module.exports =…

Node.js Read answer
Mid PDF
How do you prevent Denial of Service (DoS) attacks in Node.js?

Short answer: Use rate limiting. Validate and sanitize inputs. Avoid blocking event loop. Use security middleware like helmet. Use a reverse proxy with DDoS protection. Real-world example (ShopNest) A ShopNest BFF in Nod…

Node.js Read answer
Mid PDF
How do you create a custom Node.js module?

Short answer: pp.js const math = require('./mathUtils'); console.log(math.add(5, 3)); // 8 console.log(math.subtract(9, 4)); // 5 ✅ This is how you break your code into reusable pieces (modules) in Node.js. REST API Deve…

Node.js Read answer
Mid PDF
How do you sanitize user input to avoid security risks?

Short answer: Strip out dangerous characters. Use libraries like validator.js. Escape output in HTML contexts. Real-world example (ShopNest) A ShopNest BFF in Node.js aggregates catalog and price APIs for the React store…

Node.js Read answer

Node.js Node.js Tutorial · Node.js

Short answer: Transactions allow multiple database operations to execute atomically — either all succeed or none do — ensuring data consistency. In MongoDB (using Mongoose): const session = await mongoose.startSession(); session.startTransaction(); try { await User.create([{ name: 'Bob' }], { session });

Example code

await Order.create([{ userId: user._id }], { session });
await session.commitTransaction(); } catch (error) { await session.abortTransaction(); } finally { session.endSession(); } In Sequelize (MySQL/PostgreSQL): const t = await sequelize.transaction(); try { await User.create({ name: 'Bob' }, { transaction: t });
await Order.create({ userId: user.id }, { transaction: t });
await t.commit(); } catch (error) { await t.rollback();
} Deployment & Production

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: You handle errors using try/catch blocks around await statements. async function getUser() { try { const user = await getUserFromDB(); return user; } catch (error) { console.error('Error fetching user:', error); } } Without try/catch, unhandled promise rejections can crash your app.

Example code

You handle errors using try/catch blocks around await statements. async function getUser() { try { const user = await getUserFromDB();
return user; } catch (error) { console.error('Error fetching user:', error); }
} Without try/catch, unhandled promise rejections can crash your app.

Real-world example (ShopNest)

ShopNest’s Node API handles many checkout requests concurrently because I/O (DB/HTTP) is non-blocking on the event loop.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: Non-blocking I/O means the application doesn't wait for a task (like reading a file or querying a database) to complete before moving to the next one. Node.js uses callbacks, promises, or async/await to handle the results when they're ready. 📌

Example code

const fs = require('fs'); fs.readFile('file.txt', 'utf8', (err, data) => { if (err) throw err; console.log(data); }); console.log('Reading file...'); You’ll see "Reading file..." first, even though the file is being read.

Real-world example (ShopNest)

ShopNest’s Node API handles many checkout requests concurrently because I/O (DB/HTTP) is non-blocking on the event loop.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: sync queues (e.g., with libraries like async.queue) allow you to: Control concurrency (limit how many async tasks run simultaneously).

Explain a bit more

Queue tasks and process them in order. sync queues (e.g., with libraries like async.queue) allow you to: Control concurrency (limit how many async tasks run simultaneously). Queue tasks and process them in order. Example with async library: const async = require('async'); const queue = async.queue(async (task) => { wait doWork(task); }, 2); // concurrency = 2 queue.push({ id: 1 }); queue.push({ id: 2 }); Node.js internally uses libuv’s thread pool for async I/O, but the event loop manages task scheduling on the single main thread. dditional Important Node.js Questions & Answers Core Concepts & Runtime sync queues (e.g., with libraries like async.queue) allow you to: Control concurrency……

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: Use monitoring tools like New Relic, Datadog, AppDynamics, or open-source tools like Prometheus + Grafana. Track metrics: response time, CPU/memory usage, error rates. Use Node.js built-in profilers or clinic.js to analyze performance. Set up alerts for anomalies.

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: wait User.create([{ name: 'Bob' }], { session }); wait Order.create([{ userId: user._id }], { session }); wait session.commitTransaction(); } catch (error) { wait session.abortTransaction(); } finally { session.endSession(); } In Sequelize (MySQL/PostgreSQL): const t = await sequelize.transaction(); try { wait User.create({ name: 'Bob' }, {… transaction:… t…… }); wait Order.create({ userId: user.id }, { transaction:…

Explain a bit more

t }); wait t.commit(); } catch (error) { wait t.rollback(); } Deployment & Production wait User.create([{ name: 'Bob' }], { session }); wait Order.create([{ userId: user._id }], { session }); wait session.commitTransaction(); } catch (error) { wait session.abortTransaction(); } finally { session.endSession(); } In Sequelize (MySQL/PostgreSQL): const t = await sequelize.transaction(); try { wait User.create({ name: 'Bob' }, { transaction: t }); wait Order.create({ userId: user.id }, { transaction: t }); wait t.commit(); } catch (error) { wait t.rollback(); } Deployment & Production… wait User.create([{ name: 'Bob' }], { session…

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: sync function getUser() { try { const user = await getUserFromDB(); return user; } catch (error) { console.error('Error fetching user:', error); } } Without try/catch, unhandled promise rejections can crash your app.

Explain a bit more

sync function getUser() { try { const user = await getUserFromDB(); return user; } catch (error) { console.error('Error fetching user:', error); } } Without try/catch, unhandled promise rejections can crash your app. sync function getUser() { try { const user = await getUserFromDB(); return user; } catch (error) { console.error('Error fetching user:', error); } } Without try/catch, unhandled promise rejections can crash your app.

Real-world example (ShopNest)

ShopNest’s Node API handles many checkout requests concurrently because I/O (DB/HTTP) is non-blocking on the event loop.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: database) to complete before moving to the next one.

Explain a bit more

Node.js uses callbacks, promises, or sync/await to handle the results when they're ready. database) to complete before moving to the next one. Node.js uses callbacks, promises, or sync/await to handle the results when they're ready. database) to complete before moving to the next one. Node.js uses callbacks, promises, or sync/await to handle the results when they're ready. 📌 const fs = require('fs'); fs.readFile('file.txt', 'utf8', (err, data) => { if (err) throw err; console.log(data); }); console.log('Reading file...'); You’ll see "Reading file..." first, even though the file is being read. database) to complete before moving to the next one. Node.js uses callbacks, promises, or sync/await to handle the results when they're ready. 📌

Example code

const fs = require('fs'); fs.readFile('file.txt', 'utf8', (err, data) => { if (err) throw err; console.log(data); }); console.log('Reading file...'); You’ll see "Reading file..." first, even though the file is being read.

Real-world example (ShopNest)

ShopNest’s Node API handles many checkout requests concurrently because I/O (DB/HTTP) is non-blocking on the event loop.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: Node.js searches in this order:

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: Sanitize user inputs and outputs. Use libraries like DOMPurify for front-end. Use HTTP headers like Content Security Policy (CSP) via Helmet. Escape data before rendering in HTML.

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: Global objects are available in all modules without the need to import them. Examples include: __dirname: Directory name of the current module __filename: Full path of the current module global: Similar to window in browsers process: Provides info about the current Node.js process setTimeout, setInterval, etc.

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: Always hash passwords before storing (never store plaintext). Use strong, slow hashing algorithms like bcrypt, argon2, or scrypt. Add a salt to each password (bcrypt does this automatically). Use libraries like bcrypt: const bcrypt = require('bcrypt');

Example code

const hash = await bcrypt.hash(password, 10); When verifying: const match = await bcrypt.compare(inputPassword, storedHash); Database Integration

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: Avoid blocking the event loop. Use asynchronous APIs. Use clustering or worker threads. Cache results where possible. Profile and fix bottlenecks. Use load balancers for scaling horizontally.

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: const EventEmitter = require('events'); const emitter = new EventEmitter(); emitter.on('greet', (name) => { console.log(`Hello, ${name}!`); }); emitter.emit('greet', 'Alice'); // Output: Hello, Alice!

Example code

const EventEmitter = require('events');
const emitter = new EventEmitter(); emitter.on('greet', (name) => { console.log(`Hello, ${name}!`); }); emitter.emit('greet', 'Alice'); // Output: Hello, Alice!

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: Local Installation (default): Installs the package into the node_modules folder of your current project. npm install lodash ✅ Used when the package is needed as part of your app's code. Global Installation: Installs the package system-wide, making it available in the command line anywhere. npm install -g nodemon ✅ Used for tools/CLI apps like nodemon, eslint, typescript, etc.

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: Clustering runs multiple Node.js instances on different CPU cores sharing the same server port. This spreads load and uses full CPU capacity, increasing concurrency.

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: Node.js uses a single-threaded event loop to handle many I/O operations asynchronously, allowing it to handle thousands of concurrent connections efficiently without creating threads per connection.

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: Deploy multiple instances on different machines or containers. Use a load balancer to distribute traffic. Share state externally (e.g., Redis) since instances are stateless.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: llowing it to handle thousands of concurrent connections efficiently without creating threads per connection.

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: Global variables holding references. Event listeners not removed. Closures holding onto variables. Caches growing without limits. Security & Best Practices

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: To update all packages to their latest safe versions based on semver: npm update To update a specific package to its latest version: npm install express@latest For a more interactive way: npx npm-check-updates -u npm install ✅ The npm-check-updates tool helps update versions in your package.json.

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: You can create a custom module by writing logic in a separate .js file and exporting it using module.exports.

Explain a bit more

📌 Example: mathUtils.js function add(a, b) { return a + b; module.exports = { add, subtract }; app.js const math = require('./mathUtils'); console.log(math.add(5, 3)); // 8 console.log(math.subtract(9, 4)); // 5 ✅ This is how you break your code into reusable pieces (modules) in Node.js. REST API Development in Node.js

Example code

} function subtract(a, b) { return a - b;
}

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: Use rate limiting. Validate and sanitize inputs. Avoid blocking event loop. Use security middleware like helmet. Use a reverse proxy with DDoS protection.

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: pp.js const math = require('./mathUtils'); console.log(math.add(5, 3)); // 8 console.log(math.subtract(9, 4)); // 5 ✅ This is how you break your code into reusable pieces (modules) in Node.js. REST API Development in Node.js pp.js const math = require('./mathUtils'); console.log(math.add(5, 3)); // 8 console.log(math.subtract(9, 4)); // 5 ✅ This is how you break your code into reusable pieces (modules) in Node.js.

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Node.js Node.js Tutorial · Node.js

Short answer: Strip out dangerous characters. Use libraries like validator.js. Escape output in HTML contexts.

Real-world example (ShopNest)

A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
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