PCPP 32 10x PCPP Certified Professional Python Programmer 1 · Free Practice Question Medium
Question 13
Consider the following XML document:
- <?xml version="1.0" encoding="UTF-8"?>
- <bookstore>
- <book category="Fiction">
- <title lang="en">The Great Gatsby</title>
- <author>F. Scott Fitzgerald</author>
- <year>1925</year>
- <price>10.99</price>
- </book>
- <book category="Non-Fiction">
- <title lang="en">Sapiens: A Brief History of Humankind</title>
- <author>Yuval Noah Harari</author>
- <year>2014</year>
- <price>14.99</price>
- </book>
- </bookstore>
Which of the following statements about the given XML document is true? (Select three)
-
A
The root element of the XML document is
<bookstore>. -
B
The XML document contains a total of three
<title>elements. -
C
The
<price>element for the book "Sapiens: A Brief History of Humankind" has the value 10.99. -
D
The XML document is well-formed but does not adhere to any Document Type Definition (DTD).
-
E
The first book in the XML document belongs to the "Fiction" category.
Reveal correct answers
Correct answers: A, D, E
A.
The root element of the XML document is indeed <bookstore>, which encloses all other elements.
B.
The XML document contains a total of two <title> elements: one for "The Great Gatsby" and one for "Sapiens: A Brief History of Humankind."
C.
The <price> element for the book "Sapiens: A Brief History of Humankind" has the value 14.99, not 10.99.
D.
The given XML document is well-formed since it adheres to the syntax rules of XML. However, there is no indication of any DTD or schema being used to define the structure or data types.
E.
The first <book> element in the XML document has an attribute category="Fiction", indicating that it belongs to the "Fiction" category.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
