Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Chapter 14
Chapter 6 quiz
10 questions · instant feedback after each answer.
1.
What does DOM stand for?
Correct answer: A. DOM = Document Object Model — a programming interface that represents an HTML/XML document as a tree of objects.
2.
What is the top-level node of the DOM?
Correct answer: B. The document object is the root node and represents the entire page. window is the outermost BOM object.
3.
Which method finds a single element by its id?
Correct answer: B. getElementById() returns the one element whose id matches; it returns null if not found.
4.
Which method returns all elements matching a CSS selector?
Correct answer: B. querySelectorAll() selects all elements matching a CSS selector and returns a static NodeList.
5.
Which property gets or sets an element HTML content?
Correct answer: B. innerHTML gets or sets the HTML content of an element and is preferred over document.write() after page load.
6.
Which is the recommended modern way to attach an event handler?
Correct answer: C. addEventListener() lets you attach multiple handlers, keeps JS separate from HTML, and supports clean removal.
7.
Which event fires when the page has finished loading?
Correct answer: C. The load event (onload) fires when the document has fully loaded — ideal for initialisation code.
8.
What should a form validation function return to prevent submission?
Correct answer: B. Return false from the onsubmit handler to stop the form from being submitted.
9.
Which node type represents the text inside an element?
Correct answer: B. The text content inside an element is a text node. Elements, attributes and comments have their own node types.
10.
Which BOM object represents the browser window?
Correct answer: B. The window object is the most important BOM object; all global variables and functions are its properties.
Your score
0/0