Web Services Development MCQs with Answers
Practice important Web Services Development MCQs with answers and explanations.
Multiple Choice Questions
Q391: Which property is used to retrieve the text value of a text node in the DOM?
- A: nodeType
- B: nodeValue
- C: childNodeValue
- D: textContent
View Answer
B
Q392: To change the value of a text node, you can use the ____________ method in the DOM.
- A: setTextValue()
- B: setNodeValue()
- C: nodeValue
- D: replaceData()
View Answer
C
Q393: Fill in the blank: The getElementsByTagName() method returns a ____________ of all elements with the specified tag.
- A: string
- B: node list
- C: array
- D: object
View Answer
B
Q394: What method is used to remove an attribute from an element in the DOM?
- A: removeChild()
- B: removeNode()
- C: removeAttribute()
- D: clearAttribute()
View Answer
C
Q395: The replaceData() method takes three parameters: ____________, ____________, and ____________.
- A: tagName, attribute, value
- B: offset, length, string
- C: index, name, value
- D: nodeName, text, string
View Answer
B
Q396: Fill in the blank: The setAttribute() method ____________ an attribute if it does not already exist.
- A: changes
- B: updates
- C: creates
- D: removes
View Answer
C
Q397: What happens to child nodes when a parent node is removed in the DOM?
- A: They remain in the DOM
- B: They are also removed
- C: They are moved to a new parent
- D: Nothing happens to them
View Answer
B
Q398: Which method is used to remove all attributes of an element in the DOM?
- A: removeAttribute()
- B: removeAttributeNode()
- C: removeAllAttributes()
- D: clearAttributes()
View Answer
B
Q399: To replace the text in a text node, the DOM uses which method?
- A: replaceChild()
- B: setTextNode()
- C: replaceData()
- D: changeTextNode()
View Answer
C
Q400: Fill in the blank: The replaceChild() method replaces a specified node with a ____________.
- A: new node
- B: new attribute
- C: new element node
- D: new text node
View Answer
A