Unit2 - Subjective Questions

INT219 • Practice Questions with Detailed Answers

1

Differentiate between Primitive and Non-Primitive (Reference) data types in JavaScript with examples.

2

Compare var, let, and const keywords in terms of scope, hoisting, and re-assignment.

3

Explain the difference between the Equality Operator (==) and the Strict Equality Operator (===) with respect to type coercion.

4

What is Hoisting in JavaScript? Describe how it affects variable and function declarations differently.

5

Explain the concept of Arrow Functions. How do they differ from traditional functions regarding the this keyword?

6

Describe the Short-Circuit evaluation behavior of the Logical AND (&&) and Logical OR (||) operators.

7

Discuss the Array Higher-Order Methods: map(), filter(), and reduce(). Provide syntax and use cases for each.

8

Explain Destructuring Assignment for Arrays and Objects with examples.

9

What is the DOM (Document Object Model)? Differentiate between the window object and the document object.

10

Explain the concept of Event Propagation in the DOM. Describe Bubbling and Capturing.

11

How do you access HTML elements using JavaScript? Compare getElementById, getElementsByClassName, and querySelector.

12

Explain the Spread Operator (...) and the Rest Parameter (...) in JavaScript with examples.

13

Describe the Control Flow statements: switch vs if-else if. When should you use one over the other?

14

What are Closures in JavaScript? Explain with a code example showing how a function retains access to its lexical scope.

15

Distinguish between the Looping structures: for, for...in, and for...of.

16

What is the role of the event object in Event Handling? Explain event.preventDefault() and event.target.

17

Explain the concept of String Interpolation using Template Literals. How is it different from standard string concatenation?

18

Define Type Coercion in JavaScript. Give examples of implicit coercion that can lead to unexpected results.

19

Explain the interaction methods: alert, prompt, and confirm. What data types do they return?

20

Describe how to manipulate the DOM by creating and appending new elements. Provide a step-by-step code example.