IBM certification: "XML and related technologies" (exam 141)

Author: Razvan MIHAIU
razvan_rem@rem_mihaiu.name (please remove '_rem' and 'rem_')
From: www.mihaiu.name
Date: 11/04/2005

Page 1: XML questions 1-15

Page 2: XML questions 16-27

If you found this set of questions useful for getting XML certified please let me know.

Companies currently offering certifications in this field are IBM and Altova.


  1. Is it possible to define (in XML Schema) lists of atomic datatypes that allow whitespaces such as xs:string ? Yes/No

    \/\/\/\/\/\/\/\/\/\/

    Yes, it is possible but the whitespace is still the list's separator. That means that if you apply a facet to limit the number of string occurences in such a list you will limit in fact the number of words from the list and not the number of strings (a string can be composed of many words).

  2. Take a look at the following list declarations:
    <!-- 1 --> <xsd:simpleType name="limitedStringList"> <xsd:list> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:maxLength value="5"/> </xsd:restriction> </xsd:simpleType> </xsd:list> </xsd:simpleType> <xsd:simpleType name="stringList"> <xsd:list itemType="xsd:string"/> </xsd:simpleType> <!-- 2 --> <xsd:simpleType name="restrictedStringList"> <xsd:restriction base="razvan:stringList"> <xsd:maxLength value="5"/> </xsd:restriction> </xsd:simpleType>

    Is the list LimitedStringList equivalent with restrictedStringList ? Yes/No

    \/\/\/\/\/\/\/\/\/\/

    No.

    limitedStringList - declares a list with an unlimited number of words, each word having a maximum length of 5;

    restrictedStringList - declares a list with a maxim number of 5 words, each word having any length;

  3. Consider the folling XML fragment from an XSLT transformation:

    <xsl:template match="/Root/BlockB"> Value:<xsl:value-of select="//BlockB"/><br/> </xsl:template>

    What nodes values will be printed by the expression:

    <xsl:value-of select="//BlockB"/>

    a. all the values from the set of matched elements;

    b. the values of the first element in the set of matched elements;

    c. the value of the last element in the set of matched elements;

    \/\/\/\/\/\/\/\/\/\/

    Answer: b.

  4. Does the XSLT tag
    <xsl:if test="cond">
    have an else clause ? Yes/No

    \/\/\/\/\/\/\/\/\/\/

    Answer: no.

  5. Consider the following XSLT fragment:
    <xsl:choose> <xsl:when test=".='Bucuresti'"> URA Bucuresti ! </xsl:when> <xsl:when test=".='Craiova'"> URA Craiova ! </xsl:when> <xsl:when test=".='Sibiu'"> URA Sibiu ! </xsl:when> <xsl:otherwise> URA !!! !!! !</xsl:otherwise> </xsl:choose>

    Does the <choose> tag allow fall through to the next <when> tag ? Yes/No

    \/\/\/\/\/\/\/\/\/\/

    Answer: no.

  6. What is the assignment operator in XSLT ?

    a. "=";

    b. "==";

    c. "assign";

    d. "let";

    e. none of the above;

    \/\/\/\/\/\/\/\/\/\/

    Answer: e.

    There is no assignement operator in XSLT. Once a variable has been assigned it is not possible to change its value.

  7. All XSLT variables are global by default ? Yes/No

    \/\/\/\/\/\/\/\/\/\/

    Answer: no.

    If the variable is defined inside a template then its scope is limited to that template.

  8. If a document has complex relationships like KEY-KEYREF or ID-IDREF what technology is better for parsing this kind of document ?

    a. DOM

    b. SAX

    \/\/\/\/\/\/\/\/\/\/

    Answer: a.

  9. Is the following element declaration correct ?
    <!ELEMENT BlockA1 (#PCDATA) #IMPLIED>

    \/\/\/\/\/\/\/\/\/\/

    No.

    The #IMPLIED string cannot be attached to elements (only to attributes). When an element is declared only its internal structure is declared, like:

    <!ELEMENT BlockA1 (#PCDATA) #IMPLIED>

    The way this element (BlockA1) is used inside other elements will be declared by those elements:

    <!ELEMENT BlockA (#PCDATA | BlockA1 | BlockA2)*>
  10. Which of the following style-sheet declarations are valid ? a.
    <?xml:stylesheet type="text/xsl" src="convert.xsl"?>
    b.
    <?xml-stylesheet type="text/xsl" href="convert.xsl"?>

    \/\/\/\/\/\/\/\/\/\/

    Answer: a,b

  11. Can you declare in DTD that an element can have any attributes ? Yes/No

    \/\/\/\/\/\/\/\/\/\/

    Answer: no.

  12. Is XML contained in a DocumentFragment always well formed ? Yes/No

    \/\/\/\/\/\/\/\/\/\/

    No. A DocumentFragment can have only a child of type text. Such a DocumentFragment is not well-formed XML.

  13. Consider the following Java code:
    DocumentFragment documentFragment = document.createDocumentFragment(); documentFragment.appendChild(document.createElement("BlockFragmentZZZ")); documentElement.appendChild(documentFragment); documentElement.appendChild(documentFragment); documentElement.appendChild(documentFragment); documentElement.appendChild(documentFragment);

    How many times the element "BlockFragmentZZZ" is to be found in the final document ?

    a. 0 times;

    b. 1 time;

    c. 4 times;

    \/\/\/\/\/\/\/\/\/\/

    Answer: b.

    The member function appendChild() first checks to see if child node to be inserted is already present in the tree. If yes, the old child is first removed before the new child is added to the document.

  14. Consider the following Java code:
    DocumentFragment documentFragmentA = document.createDocumentFragment(); DocumentFragment documentFragmentB = document.createDocumentFragment(); documentFragmentA.appendChild(document.createElement("BlockFragmentAAA")); documentFragmentA.appendChild(document.createElement("BlockFragmentBBB")); documentElement.appendChild(documentFragmentA); documentElement.appendChild(documentFragmentB); documentElement.appendChild(documentFragmentA); documentElement.appendChild(documentFragmentB);

    \/\/\/\/\/\/\/\/\/\/

    How many times the elements "BlockFragmentAAA" and "BlockFragmentBBB" are to be found in the final document ?

    a. 0 times;

    b. 1 times;

    c. 2 times;

    \/\/\/\/\/\/\/\/\/\/

    Answer: b.

    Each element will be added once. When the function appendChild() will be called the second time the first node will first be removed then the specified node will be inserted.

  15. Does CharacterData correspond to some node in DOM ? Yes/No

    \/\/\/\/\/\/\/\/\/\/

    Answer: no.

    Both Comment and Text nodes inherit from CharacterData but there is no standalone CharacterData node.


I wish you success in your certification effort.







Best regards,
Razvan MIHAIU




Razvan Mihaiu � 2000 - 2017