XML Quiz
For each question, choose the best choice out of the given choices.

What does XML stand for?
A. X-Markup Language
B. eXtra Modern Link
C. Example Markup Language
D. eXtensible Markup Language

XML’s goal is to replace HTML
A. True
B. False

What does DTD stand for?
A. Direct Type Definition
B. Document Type Definition
C. Document Type Declaration

Is this a correct XML document?
<?xml version=”1.0”?>
<to>Students</to>
<from>Teacher</from>
<heading>Reminder</heading>
<body>We are at Software Park, Thailand</body>
A. Yes
B. No

Which statement is true?
A. All XML elements must have a closing tag
B. All XML documents must have a DTD or an XML schema
C. All XML elements must be lowercase
D. All of the statements are true

Which statement is true?
A. XML tags are case sensitive
B. XML elements must be properly nested
C. XML documents must have the root element
D. All the statements are true

XML preserves white spaces
A. True
B. False

Is this a correct XML document?
<?xml version=”1.0”?>
<note>
<to age=19>Students</to>
<from>Teacher</from>
</note>

A. No
B. Yes

XML elements cannot be empty
A. True
B. False

Which is not a correct name for an XML element?
A. <Note>
B. <h1>
C. <1dollar>
D. All 3 names are incorrect

Which is not a correct name for an XML element?
A. <age>
B. <first name>
C. <NAME>
D. All 3 names are incorrect

Which is not a correct name for an XML element?
A. <xmldocument>
B. <document>
C. <doc>

For the XML parser to ignore a certain section of your XML document, which syntax is correct?
A. <xml:CDATA[ Text to be ignored]>
B. <CDATA>Text to be ignored</CDATA>
C. <![CDATA[ Text to be ignored ]]>

XML is a subset of SGML
A. True
B. False

XML attributes must be in double quotes
A. True
B. False

XML attributes must be assigned values
A. True
B. False

The Document Type Definition must be stored in an external file
A. True
B. False

What can XML do?
A. The standard for automating data exchange between systems
B. The standard for displaying data on the Web
C. The standard for a cross-platform programming language

Which is false?
A. XML is used to describe only structured data
B. XML is used to only on the Internet
C. XML is used to represent only simple data
D. All of the above

Which of the following comments are not well formed?
A. <!-- define <source> -->
B. <!-- define <source> -->
C. <!-- declaration — 10.27.2004 -->
D. <!— this is a valid comment -->

Provided that the file x.dtd has the following contents. Which of the xml files are valid?
<!ELEMENT test (a, b)>
<!ELEMENT a ANY>
<!ELEMENT b (#PCDATA | c)*>
<!ELEMENT c EMPTY>
<!ATTLIST c valid (true | false) #IMPLIED>

a. <?xml version=”1.0” encoding=”ISO-8859-1”?>
<!DOCTYPE test SYSTEM “x.dtd”>
<test>
<a/>
<b>text<c valid=”true”/></b>
</test>

b. <?xml version=”1.0” encoding=”ISO-8859-1”?>
<!DOCTYPE test SYSTEM “x.dtd”>
<test>
<a>Element <a>can</a>
contain <anything/></a>
</test>

c. <?xml version=”1.0” encoding=”ISO-8859-1”?>
<!DOCTYPE a SYSTEM “x.dtd”>
<b>Sample</b>

How can you declare in a DTD that the element x contains either the element a or the element b, but not both of them
a) <!ELEMENT x a|b>
b) <!ELEMENT x (a|b)>
c) <!ELEMENT x (a?, b?)>
d) It is not possible to declare in a DTD that one element contains either the element a or the element b, but not both of them

How can you declare in a DTD that the element x contains the element a, or the element b, or both of them in the sequence a b.
a) <!ELEMENT x a|b>
b) <!ELEMENT x (a|b)>
c) <!ELEMENT x (a?, b?)>
d) None of the declarations above does solve the problem.

How can you declare in a DTD that the empty element x has either the attribute a or the attribute b (or both of them). The attributes contain any value.
a) <!ELEMENT x EMTPY>
<!ATTLIST (a|b) CDATA #REQUIRED>

b) <!ELEMENT x EMPTY>
<!ATTLIST a CDATA #REQUIRED>
<!ATTLIST b CDATA #REQUIRED>

c) <!ELEMENT x EMPTY>
<!ATTLIST a CDATA #REQUIRED
b CDATA #REQUIRED>

d) It is not possible to make the presence of one attribute depend on another attribute

How can you in a DTD declare that the element x contains both attributes a and b and that the order of them has to be ab? The attributes can contain any value
a) <!ELEMENT x EMPTY>
<!ATTLIST (a,b) CDATA #REQUIRED>

b) <!ELEMENT x EMPTY>
<!ATTLIST a CDATA #REQUIRED>
<!ATTLIST b CDATA #REQUIRED>

c) <!ELEMENT x EMPTY>
<!ATTLIST a CDATA #REQUIRED>
b CDATA #REQUIRED>

d) It is not possible to specify the order of attributes in a DTD. The order of attributes does not matter in XML.

e) It is not possible to specify the order of attributes in a DTD. The order of attributes can be specified only in an XML schema.

Valid names of elements and attributes start with a letter, an underscore or a colon, the following allowed characters are letters, numeric characters, colon, underscore, dot and hyphen (minus). Names which start with “xml” (in any case) are reserverd for W3C. The colon has a special meaning with namespaces and should not be used with any other semantic.