XML is a markup language and also a file format that is used to store, transmit, and reconstruct arbitrary data. XML defines a set of rules for encoding documents in a format that is both human-readable and machine-readable.
XML MCQs: This section contains multiple-choice questions and answers on the various topics of XML. Practice these MCQs to test and enhance your skills on XML.
List of XML MCQs
1. XML stands for ____.
- eXtensible Margin Language
- Xtensible Markup Language
- eXtensible Markup Language
- Xtensible Margin Language
Answer: C) eXtensible Markup Language
Explanation:
XML stands “eXtensible Markup Language”.
2. XML is designed to ____ and ____ data.
- design, style
- design, send
- store, style
- store, transport
Answer: D) store, transport
Explanation:
XML is designed to store and transport data.
3. XML Schema, published as a W3C recommendation in ____.
- May 2001
- May 2000
- May 1999
- May 1998
Answer: A) May 2001
Explanation:
XML Schema, published as a W3C recommendation in May 2001.
4. ____is used to read XML documents and provide access to their content and structure.
- XML Processor
- XML Pre-processor
- XML Compiler
- XML Interpreter
Answer: A) XML Processor
Explanation:
XML processor is used to read XML documents and provide access to their content and structure.
5. An XML document is a string of ____.
- HTML character codes
- XML codes
- ASCII codes
- Characters
Answer: D) Characters
Explanation:
An XML document is a string of characters, it may contain almost every Unicode character.
ADVERTISEMENT
6. In an XML document, a tag is a markup construct that starts with ___ and ends with ____.
- <, >
- <!–, –>
- <#, >
- @, @
Answer: A) <, >
Explanation:
In an XML document, a tag is a markup construct that starts with < and ends with >.
7. How many types of tags are there in an XML document?
- 3
- 4
- 5
- 6
Answer: A) 3
Explanation:
In an XML document, there are three types of tags and they are;
- start-tag, such as <section>;
- end-tag, such as </section>;
- empty-element tag, such as <line-break />.
8. Which is the correct XML declaration?
- <xml version=”1.0″ encoding=”UTF-8″/>
- <xml version=”1.0″ encoding=”UTF-8″></xml>
- <?xml version=”1.0″ encoding=”UTF-8″?>
- <?xml type=”document” version=”1.0″ encoding=”UTF-8″?>
Answer: C) <?xml version=”1.0″ encoding=”UTF-8″?>
Explanation:
The correct XML declaration is:
<?xml version=”1.0″ encoding=”UTF-8″?>
9. In an XML document, the comments are written within ____.
- /* and */
- <!– and –>
- <# and >
- @ and @
Answer: B) <!– and –>
Explanation:
In an XML document, the comments are written within <!– and –>.
10. In XML, DTD stands for ____.
- Document Type Declaration
- Data Type Definition
- Document Type Definition
- Document To Declaration
Answer: C) Document Type Definition
Explanation:
In XML, DTD stands for “Document Type Definition”.
ADVERTISEMENT
11. A Document Type Definition (DTD) is a set of ____ which is used to define the type of document for an SGML-family markup language.
- markup definition
- markup document
- main declarations
- markup declarations
Answer: D) markup declarations
Explanation:
A Document Type Definition (DTD) is a set of markup declarations which is used to define the type of document for an SGML-family markup language.
12. With respect to XML, SGML stands for ____.
- Standard Generalized Markup Language
- Standard General Markup Language
- Strainer Generalized Markup Language
- Standard Global Markup Language
Answer: A) Standard Generalized Markup Language
Explanation:
With respect to XML, SGML stands for “Standard Generalized Markup Language”.
13. XML tags are case-sensitive?
- Yes
- No
Answer: A) Yes
Explanation:
Yes, XML tags are case-sensitive. The following line of code is an example of wrong syntax.
<name>Alex</Name>
14. Which is the correct syntax of an empty element in XML?
- <#element_name attribute1 attribute2…#>
- <element_name attribute1 attribute2…/>
- <element_name attribute1 attribute2…>
- <element_name attribute1 attribute2…></element_name>
Answer: B) <element_name attribute1 attribute2…/>
Explanation:
The correct syntax of an empty element in XML is:
<element_name attribute1 attribute2…/>
15. An XML element can have ____.
- multiple attributes
- only two unique attributes
- multiple unique attributes
- None of the above
Answer: C) multiple unique attributes
Explanation:
An XML element can have multiple unique attributes.
ADVERTISEMENT
16. Which is not a correct attribute type?
- StringType
- ArrayType
- TokenizedType
- EnumeratedType
Answer: B) ArrayType
Explanation:
The “ArrayType” is not a correct type.
17. If element ONE is contained by element TWO, then ONE is known as ____ of TWO.
- ancestors
- family
- descendant
- child
Answer: C) descendant
Explanation:
If element ONE is contained by element TWO, then ONE is known as descendant of TWO.
18. The containing element which contains other elements is called ____ of other element.
- ancestor
- family
- descendant
- child
Answer: A) ancestor
Explanation:
The containing element which contains other elements is called ancestor of other element.
19. Which is the correct syntax to link XML file with CSS?
- <?xml type=”text/css” href=”file.css”?>
- <?xml type=”text/css” src=”file.css”?>
- <?xml-stylesheet type=”text/css” href=”file.css”?>
- <?xml-stylesheet type=”text/css” src=”file.css”?>
Answer: C) <?xml-stylesheet type=”text/css” href=”file.css”?>
Explanation:
The correct syntax to link XML file with CSS is:
<?xml-stylesheet type=”text/css” href=”file.css”?>
20. What does SAX stand for ____.
- Simple Application for XML
- Safe API for XML
- Super Application for XML
- Simple API for XML
Answer: D) Simple API for XML
Explanation:
SAX stands for “Simple API for XML”.
ADVERTISEMENT
21. SAX in XML is used for ____.
- Defining format of an XML document
- Validating the XML file
- Parsing XML documents
- None of the above
Answer: C) Parsing XML documents
Explanation:
SAX is used for parsing XML documents.
22. Does SAX Parser create any internal structure?
- Yes
- No
Answer: B) No
Explanation:
No, SAX Parser does not create any internal structure.
23. In XML DOM, what does DOM stand for ____.
- Document Object Model
- Date Object Model
- Document Oriented Model
- Document Open Model
Answer: A) Document Object Model
Explanation:
In XML DOM, DOM stands for “Document Object Model”.
24. How many types of XML databases?
- 2
- 3
- 4
- 5
Answer: A) 2
Explanation:
There are two types of XML databases.
- XML-enabled database
- Native XML database (NXD)
25. From the below given options, which is not a W3C-recommended Specification?
- SAX
- DOM
- Both A and B
- None of the above
Answer: A) SAX
Explanation:
SAX is not a W3C-recommended Specification.
26. What does XSNL stand for ____.
- XML Simple Neutral Language
- XML Software Neutral Language
- XML Search Natural Language
- XML Search Neutral Language
Answer: D) XML Search Neutral Language
Explanation:
XSNL stand for “XML Search Neutral Language”.
27. XSNL acts between the meta search interface and targeted system.
- meta search interface, XML document
- meta search interface, targeted system
- XML document, targeted system
- None of the above
Answer: B) meta search interface, targeted system
Explanation:
XSNL acts between the “meta search interface” and “targeted system”.
28. Which options are true regarding a well-formed XML document?
- Each tag must have a closing tag
- The opening and closing tag are the same i.e., their case must be the same
- The child tag must be closed within the parent tag i.e., as per the order, before closing the parent tag.
- All of the above
Answer: D) All of the above
Explanation:
All the above options (A, B, and C) and true to write a well-formed XML document,
- Each tag must have a closing tag
- The opening and closing tag are the same i.e., their case must be the same
- The child tag must be closed within the parent tag i.e., as per the order, before closing the parent tag.
29. In an XML document, can we use graphics?
- Yes
- No
Answer: A) Yes
Explanation:
Yes, the graphics can be used within an XML document.
30. In an XML document, a graphics can be stirred using the ____.
- XLink
- XPointer
- Both A and B
- None of the above
Answer: C) Both A and B
Explanation:
In an XML document, a graphics can be stirred using the XLink and XPointer.
ADVERTISEMENT
31. Can we create internal linking using XLink?
- Yes
- No
Answer: A) Yes
Explanation:
Yes, we can create internal linking using XLink.
32. Which XLink attribute defines the URL to link to?
- xlink:path
- xlink:url
- xlink:src
- xlink:href
Answer: D) xlink:href
Explanation:
XLink attribute xlink:href defines / specifies the URL to link to within an XML document.
33. Which XLink attribute defines the type of the link?
- xlink:type
- xlink:kind
- xlink:types
- xlink:category
Answer: A) xlink:type
Explanation:
XLink attribute xlink:type defines / specifies the type of the link.
34. Which XLink attribute specifies where to open the link?
- xlink:target
- xlink:where
- xlink:show
- xlink:path
Answer: C) xlink:show
Explanation:
XLink attribute xlink:show specifies where to open the link.
35. What is the default value of XLink ‘xlink:show’ attribute?
- embed
- new
- replace
- other
Answer: C) replace
Explanation:
The default value of XLink xlink:show attribute is replace.
36. Which XML object is used to request data from the web server?
- XMLHttpReq
- XMLHttpRequest
- XMLHttpsReq
- XMLHttpsRequest
Answer: B) XMLHttpRequest
Explanation:
The XMLHttpRequest Object is used to request data from a web server.
37. Can all XML elements be accessed through the XML DOM?
- Yes
- No
Answer: A) Yes
Explanation:
Yes, all XML elements can be accessed through the XML DOM.
38. Which is the correct XML DOM statement to get the text value of the first element named “city” in an XML document?
- result = xmlDoc.getElementsByTagName(“city”)([0]).childNodes[0].nodeValue;
- result = xmlDoc.getElementsByTagName(“city”).childNodes[0].nodeValue;
- result = xmlDoc.getElementsByTagName(“city”)[0].nodeValue;
- result = xmlDoc.getElementsByTagName(“city”)[0].childNodes[0].nodeValue;
Answer: D) result = xmlDoc.getElementsByTagName(“city”)[0].childNodes[0].nodeValue;
Explanation:
The correct XML DOM statement to get the text value of the first element named “city” in an XML document is:
result = xmlDoc.getElementsByTagName(“city”)[0].childNodes[0].nodeValue;
39. Is the following XML well-formed?
<book>
<title>The Secret</title>
<author>Rhonda Byrne</author>
<pages>198</pages>
<price>120.00</price>
</book>
- Yes
- No
Answer: A) Yes
Explanation:
Yes, the above given XML well-formed.
40. XML has predefined tags?
- Yes
- No
Answer: B) No
Explanation:
No, XML has no predefined tags.
[…] XML Multiple-Choice Questions […]
[…] XML Multiple-Choice Questions […]