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 2501–2525 of 4608

Career & HR topics

By tech stack

Popular tracks

Junior PDF
What is the constructor method?

Short answer: The constructor is a special method for initializing new objects created from a class. Example: class Car { constructor(brand, model) { this.brand = brand; this.model = model; } } Example code The construct…

JavaScript Read answer
Junior PDF
What is the difference between class and function constructor?

Short answer: Feature Function Constructor Class Syntax function Person(){} class Person{} Hoisting Yes, function declarations are hoisted No, classes are not hoisted new required Recommended Required Real-world example…

JavaScript Read answer
Mid PDF
How does inheritance work with classes?

Short answer: Classes support extends to create a subclass that inherits properties and methods from a parent class. Example: class Animal { speak() { console.log("Animal speaks"); } } class Dog extends Animal…

JavaScript Read answer
Junior PDF
What is super()?

Short answer: super() calls the parent class constructor. Must be called before using this in subclass. Example: class Animal { Example code constructor(name) { this.name = name; } } class Dog extends Animal { constructo…

JavaScript Read answer
Mid PDF
What are static methods?

Short answer: Static methods are called on the class itself, not on instances. Example code class MathUtils { static square(x) { return x * x; } } console.log(MathUtils.square(5)); // 25 Real-world example (ShopNest) Sho…

JavaScript Read answer
Mid PDF
Can you use getters and setters in classes?

Short answer: Yes, getters and setters control access to object properties. Example: class Person { Example code constructor(name) { this._name = name; } get name() { return this._name; } set name(value) { this._name = v…

JavaScript Read answer
Junior PDF
What is asynchronous programming?

Short answer: Allows non-blocking execution, letting other code run while waiting for tasks (e.g., network requests). Say this in the interview Define — one clear sentence (the short answer above). Example — relate it to…

JavaScript Read answer
Mid PDF
What are callbacks?

Short answer: Functions passed as arguments to run after another function completes. Example: setTimeout(() => console.log("Hello after 1s"), 1000); Example code Functions passed as arguments to run after an…

JavaScript Read answer
Junior PDF
What is callback hell?

Short answer: Nested callbacks causing hard-to-read code. Solution: Use Promises or async/await. Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and cle…

JavaScript Read answer
Junior PDF
What is a Promise?

Short answer: n object representing future completion or failure of an async task. Real-world example (ShopNest) The checkout button uses async/await to call /api/orders , shows a spinner, and catches network errors with…

JavaScript Read answer
Mid PDF
States of a Promise:?

Short answer: pending fulfilled rejected Real-world example (ShopNest) The checkout button uses async/await to call /api/orders , shows a spinner, and catches network errors with a toast. Say this in the interview Define…

JavaScript Read answer
Mid PDF
How do you chain Promises?

Short answer: fetch('/api/data') .then(res => res.json()) .then(data => console.log(data)) .catch(err => console.error(err)); Example code fetch('/api/data') .then(res => res.json()) .then(data => console.…

JavaScript Read answer
Junior PDF
What is async / await?

Short answer: sync function fetchData() { try { const res = await fetch('/api/data'); const data = await res.json(); console.log(data); } catch (err) { console.error(err); } } sync function fetchData() { try { const res…

JavaScript Read answer
Junior PDF
What is async / await?

Short answer: Syntactic sugar over Promises for cleaner asynchronous code. async function fetchData() { try { const res = await fetch('/api/data'); const data = await res.json(); console.log(data); } catch (err) { consol…

JavaScript Read answer
Mid PDF
Difference between Promise.all and Promise.race:?

Short answer: Promise.all – waits for all promises to resolve Promise.race – resolves/rejects as soon as one completes Real-world example (ShopNest) The checkout button uses async/await to call /api/orders , shows a spin…

JavaScript Read answer
Junior PDF
What is an event loop?

Short answer: Mechanism that manages async callbacks and executes them after the call stack is empty. Real-world example (ShopNest) The checkout button uses async/await to call /api/orders , shows a spinner, and catches…

JavaScript Read answer
Mid PDF
Call stack vs Microtask queue vs Macrotask queue:?

Short answer: Call stack: executes synchronous code Microtask queue: handles Promises Macrotask queue: handles setTimeout, I/O, etc. Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch API…

JavaScript Read answer
Junior PDF
What is an event in JavaScript?

Short answer: n action like click, load, input, keypress. Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling. Say this in the inte…

JavaScript Read answer
Mid PDF
How do you handle events?

Short answer: button.addEventListener('click', () => console.log('Clicked!')); button.addEventListener('click', () => console.log('Clicked!')); button.addEventListener('click', () => console.log('Clicked!')); bu…

JavaScript Read answer
Junior PDF
What is event delegation?

Short answer: ttach a listener to a parent to handle events on child elements. Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.…

JavaScript Read answer
Mid PDF
What are preventDefault() and stopPropagation()?

Short answer: preventDefault() – stops default browser action stopPropagation() – stops event bubbling Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, a…

JavaScript Read answer
Junior PDF
What is error handling?

Short answer: Catching and managing runtime errors to prevent app crashes. Explain a bit more Catching and managing runtime errors to prevent app crashes. Catching and managing runtime errors to prevent app crashes. Catc…

JavaScript Read answer
Junior PDF
What is try…catch?

Short answer: Blocks to handle exceptions. try { JSON.parse("invalid"); } catch(e) { console.error(e); } Example code Blocks to handle exceptions. try { JSON.parse("invalid"); } catch(e) { console.err…

JavaScript Read answer
Junior PDF
What is finally block?

Short answer: Runs always, whether error occurs or not. Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling. Say this in the interv…

JavaScript Read answer
Mid PDF
How do you create a custom error?

Short answer: class ValidationError extends Error { } throw new ValidationError("Invalid input"); Example code class ValidationError extends Error { } throw new ValidationError("Invalid input"); Real-…

JavaScript Read answer

JavaScript JavaScript Tutorial · JavaScript

Short answer: The constructor is a special method for initializing new objects created from a class. Example: class Car { constructor(brand, model) { this.brand = brand; this.model = model; } }

Example code

The constructor is a special method for initializing new objects created from a class. Example: class Car { constructor(brand, model) { this.brand = brand;
this.model = model;
}
}

Real-world example (ShopNest)

In ShopNest’s cart UI, a click handler closes over productId. Use let in loops so each button keeps the correct id.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: Feature Function Constructor Class Syntax function Person(){} class Person{} Hoisting Yes, function declarations are hoisted No, classes are not hoisted new required Recommended Required

Real-world example (ShopNest)

In ShopNest’s cart UI, a click handler closes over productId. Use let in loops so each button keeps the correct id.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: Classes support extends to create a subclass that inherits properties and methods from a parent class. Example: class Animal { speak() { console.log("Animal speaks"); } } class Dog extends Animal { speak() { console.log("Dog barks"); } } const dog = new Dog(); dog.speak(); // Dog barks

Example code

Classes support extends to create a subclass that inherits properties and methods from a parent class. Example: class Animal { speak() { console.log("Animal speaks"); } }
class Dog extends Animal { speak() { console.log("Dog barks"); } }
const dog = new Dog(); dog.speak(); // Dog barks

Real-world example (ShopNest)

ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: super() calls the parent class constructor. Must be called before using this in subclass. Example: class Animal {

Example code

constructor(name) { this.name = name; }
}
class Dog extends Animal { constructor(name, breed) { super(name); this.breed = breed;
}
}

Real-world example (ShopNest)

ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: Static methods are called on the class itself, not on instances.

Example code

class MathUtils { static square(x) { return x * x; } } console.log(MathUtils.square(5)); // 25

Real-world example (ShopNest)

ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: Yes, getters and setters control access to object properties. Example: class Person {

Example code

constructor(name) { this._name = name; } get name() { return this._name; } set name(value) { this._name = value; }
}
const p = new Person("Sandeep"); console.log(p.name); // Sandeep p.name = "Ravi"; console.log(p.name); // Ravi

Real-world example (ShopNest)

ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: Allows non-blocking execution, letting other code run while waiting for tasks (e.g., network requests).

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: Functions passed as arguments to run after another function completes. Example: setTimeout(() => console.log("Hello after 1s"), 1000);

Example code

Functions passed as arguments to run after another function completes. Example: setTimeout(() => console.log("Hello after 1s"), 1000);

Real-world example (ShopNest)

ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: Nested callbacks causing hard-to-read code. Solution: Use Promises or async/await.

Real-world example (ShopNest)

ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: n object representing future completion or failure of an async task.

Real-world example (ShopNest)

The checkout button uses async/await to call /api/orders, shows a spinner, and catches network errors with a toast.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: pending fulfilled rejected

Real-world example (ShopNest)

The checkout button uses async/await to call /api/orders, shows a spinner, and catches network errors with a toast.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: fetch('/api/data') .then(res => res.json()) .then(data => console.log(data)) .catch(err => console.error(err));

Example code

fetch('/api/data') .then(res => res.json()) .then(data => console.log(data)) .catch(err => console.error(err));

Real-world example (ShopNest)

The checkout button uses async/await to call /api/orders, shows a spinner, and catches network errors with a toast.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: sync function fetchData() { try { const res = await fetch('/api/data'); const data = await res.json(); console.log(data); } catch (err) { console.error(err); } } sync function fetchData() { try { const res = await fetch('/api/data'); const data = await res.json(); console.log(data); } catch (err) { console.error(err); } }… sync function fetchData() { try {… const res = await fetch('/api/data'); const data = await…

Explain a bit more

res.json(); console.log(data); } catch (err) { console.error(err); } } sync function fetchData() { try { const res = await fetch('/api/data'); const data = await res.json(); console.log(data); } catch (err) { console.error(err); } }…

Real-world example (ShopNest)

The checkout button uses async/await to call /api/orders, shows a spinner, and catches network errors with a toast.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: Syntactic sugar over Promises for cleaner asynchronous code. async function fetchData() { try { const res = await fetch('/api/data'); const data = await res.json(); console.log(data); } catch (err) { console.error(err); } }

Example code

Syntactic sugar over Promises for cleaner asynchronous code. async function fetchData() { try { const res = await fetch('/api/data');
const data = await res.json(); console.log(data); } catch (err) { console.error(err); } }

Real-world example (ShopNest)

The checkout button uses async/await to call /api/orders, shows a spinner, and catches network errors with a toast.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: Promise.all – waits for all promises to resolve Promise.race – resolves/rejects as soon as one completes

Real-world example (ShopNest)

The checkout button uses async/await to call /api/orders, shows a spinner, and catches network errors with a toast.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: Mechanism that manages async callbacks and executes them after the call stack is empty.

Real-world example (ShopNest)

The checkout button uses async/await to call /api/orders, shows a spinner, and catches network errors with a toast.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: Call stack: executes synchronous code Microtask queue: handles Promises Macrotask queue: handles setTimeout, I/O, etc.

Real-world example (ShopNest)

ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: n action like click, load, input, keypress.

Real-world example (ShopNest)

ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: button.addEventListener('click', () => console.log('Clicked!')); button.addEventListener('click', () => console.log('Clicked!')); button.addEventListener('click', () => console.log('Clicked!')); button.addEventListener('click', () => console.log('Clicked!'));

Real-world example (ShopNest)

ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: ttach a listener to a parent to handle events on child elements.

Real-world example (ShopNest)

ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: preventDefault() – stops default browser action stopPropagation() – stops event bubbling

Real-world example (ShopNest)

ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: Catching and managing runtime errors to prevent app crashes.

Explain a bit more

Catching and managing runtime errors to prevent app crashes. Catching and managing runtime errors to prevent app crashes. Catching and managing runtime errors to prevent app crashes. Catching and managing runtime errors to prevent app crashes. Catching and managing runtime errors to prevent app crashes. Catching and managing runtime errors to prevent app crashes. Catching and managing runtime errors to prevent app crashes.

Example code

Catching and managing runtime errors to prevent app crashes. Catching and managing runtime errors to prevent app crashes. Catching and managing runtime errors to prevent app crashes. Catching and managing runtime errors to prevent app crashes. Catching and managing runtime errors to prevent app crashes. Catching and managing runtime errors to prevent app crashes. Catching and managing runtime errors to prevent app crashes. Catching and managing runtime errors to prevent app crashes.

Real-world example (ShopNest)

ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: Blocks to handle exceptions. try { JSON.parse("invalid"); } catch(e) { console.error(e); }

Example code

Blocks to handle exceptions. try { JSON.parse("invalid"); } catch(e) { console.error(e); }

Real-world example (ShopNest)

ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: Runs always, whether error occurs or not.

Real-world example (ShopNest)

ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.

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

JavaScript JavaScript Tutorial · JavaScript

Short answer: class ValidationError extends Error { } throw new ValidationError("Invalid input");

Example code

class ValidationError extends Error { } throw new ValidationError("Invalid input");

Real-world example (ShopNest)

ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.

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