MIDTERM EXAMINATION - Attempt Review in XML
MIDTERM EXAMINATION - Attempt Review in XML
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 1/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 1
Correct
let size=xmlDoc.getElementsByTagName("author").length;
for (let x=0; x < size; x=x+3){
authorList+=xmlDoc.getElementsByTagName("author")[x].childNodes[0].nodeValue;
}
document.getElementById("demo").innerHTML=authorList
<books>
<book genre="educational">
<year>1965</year>
</book>
<book genre="culture">
<year>1966</year>
</book>
<book genre="computer">
<year>1975</year>
</book>
<book genre="philosophy">
<title lang="en">Philosophy of Man</title>
<author>Jon Mills</author>
<year>1989</year>
</book>
</books>
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 2/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 2
Correct
Given the following xml code, which element node is considered to be the first child of the <employee> node?
<?xml version="1.0" encoding="UTF-8"?>
<employees>
<employee>
<name>Gerard</name>
<role>Instructor</role>
<Address>Batangas City<Address>
<age>32</age>
</employee>
<employee>
<name>Anthony</name>
<role>Admin</role>
<Address>Cavite City</Address>
<age>25</age>
</employee>
</employees>
a. <employees>
b. <role>
c. <name>
d. <age>
Question 3
Correct
Select one:
True
False
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 3/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 4
Correct
a. Parent-self
b. Current parent
c. Parent
d. Parent-or-self
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 4/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 5
Correct
Based from the given xml codes below, what would be the output if we apply the XML DOM statement,
xmlDoc.getElementsByTagName("title")[3].childNodes[0].nodeValue?
<books>
<book genre="educational">
<year>1965</year>
</book>
<book genre="culture">
<year>1966</year>
</book>
<book genre="computer">
<year>1975</year>
</book>
<book genre="philosophy">
<title lang="en">Philosophy of Man</title>
<author>Jon Mills</author>
<year>1989</year>
</book>
</books>
b. Philosophy of Man
d. Introduction to Programming
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 5/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 6
Correct
let size=xmlDoc.getElementsByTagName("author").length;
for (let x=0; x < size; x=x+2){
authorList+=xmlDoc.getElementsByTagName("author")[x].childNodes[0].nodeValue;
}
document.getElementById("demo").innerHTML=authorList
<books>
<book genre="educational">
<year>1965</year>
</book>
<book genre="culture">
<year>1966</year>
</book>
<book genre="computer">
<year>1975</year>
</book>
<book genre="philosophy">
<title lang="en">Philosophy of Man</title>
<author>Jon Mills</author>
<year>1989</year>
</book>
</books>
d. Dan Morgan
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 6/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 7
Correct
This XML DOM function returns array of tags that match given tag name
a. getElementsByArray()
b. getElementsByName()
c. getElementsByTag()
d. getElementsByTagName()
Question 8
Correct
a. Branch
b. Sets
c. Nodes
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 7/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 9
Correct
a. /
b. //
c. .
d. ..
Question 10
Correct
a. Graph
b. Tree
c. List
d. Arrays
Question 11
Correct
This Xpath Axis selects everything in the document after the closing tag of the current node
a. Following
b. Following-sibling
c. Preceding
d. Preceding-sibling
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 8/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 12
Correct
This XML DOM function is used for creating attributes for elements
a. newAttribute()
b. appendAttribute()
c. createAttribute()
d. addAttribute()
Question 13
Correct
a. Document node
b. Text nodes
c. Element node
Question 14
Correct
a. Document node
b. Comment Node
c. Element node
d. Attribute Node
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 9/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 15
Correct
This XML DOM function creates a new element that can be inserted in the
document
a. . newElement()
b. createElement()
c. newChild()
d. createChild()
Question 16
Correct
This XML DOM function inserts a new node before the given node
a. insertBefore()
b. before()
c. insBef()
d. insB()
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 10/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 17
Correct
These are child nodes with the same level and have the same parent
a. Parent nodes
b. Child nodes
c. Sibling nodes
d. Root nodes
e. Leaf nodes
Question 18
Correct
a. Document node
b. Text nodes
c. Element node
d. Attribute Nodes
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 11/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 19
Correct
Where are the elements returned by the function getElementsByTagName() stored in?
a. object
b. array
c. list
d. variable
Question 20
Correct
This XML DOM function inserts an element at the end of a given element’s children
a. appendChild()
b. addChild()
c. appendElement()
d. addElement()
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 12/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 21
Correct
a. /
b. //
c. .
d. ..
Question 22
Correct
This XML DOM function replaces an existing node inside the parent with a new one.
a. replaceNode ()
b. replaceChild()
c. repNode()
d. repChild()
Question 23
Correct
a. /
b. //
c. .
d. ..
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 13/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 24
Correct
a. Document node
b. Comment Node
c. Element node
d. Attribute Node
Question 25
Correct
a. Parent nodes
b. Child nodes
c. Sibling nodes
d. Root nodes
e. Leaf nodes
Question 26
Correct
a. refDocumentRootElement()
b. refDocumentElement()
c. documentElement()
d. document()
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 14/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 27
Correct
a. Parent nodes
b. Child nodes
c. Sibling nodes
d. Root nodes
e. Leaf nodes
Question 28
Correct
All of the following are correct statements about XML DOM except
a. It is the foundation of XML which contains as set of standard functions for accessing and manipulating contents in an XML
document
c. XML DOM can only run on specific operating systems and browsers
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 15/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 29
Correct
Given the following xml code, which element node is considered to be a leaf node?
<?xml version="1.0" encoding="UTF-8"?>
<employees>
<employee>
<name>Gerard</name>
<role>Instructor</role>
<Address>Batangas City<Address>
<age>32</age>
</employee>
<employee>
<name>Anthony</name>
<role>Admin</role>
<Address>Cavite City</Address>
<age>25</age>
</employee>
</employees>
a. <employees>
b. <name>, <role>,<Address><age>
c. <employee>
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 16/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 30
Correct
Given the following xml code, which element node is considered to be the last child of the <employee> node?
<?xml version="1.0" encoding="UTF-8"?>
<employees>
<employee>
<name>Gerard</name>
<role>Instructor</role>
<Address>Batangas City<Address>
<age>32</age>
</employee>
<employee>
<name>Anthony</name>
<role>Admin</role>
<Address>Cavite City</Address>
<age>25</age>
</employee>
</employees>
a. <employees>
b. <role>
c. <name>
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 17/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 31
Correct
a. createText()
b. createTextNode()
c. addTextNode()
d. appendTextNodes()
Question 32
Correct
a. Document node
b. Text nodes
c. Element node
d. Attribute Nodes
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 18/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 33
Incorrect
a. Parent nodes
b. Child nodes
c. Sibling nodes
d. Root nodes
e. Leaf nodes
Question 34
Correct
This path expression selects nodes in the document from the current node that match the selection no matter where they are
a. /
b. //
c. .
d. ..
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 19/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 35
Correct
Given the following xml code, which element node is sibling node?
<?xml version="1.0" encoding="UTF-8"?>
<employees>
<employee>
<name>Gerard</name>
<role>Instructor</role>
<Address>Batangas City<Address>
<age>32</age>
</employee>
<employee>
<name>Anthony</name>
<role>Admin</role>
<Address>Cavite City</Address>
<age>25</age>
</employee>
</employees>
a. <employees>
b. <name>, <role>,<Address><age>
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 20/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 36
Incorrect
let size=xmlDoc.getElementsByTagName("author").length;
for (let x=0; x < size; x=x+4){
authorList+=xmlDoc.getElementsByTagName("author")[x].childNodes[0].nodeValue;
}
document.getElementById("demo").innerHTML=authorList
<books>
<book genre="educational">
<year>1965</year>
</book>
<book genre="culture">
<year>1966</year>
</book>
<book genre="computer">
<year>1975</year>
</book>
<book genre="philosophy">
<title lang="en">Philosophy of Man</title>
<author>Jon Mills</author>
<year>1989</year>
</book>
</books>
d. Dan Morgan
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 21/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 37
Correct
Based from the given xml codes below, what would be the output if we apply the XML DOM statement,
xmlDoc.getElementsByTagName("year")[1].childNodes[0].nodeValue?
<books>
<book genre="educational">
<author>Dan Morgan</author>
<year>1965</year>
</book>
<book genre="culture">
<year>1966</year>
</book>
<book genre="computer">
<year>1975</year>
</book>
<book genre="philosophy">
<year>1989</year>
</book>
</books>
a. 1975
b. 1989
c. 1966
d. 1965
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 22/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 38
Correct
This Xpath Axis selects all ancestors (parent, grandparent, etc.) of the current node
a. descendant
b. ancestor-or-self
c. parent
d. ancestor
Question 39
Correct
a. Parent nodes
b. Child nodes
c. Sibling nodes
d. Root nodes
e. Leaf nodes
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 23/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 40
Correct
a. XSelect
b. XPath
c. XAccess
Question 41
Correct
a. deleteChild()
b. nullChild()
c. removeChild()
d. remChild()
Question 42
Correct
a. DTD
b. XML DOM
d. CDATA
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 24/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 43
Correct
Based from the given xml codes below, what would be the output if we apply the XML DOM statement,
xmlDoc.getElementsByTagName("author")[2].childNodes[0].nodeValue?
<books>
<book genre="educational">
<year>1965</year>
</book>
<book genre="culture">
<year>1966</year>
</book>
<book genre="computer">
<year>1975</year>
</book>
<book genre="philosophy">
<title lang="en">Philosophy of Man</title>
<author>Jon Mills</author>
<year>1989</year>
</book>
</books>
a. Dan Morgan
b. Jake Johnson
c. Sam Clover
d. Jon Mills
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 25/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 44
Correct
This path expression selects all nodes with the name "nodename"
a. /
b.
//
c. .
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 26/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 45
Correct
let size=xmlDoc.getElementsByTagName("author").length;
for (let x=0; x < size; x++){
authorList+=xmlDoc.getElementsByTagName("author")[x].childNodes[0].nodeValue;
}
document.getElementById("demo").innerHTML=authorList
<books>
<book genre="educational">
<year>1965</year>
</book>
<book genre="culture">
<year>1966</year>
</book>
<book genre="computer">
<year>1975</year>
</book>
<book genre="philosophy">
<title lang="en">Philosophy of Man</title>
<author>Jon Mills</author>
<year>1989</year>
</book>
</books>
d. Dan MorganJakeJohnson
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 27/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 46
Correct
Given the following xml code, which element node is considered to be the root node?
<?xml version="1.0" encoding="UTF-8"?>
<employees>
<employee>
<name>Gerard</name>
<role>Instructor</role>
<Address>Batangas City<Address>
<age>32</age>
</employee>
<employee>
<name>Anthony</name>
<role>Admin</role>
<Address>Cavite City</Address>
<age>25</age>
</employee>
</employees>
a. <employees>
b. <employee>
c. <name>, <role>,<Address><age>
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 28/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 47
Correct
This Xpath Axis selects all nodes that appear before the current node in the document, except ancestors, attribute nodes and
namespace nodes
a. Following
b. Following-sibling
c. Preceding
d. Preceding-sibling
Question 48
Correct
a. parent
b. returnNull
c. parentNode
d. returnParent
Question 49
Correct
This gets the text data of an Element, Comment, or Text node for the XML DOM
a. CData
b. Data
c. getData
d. fetchData
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 29/30
3/18/23, 6:19 PM MIDTERM EXAMINATION: Attempt review
Question 50
Correct
a. &
b. $
c. @
Jump to...
trimestralexam.amaesonline.com/2223/mod/quiz/review.php?attempt=149112&cmid=2312&showall=1 30/30