Quiz - Document Type Definitions - XML


  1. A DTDs is an XML document.
    1. True
    2. False
  2. DTDs contain desclarations for elements and entities.
    1. True
    2. False
  3. DTDs are used to validate XML document.
    1. True
    2. False
  4. Each XML document can be represented as a tree structure.
    1. True
    2. False
  5. Ability to create one’s own tag is XML’s greatest disadvantage.
    1. True
    2. False
  6. DTDs are made up of three blocks of declarations and the DOCTYPE declaration.
    1. True
    2. False
  7. Elements, attributes and entities can be declared in any order.
    1. True
    2. False
  8. DOCTYPE declarations are specified in the prolog of the XML document.
    1. True
    2. False
  9. Internal DTDs specify the DTD within square brackets in the declaration itself.
    1. True
    2. False
  10. External DTDs use the keyword URL to specify the location of the DTD.
    1. True
    2. False



  1. Arrange the steps of creating DTDs.



(A)  Declare all the possible elements.

(B)   Specify the permissible element children, if any

(C)   Set the order in which elements must appear.

(D)  Declare all the possible element attribute.

(E)   Set the attribute data types and values.

(F)    Declare all the possible entities.



  1. Which of the following XML code Snippets is valid?

(A)  <!DOCTYPE mobile  [

<!ELEMENT Mobile (Company, Model, Price, Accessories)>

<!ELEMENT Company (#PCDATA)>

<!ELEMENT Model (#PCDATA)>

<!ELEMENT  Accessories (#PCDATA)>

<ATTLIST Model Type CDATA “camera”>

<!ENTITY HP System “hp.txt“>

<!ENTITY CH System “ch.txt”>

<!ENTITY SK System “sk.txt”>

]>

<Mobile>

<Company>Nokia</Company>

<Mode Type=“camera”>6600</Mode>

<Price>9999</Price>

<Accessories> &HP; , &CH; and a &SK;</Accessories>

</Mobile>



hp.txt

Head Phones



ch.txt

Charger



sk.txt

Starter’s Kit



       (B)<!DOCTYPE mobile  [

<!ELEMENT Mobile (Company, Model, Price, Accessories)>

<!ELEMENT Company (#PCDATA)>

<!ELEMENT Model (#PCDATA)>

<!ELEMENT Price (#PCDATA)>

<!ELEMENT  Accessories (#PCDATA)>

<ATTLIST Model Type CDATA “camera”>

<!ENTITY HP System “hp.txt”>

<!ENTITY SK System “sk.txt”>

]>

<Mobile>

<Company>Nokia</Company>

<Mode Type=“camera”>6600</Mode>

<Price>9999</Price>

<Accessories> &HP; , &CH; and a &SK;</Accessories>

</Mobile>



hp.txt

Head Phones



ch.txt

Charger



sk.txt

Starter’s Kit



(C) <!DOCTYPE mobile  [

<!ELEMENT Mobile (Company, Model, Price, Accessories)>

<!ELEMENT Company (#PCDATA)>

<!ELEMENT Model (#PCDATA)>

<!ELEMENT Price (#PCDATA)>

<!ELEMENT  Accessories (#PCDATA)>

<ATTLIST Model Type CDATA “camera”>

<!ENTITY HP System “hp.txt“>

<!ENTITY CH System “ch.txt”>

<!ENTITY SK System “sk.txt”>

]>

<Mobile>

<Company>Nokia</Company>

<Mode Type=“camera”>6600</Mode>

<Price>9999</Price>

<Accessories> &HP; , &CH; and a &SK;</Accessories>

</Mobile>



hp.txt

Head Phones



ch.txt

Charger



sk.txt

Starter’s Kit



(D) <!DOCTYPE mobile  [

<!ELEMENT Mobile (Company, Model, Price, Accessories)>

<!ELEMENT Company (#PCDATA)>

<!ELEMENT Model (#PCDATA)>

<!ELEMENT Price (#PCDATA)>

<!ELEMENT  Accessories (#PCDATA)>

<ATTLIST Model Type CDATA “camera”>

<!ENTITY HP System “hp.txt“>

<!ENTITY CH System “ch.txt”>

<!ENTITY SK System “sk.txt”>

]>

<Mobile>

<Company>Nokia</Company>

<Mode Type=“camera”>6600</Mode>

<Price>9999

<Accessories> &HP; , &CH; and a &SK;</Accessories>

</Mobile>



hp.txt

Head Phones



ch.txt

Charger



sk.txt

Starter’s Kit



  1. Element can contain character data but to be parsed, incase it contain entity references
    1. <!ELEMENT element-name (type|child-name|…)>
    2. <!ELEMENT element-name (child-name+)>
    3. <!ELEMENT element-name (child-name,(child-name|child-name|…)>
    4. <!ELEMENT element-name (#PCDATA)>
    5. <!ELEMENT element-name (child-elemnt-name)>



  1. Element with a number of children appearing only once in the XML document.
    1. <!ELEMENT element-name (type|child-name|…)>
    2. <!ELEMENT element-name (child-name+)>
    3. <!ELEMENT element-name (child-name,(child-name|child-name|…)>
    4. <!ELEMENT element-name (#PCDATA)>
    5. <!ELEMENT element-name (child-elemnt-name)>



  1. Element can accept either data type or children, etc.
    1. <!ELEMENT element-name (type|child-name|…)>
    2. <!ELEMENT element-name (child-name+)>
    3. <!ELEMENT element-name (child-name,(child-name|child-name|…)>
    4. <!ELEMENT element-name (#PCDATA)>
    5. <!ELEMENT element-name (child-elemnt-name)>



  1. Element’s children appear at least once in the XML document.
    1. <!ELEMENT element-name (type|child-name|…)>
    2. <!ELEMENT element-name (child-name+)>
    3. <!ELEMENT element-name (child-name,(child-name|child-name|…)>
    4. <!ELEMENT element-name (#PCDATA)>
    5. <!ELEMENT element-name (child-elemnt-name)>



  1. Element can have either one of two or more  children.
    1. <!ELEMENT element-name (type|child-name|…)>
    2. <!ELEMENT element-name (child-name+)>
    3. <!ELEMENT element-name (child-name,(child-name|child-name|…)>
    4. <!ELEMENT element-name (#PCDATA)>
    5. <!ELEMENT element-name (child-elemnt-name)>



  1. Name of a notation.
    1. NMTOKEN
    2. NOTATION
    3. (en1|en2|…)
    4. xml:
    5. IDREF



  1. Predefined xml value.
    1. NMTOKEN
    2. NOTATION
    3. (en1|en2|…)
    4. xml:
    5. IDREF



  1. id of another element.
    1. NMTOKEN
    2. NOTATION
    3. (en1|en2|…)
    4. xml:
    5. IDREF



  1. valid xml name.
    1. NMTOKEN
    2. NOTATION
    3. (en1|en2|…)
    4. xml:
    5. IDREF



  1. enumerated list.
    1. NMTOKEN
    2. NOTATION
    3. (en1|en2|…)
    4. xml:
    5. IDREF
  2. Which of the following XML code is correct?

(A) <!DOCTYPE mobile  [

<!ELEMENT Mobile (Company, Model, Price, Accessories)>

<!ELEMENT Company (#PCDATA)>

<!ELEMENT Model (#PCDATA)>

<!ELEMENT Price (#PCDATA)>

<!ELEMENT  Accessories (#PCDATA)>

<ATTLIST Model Type CDATA “camera”>

<!ENTITY HP “Head Phones”>

<!ENTITY SK “Starter’s Kit ”>

]>

<Mobile>

<Company>Nokia</Company>

<Mode Type=“camera”>6600</Mode>

<Price>9999</Price>

<Accessories> &HP; , &CH; and a &SK;</Accessories>

</Mobile>



(B) <!DOCTYPE mobile  [

<!ELEMENT Mobile (Company, Model, Price, Accessories)>

<!ELEMENT Company (#PCDATA)>

<!ELEMENT Model (#PCDATA)>

<!ELEMENT Price (#PCDATA)>

<!ELEMENT  Accessories (#PCDATA)>

<ATTLIST Model Type CDATA “camera”>

<!ENTITY HP “Head Phones”>

<!ENTITY CH “charger”>

<!ENTITY SK “Starter’s Kit”>

]>

<Mobile>

<Company>Nokia</Company>

<Mode Type=“camera”>6600</Mode>

<Price>9999</Price>

<Accessories> HP , CH and a SK</Accessories>

</Mobile>



 (C) <!DOCTYPE mobile  [

<!ELEMENT Mobile (Company, Model, Price, Accessories)>

<!ELEMENT Company (#PCDATA)>

<!ELEMENT Model (#PCDATA)>

<!ELEMENT Price (#PCDATA)>

<!ELEMENT  Accessories (#PCDATA)>

<ATTLIST Model Type CDATA “camera”>

<!ENTITY HP “hp.txt”>

<!ENTITY CH “ch.txt”>

<!ENTITY SK “sk.txt”>

]>

<Mobile>

<Company>Nokia</Company>

<Mode Type=“camera”>6600</Mode>

<Price>9999</Price>

<Accessories> &HP; , &CH; and a &SK;</Accessories>

</Mobile>



(D) <!DOCTYPE mobile  [

<!ELEMENT Mobile (Company, Model, Price, Accessories)>

<!ELEMENT Company (#PCDATA)>

<!ELEMENT Model (#PCDATA)>

<!ELEMENT Price (#PCDATA)>

<!ELEMENT  Accessories (#PCDATA)>

<ATTLIST Model Type CDATA “camera”>

<!ENTITY HP “Head Phones”>

<!ENTITY CH “Charger”>

<!ENTITY SK “Starter’s Kit”>

]>

<Mobile>

<Company>Nokia</Company>

<Mode Type=“camera”>6600</Mode>

<Price>9999</Price>

<Accessories> &HP; , &CH; and a &SK;</Accessories>

</Mobile>
Share on Google Plus

About Hà Tuấn Anh

0 nhận xét:

Đăng nhận xét