back to XML certification FAQ

Core XML
 

Author: Mapraputa Is

 

"Our objective is to equip you with "just enough" XML
to appreciate the aplication scenarios and tool descriptions <...>,
but being over-achievers we may go a little too far"

Charles F. Goldfarb, Paul Prescod, The XML Handbook

Level of difficulty: easier than real exam. The following questions are intended to test basic syntax rules
and to serve as a self-revision tool after reading a corresponding chapter,before we move to "real exam questions"

1. An empty file is a well-formed XML document
 
a)true
b)false
 

Wrong

Answer : b

XML document must have at least the document element (root).

2. XML tags are case sensitive
 
a)true
b)false
 

Wrong

Answer : a

3. Which of the following XML documents are well-formed?


 
			

a)

<firstElement>some text goes here
<secondElement>another text goes here
</secondElement>
</firstElement>

b)

<firstElement>some text goes here
</firstElement>
<secondElement> another text goes here
</secondElement>

c)

<firstElement>some text goes here
<secondElement> another text goes here
</firstElement>
</secondElement>

d)

<firstElement>some text goes here
<secondElement>another text goes here
</firstElement>

 

Wrong

Answer : a

b is wrong because root tag is missing
c is wrong because tags are nested unproperly
d is wrong because the closing tag is omitted

4. Which of the following XML fragments are well-formed?
 
a) <myElement myAttribute="someValue"/>
b) <myElement myAttribute=someValue/>
c) <myElement myAttribute='someValue'/>
d) <myElement myAttribute="someValue'/>
e) <myElement myAttribute="some'Value"/>
f) <myElement myAttribute='some"Value'/>
 

Wrong

Answers : a c e f

It is illegal to omit quotation marks around attribute values.

5. By default the white space in elements is not truncated.
 
a)true
b)false
 

Wrong

Answer : a

6. When processing an output XML, "new line" symbols
 
a)are copied into output "as is", i.e. "CR+LF" for Windows, CR for Macintosh, LF for Unix.
b)are converted to single LF symbol
c)are converted to single CR symbol
d)are discarded
 

Wrong

Answer : b

7. Which of the following XML fragments are well-formed?
 
a) <myElement />
b) < myElement />
c) <myElement / >
d) <myElement/ >
 

Wrong

Answer : a
b is wrong because there can't be a space after opening "<" character;
c and d are wrong because there can't be a space between "/" and ">"

8. Rules for naming elements, attributes, entity references and processing instructions are the same
 
a)true
b)false
 

Wrong

Answer: a

9. Which of the following strings are a correct XML name?
 
a) _myElement
b) my Element
c) #myElement
d) 2ndElement
 

Wrong

Answer: a

10 Which of the following strings are a correct XML name?
 
a) xmlExtension
b) xslNewElement
c) XMLElement#123
d) myXMLElement123
 

Wrong

Answers: b d

11. Which of the following strings are a correct XML name?
 
a) myElement.myAttribute
b) myElement-myAttribute
c) página
d) n(4)
 

Wrong

Answers: a b c

12. This is a valid definition:
 
This question is contributed by Dan Chisham.
<!ATTLIST  el
           att1 ID       #REQUIRED
           att2 IDREF    #REQUIRED
           att3 ID       #REQUIRED
           att4 NMTOKEN  #REQUIRED
>

a)  true
b)  false
 

Wrong

Answer: b
Only one attribute with type ID is permitted for each element.

13. Which of the following XML fragments are well-formed?
 
a)<myElement myAttribute="value1 <= value2"/>
b)<myElement myAttribute="value1 & value2"/>
c)<myElement myAttribute="value1 > value2"/>
d)<myElement myAttribute="value1'value2"/>
 

Wrong

Answers: c d

Well-formed XML document is not allowed to use "<" and "&" characters within an attribute value

14. As their values attributes can have:
 
a)general entity references
b)parameter entity references
c)unparsed entity names
d)CDATA sections
 

Wrong

Answers: a c

15. Which of the following XML fragments are well-formed?
 
a)<!-- This is a comment -- quite useful one -->
b)<!-- This is a comment: <xml:comment > -->
c)<myElement myAttribute="value1 <!-anotherAttribute="value2" --> />
d)<!-- This is a comment <--! This is my old comment--> -->
 

Wrong

Answer: b
a is wrong because the string "--" is not allowed inside comments
c is wrong because comment cannot be placed inside a tag
d is wrong because comments cannot be nested.

16. Which of the following XML fragments are well-formed?
 
a)<![CDATA[ !@#$&%*()_+ ]]>
b)<![cdata[ &nbsp; ]]>
c)<![CDATA[ <!--comment--> ]]>
d)<![CDATA[yet another CDATA section:"<![CDATA[some text goes here]]>" ]]>
 

Wrong

Answers: a c
b is wrong because cdata should be CDATA
d is wrong because symbols "]]>" are the only symbols that are not allowed in a CDATA section are.

17. XML declaration is not required for XML document to be well-formed
 
a)true
b)false
 

Wrong

Answer: a

18. Which of the following XML fragments are well-formed?
 
a)<!-- Author: me, version: 1.01 -->
   <?xml version='1.0'?>
b)<?xml version='1.0'?>
   <!-- Author: me, version: 1.01 -->
c)all of the above
d)none of the above
 

Wrong

Answer: b
a is wrong because the XML declaration must be right at the beginning of the file

19. Which of the following XML fragments are well-formed?
 
a)<?xml?>
b)<?xml version="1.0"?>
c)<?xml encoding="JIS"?>
d)<?xml encoding="JIS" version="1.0"?>
 

Wrong

Answer: b
a and c are wrong because required attribute version is missing
d is wrong because version, encoding and standalone attributes must be in that order

20. Which statement(s) is(are) correct regarding encoding attribute of XML declaration:
 
a)encoding attribute is required for any XML declaration
b)encoding attribute is required only if actual encoding is different from default
c)if XML document uses only ASCII symbols, encoding attribute can be omitted
d)UTF8/UTF-16 is default encoding
 

Wrong

Answers: b, c, d

21. Attribute standalone="no" should be included in XML declaration if a document:
 
a)is linked to an external XSL stylesheet
b)has external general references
c)has processing instructions
d)has an external DTD
e)has namespace declarations
f)has XLink/XPointer elements
 

Wrong

Answers: d

22. PI in XML specification stands for: (Warning: tricky question!)
 
a)3.14
b)priceless instruction
c)processing instruction
d)polymorphic inheritance
 

Wrong

Answer: c

 

 Your scores: 

All mistakes found must be sent to the author or you will be sued.

back to XML certification FAQ