1. What is the reason for avoiding the attributes property in the HTML DOM?
a) Found unnecessary
b) Attributes don’t have attributes
c) Attributes have attributes
d) Considered irrelevant
Explanation: When a web page is loaded, the browser creates a Document Object Model of the page. The reason for avoiding the attributes property in the HTML DOM is because Attributes don’t have attributes.
2. What is the purpose of the method nodeMap.setNamedItem()?
a) Sets ID
b) Sets attribute node
c) Sets element name
d) Sets element type
Explanation: The setNamedItem() method adds the specified node to the NamedNodeMap. The method nodeMap.setNamedItem() sets the specified attribute node (by name).
3. How is everything treated in HTML DOM?
Explanation: The HTML DOM model is constructed as a tree of Objects. In the HTML DOM (Document Object Model), everything is a node:
- The document itself is a document node.
- All HTML elements are element nodes.
- All HTML attributes are attribute nodes.
- Text inside HTML elements are text nodes.
- Comments are comment nodes.
4. What does the NamedNodeMap object represent in the HTML DOM?
a) Unordered collection of elements
b) Unordered collection of attributes
c) Unordered collection of nodes
d) Unordered collection of arrays
Explanation: In the HTML DOM, the NamedNodeMap object represents an unordered collection of an elements attribute nodes. The nodes in the NamedNodeMap can be accessed through their name.
5. What is the purpose of the Attr object in the HTML DOM?
a) Used to focus on a particular part of the HTML page
b) HTML Attribute
c) Used to arrange elements
d) CSS attribute
Explanation: When a web page is loaded, the browser creates a Document Object Model of the page. In the HTML DOM, the Attr object represents an HTML attribute.
6. What is the work of the form control elements in the HTML DOM?
a) User Interface elements
b) All the possible elements
c) Debugging elements
d) Collecting elements
Explanation: Form control elements: The form object contains all the elements defined for that object such as text fields, buttons, radio buttons, and checkboxes. The elements collection returns a collection of all elements in a form.
7. How are the objects organized in the HTML DOM?
Explanation: The HTML DOM model is constructed as a tree of Objects. The objects are organized in the hierarchy format in the HTML DOM.
8. Which of the following is a type of HTML DOM?
a) Legacy DOM
b) W3C DOM
c) IE4 DOM
d) All of the mentioned
Explanation: IE4 document object model was introduced in Version 4 of Microsoft’s Internet Explorer browser. IE 5 and later versions include support for most basic W3C DOM features. All of the above mentioned are types of HTML DOM.
9. What is the purpose of the Legacy DOM?
a) Makes the scripting easier
b) Allows access to few keys and elements
c) Modify the nodes
d) Making the script modular
10. Which object is the top of the hierarchy?
a) Window Object
b) Document Object
c) Form Object
d) Form Control Elements
Explanation: The DOM is arranged in the form of tree with every node as an object. Window object is the top of the hierarchy. It is the outmost element of the object hierarchy.
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Buy Programming Books
- Practice Information Science MCQs
- Practice Programming MCQs
- Practice MCA MCQs