Observe the given DTD: <?XML version ="1.0"?> <!DOCTYPE SITES[ <!ELEMENT SITES…

2017

Observe the given DTD: <?XML version ="1.0"?> <!DOCTYPE SITES[ <!ELEMENT SITES (SITES +)> <!ELEMENT SITE (ADDRESS UTILITY)> <!ELEMENT ADDRESS (#PCDATA)> ]> Choose the statement that is true about the above DTD.

Answer: C. Element ADDRESS and UTILITY both are to be present in specified order.Correct statement: Element ADDRESS and UTILITY both are to be present in specified order. Why this is correct: The SITE element is declared with the content…

  1. A.

    ADDRESS AND UTILITY elements are empty elements.

  2. B.

    Root element is SITE which in turn contains two sub-elements.

  3. C.

    Element ADDRESS and UTILITY both are to be present in specified order.

  4. D.

    The SITE element is optional.

Attempted by 293 students.

Show answer & explanation

Correct answer: C

Correct statement: Element ADDRESS and UTILITY both are to be present in specified order.

  • Why this is correct:

  • The SITE element is declared with the content model (ADDRESS UTILITY), which requires an ADDRESS element followed immediately by a UTILITY element inside SITE.

  • ADDRESS is declared as (#PCDATA), so ADDRESS must contain text content (it is not an empty element).

  • The snippet references UTILITY in the SITE content model but does not show a declaration for UTILITY; nevertheless, the content model requires the UTILITY element to appear in that position.

Additional notes about the provided DTD snippet:

  • The DOCTYPE names SITES as the root element, so the document root is SITES (not SITE).

  • The declaration <!ELEMENT SITES (SITES +)> appears malformed or recursive; likely the intended declaration was <!ELEMENT SITES (SITE+)> to indicate one or more SITE elements.

  • A complete DTD should include a declaration for UTILITY; its absence in the snippet is an omission.

Why the other statements are incorrect:

  • The claim that ADDRESS and UTILITY are empty is wrong because ADDRESS is declared as containing text (#PCDATA) and UTILITY has no declaration shown.

  • The claim that SITE is the root is wrong because the DOCTYPE lists SITES as the root element.

  • The claim that SITE is optional is incorrect; SITE is part of the intended SITES structure and not declared optional in the SITE content model.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Rssb Basic Computer Instructor

Loading lesson…