Unit3 - Subjective Questions

INT219 • Practice Questions with Detailed Answers

1

Explain the concept of Execution Context in JavaScript and describe its two main phases.

2

Describe the Scope Chain mechanism and how JavaScript resolves variable access in nested functions.

3

Define Closures in JavaScript. Provide a code example demonstrating how a closure preserves data privacy.

4

Differentiate between var, let, and const with respect to Hoisting and Scope. Use a table or bullet points for comparison.

5

Explain the Prototype Chain and how Prototypal Inheritance works in JavaScript compared to Classical Inheritance.

6

Detailed the architecture of the JavaScript Event Loop. How does it handle concurrency despite JavaScript being single-threaded?

7

Distinguish between Microtask and Macrotask queues. Provide an example code snippet where the execution order demonstrates the difference.

8

Explain the concept of Callback Hell and how Promises resolve this issue.

9

What are the three states of a Promise? Explain the syntax and usage of Promise.all().

10

Discuss the Async/Await syntax in ES8. How does it improve asynchronous code readability compared to Promises?

11

Explain Arrow Functions in ES6. specifically focusing on how they handle the this keyword differently than regular functions.

12

Describe ES6 Destructuring for Arrays and Objects with examples. How does it simplify data extraction?

13

Explain the Spread Operator and Rest Parameter ($...$) in JavaScript. Provide use cases for both.

14

Compare ES Modules (import/export) with CommonJS modules. Why are ES Modules preferred in modern frontend development?

15

Define the Temporal Dead Zone (TDZ). Which variable declarations are affected by it and why?

16

Explain the concept of Function Currying using closures. Provide a mathematical example.

17

What are Template Literals in ES6? Explain Tagged Templates with an example.

18

Derive the output of the following code snippet and explain the reasoning based on Event Loop and Scoping.

javascript
for (var i = 0; i < 3; i++) {
setTimeout(() => console.log(i), 1000);
}

How would you fix it to print 0, 1, 2?

19

Explain the usage of Classes in ES6. Are they different from the Prototypal model under the hood?

20

Compare Promise.all(), Promise.allSettled(), and Promise.race(). When would you use each?