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 3901–3925 of 4608

Career & HR topics

By tech stack

Popular tracks

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
Junior PDF
What is dotenv and how is it used?

Short answer: dotenv is a library to load environment variables from a .env file into process.env. Real-world example (ShopNest) A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront. Say t…

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

Short answer: 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…

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
Junior PDF
What is the role of nodemon?

Short 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 Real…

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
Junior PDF
What is the difference between synchronous and asynchronous functions?

Short answer: 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…

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
Junior PDF
What is CSRF and how do you protect against it?

Short answer: CSRF (Cross-Site Request Forgery) tricks a user into submitting unwanted requests to a trusted site. Protection: Use CSRF tokens with forms (e.g., csurf middleware in Express). Implement same-site cookies.…

Node.js Read answer
Junior PDF
What is the util.promisify() function?

Short answer: util.promisify() converts traditional Node.js callback-style functions into functions that return promises — letting you use async/await with them. Example code const util = require('util'); const fs = requ…

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

Short 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. Real-world example (ShopNest) A ShopNest BFF in Node.js aggregates ca…

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

Short answer: 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 ap…

Node.js Read answer
Junior PDF
What is the util.promisify() function?

Short answer: sync function read() { const content = await readFile('file.txt', 'utf8'); console.log(content); } sync function read() { const content = await readFile('file.txt', 'utf8'); console.log(content); } sync fun…

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

Short answer: process is a global object that provides information and control over the current Node.js process. 📌 Examples: console.log(process.pid); // Process ID console.log(process.platform); // OS platform You can…

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
Junior PDF
What is the difference between spawn() and exec()?

Short answer: Both create child processes, but: spawn() streams data (good for large outputs) exec() buffers data (good for small outputs) const { spawn, exec } = require('child_process'); // spawn example const ls = spa…

Node.js Read answer
Junior PDF
What is the use of __dirname and __filename?

Short answer: __dirname: Returns the directory path of the current module. __filename: Returns the full file path of the current module. 📌 Example code console.log(__dirname); // /Users/yourname/project console.log(__fi…

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
Junior PDF
What is the EventEmitter class in Node.js?

Short answer: EventEmitter is a core class that allows objects to emit named events and register listeners to respond. Real-world example (ShopNest) A ShopNest BFF in Node.js aggregates catalog and price APIs for the Rea…

Node.js Read answer
Junior PDF
What is NPM?

Short answer: NPM stands for Node Package Manager. It is the default package manager for Node.js and is used to install, share, and manage reusable packages or libraries. It comes pre-installed with Node.js and gives you…

Node.js Read answer
Junior PDF
What is event loop blocking, and how do you detect it?

Short answer: Blocking happens when synchronous code takes too long, preventing other events from processing. Detect with tools like: clinic.js — Event Loop Delay tool. Manual timing (setInterval to check delay). Real-wo…

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

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: dotenv is a library to load environment variables from a .env file into process.env.

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: 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

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: 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

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: 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); });

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: 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: CSRF (Cross-Site Request Forgery) tricks a user into submitting unwanted requests to a trusted site. Protection: Use CSRF tokens with forms (e.g., csurf middleware in Express). Implement same-site cookies. Require authentication on sensitive endpoints.

Example code

const csurf = require('csurf'); app.use(csurf());

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: util.promisify() converts traditional Node.js callback-style functions into functions that return promises — letting you use async/await with them.

Example code

const util = require('util');
const fs = require('fs');
const readFile = util.promisify(fs.readFile);
async function read() {
const content = await readFile('file.txt', 'utf8'); console.log(content); }

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: 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.

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: 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:

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 read() { const content = await readFile('file.txt', 'utf8'); console.log(content); } sync function read() { const content = await readFile('file.txt', 'utf8'); console.log(content); } sync function read() { const content = await readFile('file.txt', 'utf8'); console.log(content); } sync function read() { const content = await… readFile('file.txt', 'utf8'); console.log(content); }

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: process is a global object that provides information and control over the current Node.js process. 📌 Examples: console.log(process.pid); // Process ID console.log(process.platform); // OS platform You can also handle exit events: process.on('exit', () => { console.log('Exiting...'); });

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: Both create child processes, but: spawn() streams data (good for large outputs) exec() buffers data (good for small outputs) const { spawn, exec } = require('child_process'); // spawn example const ls = spawn('ls', ['-lh', '/usr']);

Example code

ls.stdout.on('data', (data) => console.log(`Output: ${data}`)); // exec example exec('ls -lh /usr', (error, stdout) => console.log(stdout));

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: __dirname: Returns the directory path of the current module. __filename: Returns the full file path of the current module. 📌

Example code

console.log(__dirname); // /Users/yourname/project console.log(__filename); // /Users/yourname/project/app.js These are very useful for reading or writing files relative to the script's location. PM and Module Management

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: EventEmitter is a core class that allows objects to emit named events and register listeners to respond.

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: NPM stands for Node Package Manager. It is the default package manager for Node.js and is used to install, share, and manage reusable packages or libraries. It comes pre-installed with Node.js and gives you access to a huge ecosystem of open-source tools. 📌 Example Use: npm install express This command downloads the Express.js library into your project. ✅ NPM also: Manages package versions Handles dependencies…

Explain a bit more

Supports scripts to automate tasks (npm run build, npm test, 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: Blocking happens when synchronous code takes too long, preventing other events from processing. Detect with tools like: clinic.js — Event Loop Delay tool. Manual timing (setInterval to check delay).

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: 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
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