XML MCQs

XML MCQs

These XML multiple-choice questions and their answers will help you strengthen your grip on the subject of XML. You can prepare for an upcoming exam or job interview with these XML MCQs.
So scroll down and start answering.

1: What does "XML" stand for?

A.   Hypertext Markup Language

B.   Hypertext Transfer Markup Language

C.   Standard General Markup Language

D.   Extensible Markup Language

2: DTD includes the specifications about the markup that can be used within the document, the specifications consists of all EXCEPT:

A.   Entity declarations

B.   Element declarations

C.   The size of element name

D.   The browser name

3: What is "xmllint"?

A.   A content specific specification

B.   A command line XML tool for Linux/UNIX

C.   A valid XML document

D.   A well formed XML document

4: In a DTD, what is the difference between CDATA and PCDATA?

A.   CDATA works on any computer, PCDATA only works on PC's

B.   PCDATA will be treated as general XML input, CDATA will be treated as a string

C.   You can only use CDATA for attributes

D.   You can't use characters like < and & in CDATA

5: <!-- is the start of...

A.   A comment

B.   Javascript instructions

C.   A PCDATA space

D.   A CDATA space

6: Generally speaking, how is an XML document structured?

A.   As a binary file

B.   As a bitstream

C.   As a hierarchical tree of nodes

D.   As plaintext

7: XSD is written in:

A.   XML

B.   html

C.   JSON

D.   SQL

8: What is XHTML's primary intended use?

A.   To make HTML more extensible and produce web documents that can be read by an XML parser

B.   To challenge the dominance of HTML5

C.   To make websites look better in Internet Explorer

D.   To standardize the mobile web

9: Which of the following appears first in a DTD?

A.   DOCTYPE

B.   root element

C.   public indentifier

D.   system identifier

10: What does an XML document have?

A.   A graph like structure, fixed schema, implied order, and no easy way to query

B.   A table-like structure, a self-describing schema, and an implied ordering

C.   A hierarchical structure, no ordering, and easy querying using SQL and relational algebra

D.   A tree structure, a flexible schema, an implied ordering, and a way to query data called XPath

11: True or False? In its current state, XML is meant to be a replacement for HTML.

A.   False

B.   True

12: in an XML document does what?

A.   Indicates where the XSD is.

B.   Indicates where the DTD is.

C.   Indicates where to find a validating parser.

D.   Points you to a CSS styling sheet.

13: Which of the following is an XML query language?

A.   SQL

B.   relational algebra

C.   XPath

D.   JSON

14: What is XML used for?

A.   For replacing HTML as a new standard

B.   For design purposes

C.   For structuring documents

D.   Data exchange and representation

15: Which of the following is true about the XML schema data type xs:anyURI

A.   It may contain an absolute URI.

B.   It can contain an absolute or relative URI with an optional fragment identifier.

C.   It may contain a relative URI.

D.   (All of these choices.)

16: XML parsers check if the XML document is:

A.   Well-formed and validating

B.   Non-validating

C.   Validating

D.   Well-formed

17: What kind of file does SVG represent?

A.   An image

B.   A database

C.   A webpage

D.   A form

18: What are the basic constructs of an XML document?

A.   Tagged elements that can be nested, attributes for elements, and the text

B.   Tagged elements that may or may not be matched, attributes and text

C.   Tagged elements that can overlap, attributes, and the content in strings

D.   Tagged elements that can be nested, a fixed number of attributes per element and text

19: In a DTD, how does one say that an attribute must exist in the XML document?

A.   add #REQUIRED to DTD

B.   add #IMPLIED to DTD

C.   add #PCDATA to DTD

D.   add comment to DTD

20: How does XPath view a XML document?

A.   As a schema

B.   As a graph

C.   As a fixed structure

D.   As a tree

21: Which of the following is well-formed?

A.  

B.  

C.   ' in an XML document without using it as an XML character? (e.g., how do you escape '>' in XML?)

A.   &

B.   >

C.   <

D.   >

23: Which of the following is a positive reason to use a schema?

A.   Your data is irregular

B.   Programs, CSS, XSL, etc. can assume a certain structure, therefore making them simpler

C.   You need flexibility in the data

D.   If you don't need your XML structure to be specific, it's easier to manipulate

24: What does ' ' stand for, and why is it used?

A.   Non-breaking space': It tells the parser that it should not render this piece of whitespace

B.   Non-browser space': It tells browsers to ignore the character, if they're reading any *ML document

C.   Non-breaking space': It tells the parser that this particular piece of whitespace is worth rendering

D.   Non-browser space': It tells browsers to ignore the character, if they're reading an XML document

25: All attributes must be separated by:

A.   An element.

B.   Another attribute.

C.   Whitespace.

D.   Quotes.

26: What is a document type definition, also known as a DTD?

A.   A validator for XML

