411). The central object in a larger API is known as __________
[A]Document Object Material
[B]Document Object Model
[C]Binary Object Model
[D] Data object model
Show Answer
Correct Answer: Document Object Model
Notes:
Answer: b
Explanation: Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document. It is the central object in a larger API, known as the Document Object Model, or DOM, for representing and manipulating document content.
412). The paragraph “p” is a part of __________
[A]h1
[B]body
[C]html
[D] both body and html
Show Answer
Correct Answer: both body and html
Notes:
Answer: d
Explanation: The paragraph tag belongs to both html and body tag. It is used to write paragraph on html pages.
413). The node directly above a node is called __________
[A]sibling
[B]child
[C]parent
[D]ancestors
Show Answer
Correct Answer: parent
Notes:
Answer: c
Explanation: The node directly above a node is the parent of that node. In HTML, the document itself is the parent node of the HTML element, HEAD and BODY are child nodes of the HTML element.
414). The Text and Comment is part of __________
[A]CharacterData
[B]Document
[C]Attr
[D]Element
Show Answer
Correct Answer: CharacterData
Notes:
Answer: a
Explanation: The CharacterData abstract interface represents a Node object that contains characters. This is an abstract interface, meaning there aren’t any object of type CharacterData. The Text and Comment is part of the CharacterData Element.
415). The nodes that represent HTML elements are the __________
[A]Subclass nodes
[B]HTML nodes
[C]Window nodes
[D]Element nodes
Show Answer
Correct Answer: Element nodes
Notes:
Answer: d
Explanation: The nodes that represent HTML elements are Element nodes. The various html elements include h1, p, div etc.
416). Which of the following is/are of Text nodes?
[A]Text
[B]Comment
[C]Both Text and Comment
[D]h1
Show Answer
Correct Answer: Both Text and Comment
Notes:
Answer: c
Explanation: Both Text and Comment are basically strings of text, and these nodes are much like the Text nodes that represent the displaying text of a document.
417). Which is not the way to query a document for an element or elements?
[A]With a specified id attribute
[B]Matching the specified CSS selector
[C]With the specified tag name
[D]without the specified CSS class or classes
Show Answer
Correct Answer: without the specified CSS class or classes
Notes:
Answer: d
Explanation: The DOM defines a number of ways to select elements; you can query a document for an element or elements:
with a specified id attribute;
with a specified name attribute;
with the specified tag name;
with the specified CSS class or classes; or
matching the specified CSS selector
418). Which of the following can be used to select HTML elements based on the value of their name attributes?
[A]getElementByName()
[B]getElementsByName()
[C]getElementsName()
[D]getElementName()
Show Answer
Correct Answer: getElementsByName()
Notes:
Answer: b
Explanation: The getElementsByName() method returns a collection of all elements in the document with the specified name (the value of the name attribute), as a NodeList object.
419). Which of the following property refers to the root element of the document?
[A]documentElement
[B]elementdocument
[C]rootdocument
[D]rootelement
Show Answer
Correct Answer: documentElement
Notes:
Answer: a
Explanation: The documentElement property of the Document class refers to the root element of the document. This is always an HTML element. The documentElement property returns the documentElement of the document, as an Element object.
420). The return type of getElementsByClassName() is __________
[A]DOM
[B]Document
[C]Node
[D]NodeList
Show Answer
Correct Answer: NodeList
Notes:
Answer: d
Explanation: The getElementsByClassName() method returns a collection of all elements in the document with the specified class name, as a NodeList object. The other methods of returning nodelist objects are getElementsByTagName(), getElementbyId() etc.