IBM XML mock exam

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-20

Page 2: XML questions 21-40

Page 3: XML questions 41-60

  1. Assume that its_id is an attribute of type ID. Is the following XML extract well-formed ?

    <TestType some_attrib="Doi" its_id="125a"> test3 </TestType>

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

    No. A well-formed id must start with a Unicode letter:

    <TestType some_attrib="Doi" its_id="a125"> test3 </TestType>
  2. Can you use a parameter entity before it is defined ? Yes/No

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

    Answer: No.

  3. Is there any difference between a parsed and a parsable entity ?

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

    Yes. A parsed entity will be parsed by a (validating?!) parser. A parsable entity is a valid entity (an entity that is well-formed XML). A parsable entity can be parsed or not, depending on its declaration in the DTD document.

  4. Is the following XML valid ?
    <!ENTITY EndsWithApostrophe "Some Text ' "> <some_element some_attribute='A B C &EndsWithApostrophe;/>

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

    No. The apostrophe that ends the entity cannot be used to end the value of the attribute "some_attribute".

  5. Can you nest conditional sections in a DTD ? Yes/No

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

    Yes. The following DTD is perfectly valid:

    <![IGNORE [ <!-- anything here will be ignored --> <![INCLUDE [ <!-- despite the INCLUDE directive everything here will be IGNORED because the outer most directive is IGNORE --> ]]> ]]>
  6. A certain XML file begins with the following declaration:
    <?xml version="1.0" encoding"UTF-8" standalone="yes"?>

    Can this XML file have an external DTD attached to it ? Yes/No

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

    Yes, since the "standalone" declaration is just a hint to the parser and not a direct instruction.

  7. XML is case-sensitive ? Yes/No

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

    Answer: yes.

  8. Can you include in a comment the string "--" ? Yes/No

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

    No. This requirement is preserved in XML so that compatibility is maintained with SGML.

  9. Can a comment end with a hyphen "-" ? Yes/No

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

    No. Even if the end of the comment can be properly identified by "-->" it is forbidden to have the hyphen as the last character in the comment:

    <!-- comment --->

    Most probably this requirement was enforced in order to preserve the compatibility with SGML.

  10. Can you nest comments ? Yes/No

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

    No. Nested comments are illegal:

    <!-- comment1 <!-- comment2 --> -->
  11. Is the following CDATA section valid ?
    <!  [CDATA[abc &&&&abc]]>

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

    No. It is illegal to have a whitespace between <! and CDATA. The correct form is:

    <! [CDATA[abc &&&&abc]]>
  12. Is the following CDATA section valid ?
    <![CDATA[abc &&&&abc]]]]>

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

    Yes. The string used to end a CDATA section is "]]>". The string "]]" can be used anywhere inside a CDATA section because it does not have any special signification.

  13. Take a look at the following XML declaration:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

    Are the parameters "version", "encoding" and "standalone" just standard attributes ? Yes/No

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

    No. They are not just standard attributes because their order is fixed (the order of the standard attributes is not important)

  14. Which of the following are valid XML names ? (check all valid options) a. Value$
    b. R&T
    c. -Size
    d. Size-
    e. 42books
    f. xmlbooks
    g. xml-data
    h. data-xml

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

    The valid answers are: d,h.

    a - invalid, because it containt the $ character;

    b - invalid, because it contains the & character;

    c - invalid, because it starts with a hyphen ("-"); only Unicode letters, underscore (_) and colons (:) are allowed to start an XML name;

    e - invalid, because an XML name cannot start with a decimal digit;

    f - invalid, because an XML name cannot begin with the string 'xml' (the capitalization does not matter: xml, Xml, xmL or XML are all illegal)

    g - invalid, because an XML name cannot begin with the string 'xml';

  15. Which of the following tags are valid ? (check all valid options)

    a. < CELL >

    b. <Value$>

    c. <CP/M>

    d. < /CELL>

    e. </OperatingSystem_CP/M>

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

    All the enumerated tags are invalid:

    a - invalid, because there is a whitespace bewteen "<" and "CELL"

    b - invalid, because it contains an invalid character: "$"

    c - invalid, bacause it contains an invalid character: "/"; the slash can only be used to start and ending tag; the slash cannot appear in the middle of the tag name.

    d - invalid, because there is a whitespace bewteen "<" and "/CELL"

    e - invalid, bacause it contains an invalid character: "/".

  16. Which of the following tags are valid ? (check all valid options)

    a. <cell/>

    b. <cell />

    c. <cell / >

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

    The valid tags are a & b. The c tag is invalid because the whitespace is not allowed between / and >.

  17. The XML declaration and its encoding attribute:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    must always use US-ASCII characters ? True/False

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

    True. The declaration can specify other encodings for the rest of the document but the line of the declaration must be in US-ASCII format because prior to this line there is no information regarding the true encoding of the document.

  18. Can you use an XSL style sheet to convert an HTML document to valid XML ? Yes/No

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

    No. An XSL stylesheet can only be used to convert a *valid* XML document into something else.

  19. Select the strings that can be used as a name for attributes:

    a. xml:lang

    b. xml:width

    c. xml:space

    d. xmlns:

    e. xmlns:some_ns

    f. xml:base

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

    The valid choices are:

    a - this is a special attribute that must be recognized by conforming parsers; please note that "xml" is not a namespace;

    c - the same as a;

    d - this is the standard way to declare a default namespace;

    e - this is the standard way to declare a namespace;

    f - the same as a;

  20. Is the following xml file well-formed ?
    <!-- comment --> <?xml version="1.0"?> <root> </root>

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

    Answer: No.


I wish you success in your certification effort.







Best regards,
Razvan MIHAIU




Razvan Mihaiu � 2000 - 2017