HTML/XHTML/XML Test Answers
MY BEST ANSWERS ARE IN BLUE
1. Write an appropriate DTD tag that would validate an earthquake element given these requirements: nested elements
must appear in order with exactly one date, one location, one magnitude, and one or more recording_sensor elements
per earthquake.
<!ELEMENT earthquake (date, location, magnitude, recording_sensor+)>
Write the appropriate DTD tag(s) that would validate a date element’s attributes given these requirements:
All date elements must have year, month, day, hour, minute, and millisecond attributes. There is no
requirement as to which order the attributes must appear.
<!ELEMENT date EMPTY>
<!ATTLIST date year CDATA #REQUIRED>
<!ATTLIST date month CDATA #REQUIRED>
<!ATTLIST date day CDATA #REQUIRED>
<!ATTLIST date hour CDATA #REQUIRED>
<!ATTLIST date minute CDATA #REQUIRED>
<!ATTLIST date millisecond CDATA #REQUIRED>
Note: The !ELEMENT DTD element was not required in the answer. I add that for context here.
2. Fill in the rest of the XML encoding here to create a valid earthquake element according to the requirements
and DTDs you generated in question 1 (make up valid element and attribute values of your choice):
<earthquake>
<date year="2006" month="May" day="08" hour="09" minute="29" millisecond="010" />
<location>
<latitude>-31.4899088</latitude>
<longitude>-125.3400988</longitude>
<depth units="meters">2209.8</depth>
</location>
<magnitude>3.45</magnitude>
<recording_sensor>CA87232</recording_sensor>
</earthquake>
Is there anything in the earthquake element above that is not compliant with the XML 1.0 specification that
wasn't caused by your contribution (circle YES or NO)?
YES NO
3. Which of the following area elements are valid according to the W3C HTML 3.2 specification:
(circle the letter before all those that are valid)?
a. <area href=guide.html alt="Access Guide" shape=rect coords="0,0,118,28">
b. <AREA HREF=guide.html alt="Access Guide" shape=rect coords="0,0,118,28">
c. <area href=guide.html alt="Access Guide" shape=circle coords="0,0,118,28">
d. <AREA href=guide.html alt="Access Guide" shape=poly coords="0,0,118,28">
e. <area HREF=guide.html alt="Access Guide" shape=rect coords=0,0,118,28>
AREA elements are usually nested inside which other HTML 3.2 element? ______ MAP ___________
4. Cascading Style Sheets (CSS) let you modify the presentation of an existing Web page which is HTML 3.2 compliant. There are multiple ways you can apply the CSS specification to do so. Put the letter associated with each item on the right in front of the best corresponding example of that item on the left.
_e__ <STYLE>p font-size:14</STYLE> a. local style sheet implementation
_c__ <LINK HREF=styles.css ...> b. CSS attribute
_a__ <A STYLE=font-size:14px HREF=...> c. external style sheet implementation
_b__ font-family d. CSS attribute value
_d__ Verdana,Arial e. internal style sheet implementation
5. Please provide valid HTML 3.2 code to present an external image file named logo.gif in a Web page (fill out the
details of a single element which would produce the intended result):
<IMG SRC=logo.gif>
6. In which element would you write the following HTML Web page features (circle either BODY or HEAD for the best parent element for all five features):
A SCRIPT element that surfs the Web for a current stock price BODY HEAD
A META element to document authorship of the Web page BODY HEAD
A DIV element used in an on-line instruction manual BODY HEAD
A TITLE element the browser uses to display a window title BODY HEAD
A SUBMIT button used for a form processing process BODY HEAD
7. Which of the following graphical form controls can you create using a single HTML 3.2-compliant element (circle the letter before all correct answers)?
a. text edit box
b. combination edit text/list box
c. drop-down list box
d. checkbox
e. radio button
f. clickable button labeled DONE
8. Which of the following are valid XML Schema data types (circle the letter before all correct answers)?
a. xsd:date
b. xsd:integer
c. xsd:decimal
d. xsd:string
e. xsd:time
All are valid and useful data types for expressing which data should be associated with an element and its attributes
9. What is the significance of the following XML Schema and XSLT element names to their related XML document (place one letter from the right in the blank before the best element on the left)?
_d__ xsd:choice a. tells the XML document these elements should be considered together
_e__ xsd:sequence b. processes an XML element there only if it meets a true/false condition
_b__ xsl:if c. processes a document by looping instructions for a set of elements
_c__ xsl:for-each d. tells the XML document only one of a set should be used in an element
_a__ xsd:group e. tells the XML document certain elements must be in a certain order
10. Which of the following does an XML Schema document give you that a DTD does not (circle the letter in front of all correct XML Schema benefits)?
a. a useful distinction between local and global objects
b. the ability to group validating elements for reuse in the validation process
c. the ability to verify the document using the same XML validation techniques as the document
d. the ability to parse the document with standard XML parsing software
e. a finer distinction between data types for element content and attribute values
All are valid and useful features of XML Schema that the DTD specification does not provide.
11. Which two of the following HTML tags used together allow for an HTML 3.2-compliant presentation method for presenting more than one Web page visually in a Web browser at the same time (circle two of the letters in front of the best pair answer)?
a. AREASET
b. CELL
c. FRAME
d. FRAMESET
e. MAP
f. SPAN
12. Match the letter in front of a valid HTML 3.2 element on the right with its intended purpose on the left (write the best letter in front of each item on the left):
_e__ adds a blank line of vertical space to presented text a. <BR>
_a__ creates a line break to continue text further left b. <HR>
_d__ often renders indented text from right and left c. <P>
_b__ adds a printed line of vertical space to presented text d. <BLOCKQUOTE></BLOCKQUOTE>
_e__ adds a shim (empty void area) to the flow of text e. <IMG SRC=blank.gif>
13. Which of the following are valid HTML 3.2 elements for creating lists in Web pages (circle the letter before all that are valid)?
a. Ordered Lists (OL elements)
b. Tabbed Lists (TL elements)
c. Unordered Lists (UL elements)
d. Weighted Lists (WL elements)
e. Definition Lists (DL elements)
14. Which of the following is true of XSLT? (circle the letter before all correct answers)?
a. XSLT is designed in order to be able to convert HTML documents into XHTML documents
b. XSLT includes XSL-FO (for Formatting Objects) technology that is also managed by the W3C
c. XSLT generates output through the use of templates that connect to elements in an XML document.
d. One XSLT document is used to convert an XML document into many different types of documents.
e. XSLT processors are embedded in most of the popular Web browsers used to browse Web content.
15. Which of the following statements are true about HTML 3.2 (circle the letter before all true statements)?
a. visual text size increases with the value of a FONT element's SIZE attribute value.
b. visual text size decreases with the value of a FONT element's SIZE attribute value.
c. visual text size increases with the value of a STYLE attribute's font-size value
d. an H1 element's nested text visually appears larger than an H2 element's.
e. an H5 element's nested text visually appears larger than an H4 element's.
16. For each term on the left, place the letter in front of the best description of that term on the blank line in
front of the term (place each letter once in front of the best term on the left):
_c__ DTD a. a methodology for referring to elements and attributes in XML documents
_e__ XML b. a document validating language that strictly follows XML syntax
_a__ XPath c. a document validating language not using XML syntax
_b__ XML Schema d. a document translating language that strictly follows XML syntax
_d__ XSLT e. a methodology and syntax for generating new markup languages
17. Your turn. Please provide a question and answer for something interesting you learned about HTML, XHTML, or XML: