
Q31
Q31 The following XML snippet causes an error:
<employee xmlns="http://example.com"> <name>John</name> <name>Doe</name> </employee>.
What is the problem?
Multiple root elements
Namespace conflict
Duplicate elements
Missing namespace declaration
Q32
Q32 What is the primary purpose of an XML Schema (XSD)?
To define the structure and rules of an XML document
To apply styles to XML
To replace XML
To execute XML code
Q33
Q33 What does XSD stand for?
XML Structure Definition
XML Schema Definition
Extensible Schema Definition
Extensible Syntax Document
Q34
Q34 How does XSD differ from DTD?
XSD supports data types, DTD does not
DTD supports namespaces, XSD does not
XSD is less powerful than DTD
XSD is a binary format
Q35
Q35 What data type in XSD is used to define a whole number?
xs:string
xs:integer
xs:decimal
xs:boolean
Q36
Q36 What is the correct way to reference an external XSD file in an XML document?
<xmlschema href="schema.xsd">
<schemaLocation="schema.xsd">
<xsi:schemaLocation="schema.xsd">
<?xml-schema schema.xsd?>
Q37
Q37 What does xs:complexType define in an XSD file?
A simple XML element
An XML attribute
An element containing nested elements
A predefined XML rule
Q38
Q38 Which of the following is a valid XSD declaration for an integer element?
<xs:element name="age" type="xs:string"/>
<xs:element name="age" type="xs:integer"/>
<xs:element name="age" type="xs:number"/>
<xs:element name="age" type="xs:decimal"/>
Q39
Q39 Which XSD data type should be used for a date value?
xs:date
xs:timestamp
xs:datetime
xs:time
Q40
Q40 What is the correct way to define an optional XML attribute in XSD?
<xs:attribute name="id" type="xs:string" use="optional"/>
<xs:attribute name="id" type="xs:string" minOccurs="0"/>
<xs:attribute name="id" type="xs:string" required="false"/>
<xs:attribute name="id" type="xs:string" use="prohibited"/>
Q41
Q41 Why would an XML file fail validation against an XSD?
The XML file is too large
The XML file is missing a stylesheet
The XML file does not match the XSD structure
The XML file has multiple root elements
Q42
Q42 An XML document contains an element <price>12.5</price>, but it fails validation. What could be the reason?
The price value contains a decimal
The price element is missing
The XSD defines price as an integer
The XSD file is missing
Q43
Q43 An XML document fails to validate against an XSD due to a namespace issue. What is the most likely cause?
The XML document is missing a xmlns declaration
The XML document contains duplicate namespaces
The XML file has multiple root elements
The XSD file is invalid
Q44
Q44 What does the Document Object Model (DOM) represent in XML processing?
A binary format of XML
A tree-like structure of XML elements
An HTML parser
A style guide for XML
Q45
Q45 How does the DOM allow interaction with XML data?
By directly modifying the XML file
By providing a structured tree representation
By converting XML to JSON
By executing SQL queries on XML
Q46
Q46 Which programming languages provide built-in support for XML DOM?
JavaScript and Python
C and COBOL
HTML and CSS
Ruby and Perl
Q47
Q47 In the DOM structure, what is the topmost element of an XML document called?
Root node
Child node
Parent node
Attribute node
Q48
Q48 What is the role of the getElementsByTagName() method in XML DOM?
Retrieves all elements with a specified tag name
Deletes elements by tag name
Modifies element names
Creates new XML tags
Q49
Q49 What is the purpose of the createElement() method in XML DOM?
To remove an XML tag
To modify an XML tag
To create a new XML element
To convert XML to JSON
Q50
Q50 Which of the following JavaScript methods is used to access an XML element by its ID?
getElementById()
querySelector()
getElementsByTagName()
getElementByClass()
Q51
Q51 How do you create a new element in an XML DOM using JavaScript?
document.createElement("tag")
document.add("tag")
document.newTag("tag")
document.XMLCreate("tag")
Q52
Q52 Which of the following correctly appends a new child element in XML DOM using JavaScript?
parent.appendChild(newElement)
parent.addChild(newElement)
parent.newChild(newElement)
parent.createChild(newElement)
Q53
Q53 Why would an XML document manipulated through the DOM not reflect changes in the original file?
The DOM only represents an in-memory structure
The XML file is locked
The XML has syntax errors
The XML is read-only
Q54
Q54 Why does the following JavaScript code produce an error?
xmlDoc.getElementById("title").textContent = "New Title";
The getElementById() method does not work on XML elements without an ID
XML does not support text nodes
The XML document is empty
The XML file is missing a root element
Q55
Q55 Why would an XML DOM parser throw an error when using appendChild()?
The element is already a child of another node
The element is a root node
The element is not a valid XML tag
The XML file is empty
Q56
Q56 What is the purpose of XPath in XML?
To define XML structure
To query and navigate XML documents
To validate XML files
To style XML documents
Q57
Q57 Which of the following is an absolute XPath expression?
/books/book[1]
//book
book[@id]
.//title
Q58
Q58 What symbol is used in XPath to select the current node?
.
..
/
@
Q59
Q59 What does // in an XPath expression signify?
It selects elements anywhere in the document
It selects only child elements
It selects only attributes
It selects only sibling elements
Q60
Q60 What does the following XPath expression select:
//book[@category="fiction"]?
All books with any category
Only books with category="fiction"
The first book in the document
All child elements under books