Fsd Module 1 Question Bank
Fsd Module 1 Question Bank
2. What is the difference between primitive and reference data types in JavaScript? Provide
detailed examples to explain how primitive types behave differently from reference types when
assigned to new variables or passed to functions.
3. What are closures in JavaScript, and how do they relate to functions and scopes? How do
closures work with function variables, and what is their significance in maintaining private data
in JavaScript?
4. Explain the difference between synchronous and asynchronous execution in JavaScript. How
do JavaScript functions like `setTimeout`, Promises, and `async/await` affect the execution flow
of the program? Give examples of each.
5. What are the main differences between `==` and `===` operators in JavaScript, and why is
one preferred over the other in most cases?
6. Describe how JavaScript handles memory allocation for primitive and reference types. What
happens when you assign a primitive value to a new variable vs. assigning a reference type like
an array or object? Explain how this affects memory and data manipulation.
7. How do JavaScript arrays differ from objects, and how do you manipulate them? Discuss the
differences in how arrays and objects are constructed and accessed, and explain when to use an
array vs. an object in various programming scenarios.
8. Explain the difference between a function declaration, function expression, and arrow
function in JavaScript. Provide examples and explain how these different function types behave
with respect to hoisting, `this` binding, and execution contexts.
9. What is the "this" keyword in JavaScript, and how is its value determined in different
contexts?
10. How do JavaScript loops work with respect to asynchronous code execution, and what are
some common pitfalls?
Explain the behavior of loops like `for` and `while` when they interact with asynchronous
operations (e.g., promises and `setTimeout`), and how you can avoid common issues like
closures in loops or accessing incorrect values.