Unit4 - Subjective Questions

INT219 • Practice Questions with Detailed Answers

1

Explain the structure of the Document Object Model (DOM) and describe how it represents an HTML document.

2

Differentiate between querySelector and getElementById methods in JavaScript. Provide examples for each.

3

Describe the process of creating a new HTML element and appending it to the DOM using JavaScript.

4

Compare innerHTML, innerText, and textContent. Which one is safer to use and why?

5

Explain the concept of Event Propagation, specifically detailing the difference between 'Bubbling' and 'Capturing'.

6

What is 'Event Delegation'? Explain its advantages with a practical scenario.

7

How can you modify the styles of a DOM element using JavaScript? Discuss style property vs. classList.

8

Explain the significance of preventDefault() and stopPropagation() methods in event handling.

9

What are Browser Developer Tools? Describe the utility of the 'Elements' and 'Console' tabs.

10

Explain how to debug JavaScript code using breakpoints in the 'Sources' (or 'Debugger') panel of browser developer tools.

11

What is DOM Traversal? List and explain three properties used to traverse the DOM tree relative to a selected node.

12

What is Module Bundling? Why is it essential in modern front-end development?

13

Explain the concepts of 'Tree Shaking' and 'Minification' in the context of build tools.

14

What is Code Linting? How does ESLint help developers maintain code quality?

15

Distinguish between Code Linting (e.g., ESLint) and Code Formatting (e.g., Prettier).

16

Explain the use of dataset in JavaScript to handle custom data attributes in HTML.

17

Discuss the performance implications of frequent DOM manipulation. What is 'Reflow' and 'Repaint'?

18

How does a 'DocumentFragment' improve DOM manipulation efficiency? Provide an example.

19

Describe the modern development workflow involving 'transpiling'. Why is Babel commonly used?

20

Write a short note on how to programmatically remove an element from the DOM using old vs. modern methods.