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 51–75 of 126

Career & HR topics

By tech stack

Junior PDF
What is an event listener?

Short answer: An event listener waits for user actions (like clicks or keypresses) and runs a function when the event occurs. Example code button.addEventListener("click", () => alert("Clicked!"));…

JavaScript Read answer
Junior PDF
What is overflow in CSS?

Short answer: Controls what happens when content exceeds the container’s size. Values: visible (default) hidden scroll auto Example code div { overflow: auto; } Key Takeaway: overflow: auto adds scrollbars only when need…

JavaScript Read answer
Junior PDF
What is the role of the <form> tag?

Short answer: It collects user input and sends it to a server or script for processing. Example code &lt;form action=&quot;/submit&quot; method=&quot;POST&quot;&gt; &lt;input type=&quot;text&quot; name=&quot;username&quo…

JavaScript Read answer
Junior PDF
What is function scope?

Short answer: Variables declared inside a function are accessible only within that function. Example code function demo() { let x = 10; console.log(x); // 10 } console.log(x); // ReferenceError Real-world example (ShopNe…

JavaScript Read answer
Junior PDF
What is the difference between null and undefined?

Short answer: ssigned Follow me on LinkedIn: 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 Define…

JavaScript Read answer
Junior PDF
What is the difference between null and undefined?

Short answer: Type Meaning null Intentional absence of value undefin ed Variable declared but not assigned Follow me on LinkedIn: Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch APIs w…

JavaScript Read answer
Junior PDF
What is the difference between padding and margin?

Short answer: Property Location Affects Background? Padding Inside border ✅ Yes Margin Outside border ❌ No Example code div { Follow me on LinkedIn: margin: 10px; padding: 20px; } Key Takeaway: Padding = inner spacing, M…

JavaScript Read answer
Junior PDF
What is the purpose of the <picture> tag?

Short answer: &lt;picture&gt; allows serving different image versions depending on device, screen size, or media type. Example code &lt;picture&gt; &lt;source srcset=&quot;photo-large.jpg&quot; media=&quot;(min-width: 80…

JavaScript Read answer
Junior PDF
What is the difference between <header> and <head>?

Short answer: &lt;head&gt; holds metadata (title, styles, scripts). &lt;header&gt; defines the visible top section of the page (logo, navigation, heading). Example code &lt;head&gt; &lt;title&gt;My Portfolio&lt;/title&gt…

JavaScript Read answer
Junior PDF
What is block scope?

Short answer: Variables declared with let or const inside curly braces {} are accessible only within that block. Example: if (true) { let y = 20; const z = 30; } // console.log(y, z); // ReferenceError Example code Varia…

JavaScript Read answer
Junior PDF
What is debouncing and throttling?

Short answer: Follow me on LinkedIn: Debouncing: Executes a function after a delay of no activity. Throttling: Executes a function at regular intervals. Example (debounce): function debounce(fn, delay) { let timer; retur…

JavaScript Read answer
Junior PDF
What is the difference between static and dynamic typing?

Short answer: Static typing: Variable types are known at compile-time (e.g., TypeScript, Java). Dynamic typing: Types are determined at runtime (JavaScript). Example: let x = 10; // number Example code x = &quot;text&quo…

JavaScript Read answer
Junior PDF
What is NaN?

Short answer: NaN stands for “Not-a-Number”, representing an invalid numeric operation. Example: console.log(&quot;hello&quot; / 2); // NaN Example code NaN stands for “Not-a-Number”, representing an invalid numeric oper…

JavaScript Read answer
Junior PDF
What is object-fit in CSS?

Short answer: Defines how images or videos resize within their container. Follow me on LinkedIn: Example code img { width: 100%; height: 300px; object-fit: cover; } Key Takeaway: cover fills the box; contain fits the who…

JavaScript Read answer
Junior PDF
What is the difference between call stack and task queue?

Short answer: Call stack: Where function execution happens (synchronous). Task queue: Holds async callbacks (processed after stack is empty). Example code console.log(&quot;1&quot;); setTimeout(() =&gt; console.log(&quot…

JavaScript Read answer
Junior PDF
What is the typeof operator?

Short answer: Used to find the type of a variable. typeof &quot;Hello&quot;; // &quot;string&quot; typeof 10; // &quot;number&quot; typeof null; // &quot;object&quot; (bug) Example code Used to find the type of a variabl…

JavaScript Read answer
Junior PDF
What is a CSS class selector?

Short answer: Targets elements with a specific class attribute. Example code .card { background-color: lightgray; } &lt;div class=&quot;card&quot;&gt;Profile&lt;/div&gt; Follow me on LinkedIn: Key Takeaway: Classes are r…

JavaScript Read answer
Junior PDF
What is event bubbling and capturing?

Short answer: When an event occurs in a nested element: Bubbling: Event moves upward (child → parent). Capturing: Event moves downward (parent → child). Example code element.addEventListener('click', handler, true); // c…

JavaScript Read answer
Junior PDF
What is the difference between regular function and arrow function?

Short answer: Feature Regular Function Arrow Function this Dynamic Lexical (inherits from parent) Syntax function f(){} (a,b)=&gt;a+b Can be used as constructor ✅ ❌ Example code Feature Regular Function Arrow Function th…

JavaScript Read answer
Junior PDF
What is functional programming in JavaScript?

Short answer: A style where functions are pure, stateless, and composable. Example: const double = x =&gt; x * 2; const square = x =&gt; x * x; const result = square(double(3)); // 36 Example code A style where functions…

JavaScript Read answer
Junior PDF
What is the difference between shallow copy and deep copy?

Short answer: Type Description Shallow Copy Copies top-level properties only Deep Copy Copies all nested objects too Follow me on LinkedIn: Example: const obj = { a: { b: 1 } }; Example code const shallow = { ...obj }; /…

JavaScript Read answer
Junior PDF
What is the difference between em and rem units?

Short answer: Unit Relative To Example em Parent’s font size 2em = 2 × parent font-size rem Root (&lt;html&gt;) font size 2rem = 2 × root font-size Example code html { font-size: 16px; } p { font-size: 2rem; } /* = 32px…

JavaScript Read answer
Junior PDF
What is the use of the alt attribute in images?

Short answer: The alt attribute provides alternative text when an image fails to load and is read by screen readers. Example code Follow me on LinkedIn: &lt;img src=&quot;team.jpg&quot; alt=&quot;Our development team&quo…

JavaScript Read answer
Junior PDF
What is a higher-order function?

Short answer: A function that accepts another function as a parameter or returns a function. Example: function multiplyBy(factor) { return x =&gt; x * factor; } const double = multiplyBy(2); console.log(double(5)); // 10…

JavaScript Read answer
Junior PDF
What is a promise chain?

Short answer: Promise chaining allows multiple async tasks to run sequentially. Example code fetch('/data') .then(res =&gt; res.json()) .then(data =&gt; console.log(data)) .catch(err =&gt; console.error(err)); Real-world…

JavaScript Read answer

JavaScript JavaScript Tutorial · JavaScript

Short answer: An event listener waits for user actions (like clicks or keypresses) and runs a function when the event occurs.

Example code

button.addEventListener("click", () => alert("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: Controls what happens when content exceeds the container’s size. Values: visible (default) hidden scroll auto

Example code

div { overflow: auto; } Key Takeaway: overflow: auto adds scrollbars only when needed.

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: It collects user input and sends it to a server or script for processing.

Example code

<form action="/submit" method="POST"> <input type="text" name="username"> <button type="submit">Submit</button> </form> Key Takeaway: Forms are the foundation of user interaction on the web.

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: Variables declared inside a function are accessible only within that function.

Example code

function demo() { let x = 10; console.log(x); // 10 } console.log(x); // ReferenceError

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: ssigned Follow me on LinkedIn:

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: Type Meaning null Intentional absence of value undefin ed Variable declared but not assigned Follow me on LinkedIn:

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: Property Location Affects Background? Padding Inside border ✅ Yes Margin Outside border ❌ No

Example code

div { Follow me on LinkedIn: margin: 10px; padding: 20px; } Key Takeaway: Padding = inner spacing, Margin = outer spacing.

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: <picture> allows serving different image versions depending on device, screen size, or media type.

Example code

<picture> <source srcset="photo-large.jpg" media="(min-width: 800px)"> <source srcset="photo-small.jpg" media="(max-width: 799px)"> <img src="photo-default.jpg" alt="Beautiful landscape"> </picture> Key Takeaway: Use <picture> for art direction — showing different images per device or context.

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: <head> holds metadata (title, styles, scripts). <header> defines the visible top section of the page (logo, navigation, heading).

Example code

<head> <title>My Portfolio</title> </head> <header> <h1>Welcome to My Portfolio</h1> </header> Follow me on LinkedIn: Key Takeaway: <head> = document info; <header> = visible header area.

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: Variables declared with let or const inside curly braces {} are accessible only within that block. Example: if (true) { let y = 20; const z = 30; } // console.log(y, z); // ReferenceError

Example code

Variables declared with let or const inside curly braces {} are accessible only within that block. Example: if (true) {
let y = 20;
const z = 30;
} // console.log(y, z); // ReferenceError

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: Follow me on LinkedIn: Debouncing: Executes a function after a delay of no activity. Throttling: Executes a function at regular intervals. Example (debounce): function debounce(fn, delay) { let timer; return (...args) => { clearTimeout(timer); timer = setTimeout(() => fn(...args), delay); }; }

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 typing: Variable types are known at compile-time (e.g., TypeScript, Java). Dynamic typing: Types are determined at runtime (JavaScript). Example: let x = 10; // number

Example code

x = "text"; // allowed

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: NaN stands for “Not-a-Number”, representing an invalid numeric operation. Example: console.log("hello" / 2); // NaN

Example code

NaN stands for “Not-a-Number”, representing an invalid numeric operation. Example: console.log("hello" / 2); // NaN

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: Defines how images or videos resize within their container. Follow me on LinkedIn:

Example code

img { width: 100%; height: 300px; object-fit: cover; } Key Takeaway: cover fills the box; contain fits the whole image inside.

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: Call stack: Where function execution happens (synchronous). Task queue: Holds async callbacks (processed after stack is empty).

Example code

console.log("1"); setTimeout(() => console.log("2"), 0); console.log("3"); // Output: 1, 3, 2 Follow me on LinkedIn:

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: Used to find the type of a variable. typeof "Hello"; // "string" typeof 10; // "number" typeof null; // "object" (bug)

Example code

Used to find the type of a variable. typeof "Hello"; // "string" typeof 10; // "number" typeof null; // "object" (bug)

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: Targets elements with a specific class attribute.

Example code

.card { background-color: lightgray; } <div class="card">Profile</div> Follow me on LinkedIn: Key Takeaway: Classes are reusable; use them for consistent styling across 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: When an event occurs in a nested element: Bubbling: Event moves upward (child → parent). Capturing: Event moves downward (parent → child).

Example code

element.addEventListener('click', handler, true); // capturing element.addEventListener('click', handler, false); // 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: Feature Regular Function Arrow Function this Dynamic Lexical (inherits from parent) Syntax function f(){} (a,b)=>a+b Can be used as constructor ✅ ❌

Example code

Feature Regular Function Arrow Function this Dynamic Lexical (inherits from parent) Syntax function f(){} (a,b)=>a+b Can be used as constructor ✅ ❌

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: A style where functions are pure, stateless, and composable. Example: const double = x => x * 2; const square = x => x * x; const result = square(double(3)); // 36

Example code

A style where functions are pure, stateless, and composable. Example: const double = x => x * 2;
const square = x => x * x;
const result = square(double(3)); // 36

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: Type Description Shallow Copy Copies top-level properties only Deep Copy Copies all nested objects too Follow me on LinkedIn: Example: const obj = { a: { b: 1 } };

Example code

const shallow = { ...obj }; // same reference
const deep = JSON.parse(JSON.stringify(obj)); // new copy

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: Unit Relative To Example em Parent’s font size 2em = 2 × parent font-size rem Root (<html>) font size 2rem = 2 × root font-size

Example code

html { font-size: 16px; } p { font-size: 2rem; } /* = 32px */ Key Takeaway: Use rem for consistent sizing across the document.

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: The alt attribute provides alternative text when an image fails to load and is read by screen readers.

Example code

Follow me on LinkedIn: <img src="team.jpg" alt="Our development team"> Key Takeaway: Always include meaningful alt text — it’s good for accessibility and SEO.

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: A function that accepts another function as a parameter or returns a function. Example: function multiplyBy(factor) { return x => x * factor; } const double = multiplyBy(2); console.log(double(5)); // 10

Example code

A function that accepts another function as a parameter or returns a function. Example: function multiplyBy(factor) { return x => x * factor;
}
const double = multiplyBy(2); console.log(double(5)); // 10

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: Promise chaining allows multiple async tasks to run sequentially.

Example code

fetch('/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
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