B.   Rules for an XML document

C.   A parser for XML

D.   A debugger for XML document

27: At the minimum, what must an attribute for an element contain?

A.   An equal sign, a nonunique name, and a set of quotes.

B.   A unique name (within the document), an equal sign, and a set of quotes.

C.   A unique name (within the element), an equal sign, and a set of quotes.

D.   A value, an equal sign, and a unique name.

28: Which of the following is the major difference between an HTML document and an XML document?

A.   XML tags can be nested but HTML tags can't be nested

B.   You do not need to close the tags in a XML document but you have to for the HTML document

C.   HTML tags describe both the structure and the styling of the document whereas XML tags only describe the content

D.   HTML documents have predefined elements, whereas XML documents do not

29: If I have a person element with a single gender, a single address, and a single gpa as children, which of the following would you put in the DTD to specify that gpa is optional?

A.   (gpa*)

B.   (gpa # REQUIRED)

C.   (gpa?)

D.   (gpa +)

30: The number of attributes for an element in a XML Document does NOT matter if:

A.   There are more than one attribute for each element

B.   Each attribute is unique

C.   Its a valid XML document

D.   More than one element has the same attribute

31: XML document by default preserves white-space characters in element content.

A.   False

B.   True

A.   Path expressions

B.   XPath as component

C.   Full-featured

D.   Output formatting

33: If I have an element named 'student' and I set the XML code to maxOccurs="unbounded" in the XSD schema to this subelement, what will this do?

A.   It means there must be at least one student element and there is no limit to how many student elements there can be.

B.   It means if there are too many student children, the validating parser will give you an error

C.   It means there must be multiple students as children and there is a limit to how many student children there can be.

D.   It means there must be more than one student element as a child and there is no limit to how many student children there can be.

34: Which of the following metaphors most accurately describes an element contained by another element?

A.   The second element is the child of the first

B.   The first element is an attribute of the second

C.   The second element is a descendant of the first

D.   They are sibling elements

35: Which of the following is the least flexible of the schema languages?

A.   DTD

B.   RELAX-NG

C.   Schematron

D.   XSD

36: Which of these is the proper syntax for setting multiple values on an attribute?

A.  

B.  

C.   Attributes cannot have multiple values

D.  

37:

Why is this XHTML wrong?

<div class='div1' style='color: blue;' class='bodyText'>

A.   An element cannot belong to multiple classes

B.   An element's attributes must each be unique within the element

C.   div' is not part of the XHTML namespace

D.   The @style attribute must come at the end of the element

38: An XML declaration must consist of which of the following?

A.   Version

B.   Encoding

C.   Version and standalone

D.   Encoding and standalone

39: What does the XML declaration have to consist of?

A.   <XML> ... </xml>

B.   XML version

C.   <body> ... </body>

D.   XML version, encoding, and standalone

E.   <?xml-stylesheet href="xml.css" type="text/css"?>

40: What does XSL most accurately do?

A.   Make sure your XML is valid

B.   Turn an image (such as a JPG) into an SVG

C.   Traverse XML documents and output other documents

D.   Traverse XML documents and output XPath queries

41: maxOccurs and minOccurs can be considered as:

A.   occurence constraints

B.   min and max values constraints

C.   element constraints

D.   attribute constraints

42: Which of these characters is illegal in XML?

A.   '

B.   ^

C.   &

43: The attributes in the element are NOT correct because:

A.   Neither the @brand attribute nor the element itself are closed properly.

B.   The brand and the price attributes aren't separated properly.

C.   The brand attribute is missing a value.

D.   The shirt has a value of american eagle but the attribute name is missing.

44: Which of the following is NOT a benefit of using XML?

A.   Ability to define document structures via schemas

B.   Ability to read and edit documents on almost any system

C.   Ability to work easily with irregular data

D.   Unicode support

45: Which of these is the correct syntax of the XML declaration?

A.  

B.  

C.  

D.   None of the above

46: If the validating parser outputs "not valid" during the validating process, what does this mean?

A.   The XML document does not adhere to the specified schema.

B.   The XML document is not well formed.

C.   You forgot to specify where the DTD is.

D.   The XML document doesn't have basic structures that an XML document should have.

47: Which of the following is an empty element tag?

A.  

B.  

C.  

D.  

48: XML Namespaces provide a method to avoid element name conflicts. Which of the following is a correct way to declare namespaces in a valid XML document.

A.  

B.  

C.  

D.  

E.  

49: True or False: You can refine an external XSD schema inside of an XML file, as you can with a DTD.

A.   False

B.   TRUE

50: In an XML schema, to limit a user-defined type to a set of pre-defined options, you would use:

A.   Any of the above

B.   An xs:enumeration inside an xs:restriction

C.   An xs:length inside an xs:restriction

D.   An xs:pattern inside an xs:restriction