HTML/XHTML/XML Sample Test Answers
MY BEST ANSWERS ARE IN BLUE
1. In which element would you write the following HTML Web page features:
(circle either BODY or HEAD for all five features)
A script to surf the Web for a current stock price BODY HEAD
A title for the browser title bar to display BODY HEAD
A section heading for an on-line instruction manual BODY HEAD
A client-side image map BODY HEAD
A link to a form processing process BODY HEAD
Comments:
1. If you are going to write a script to surf the Web for a stock price, you should
write it in the HEAD so it can start running early in the page delivery. You
can often write it in the body but it is better in the head because it requires
pre-processing (especially if you are going to show the stock price in the body
later on in the page). 53% of you thought it should go in the body but no one
wrote any notes as to why they thought so. A few of you wrote it could go in
both places which is fine (but still better in the head for processing efficiency).
Bottom line: Any pre-processing should go in the head element whenever possible.
2. Everyone got the TITLE element placement correct.
3. The section heading is text embedded within the body text. It belongs in the
body. 87% of you agreed with that statement.
4. A client-side image map is implemented with three different elements: IMG for
the visuals, MAP for the mapping, and AREA for the specification of the regions on
the map. This is best kept together in the body of the page. If you use common sense
though, you might think the MAP could be considered pre-processing in the head element.
I like your thinking but it isn't typical to break things up and hyperlinks, which
the AREA tags include as HREF attributes, should be kept in the body. Only three of
you chose the wrong answer and yet those three scored the highest on the exam. 90%
chose the intended BODY answer.
5. 93% of you agreed that the ACTION attribute handles activating the form processing
routine. The ACTION attribute belongs within the opening FORM tag which is always in
the body of the Web page (since it appears visually there).
2. You are authoring an HTML Web page on a computer in Brazil. The keyboard is mapped
using a Linux-provided Portuguese keyboard driver. You want to have a Lambda (Greek capital
letter) appear in the body of your page. Will the following approaches get the job done
for all general public audiences that use a Brazilian version of Internet 6?
(circle either YES or NO for all five approaches)
You remap your keyboard using a Linux-provided Greek
driver and press the key associated with the Lambda character. YES NO
You type the proper character entity for Lambda in the flow
of your text. YES NO
You create a GIF image of the Lambda symbol and insert an
IMG tag that inserts the GIF where you need the Lamda. YES NO
You place the Lambda inside a FONT element that has an
attribute FACE=Greek that includes a Lamda in the font set. YES NO
You create a Lambda in a specialized text editor that creates
Lambda symbols in UTF8 and you copy and paste the Lambda into
your HTML document. YES NO
Comments:
1. Remapping your keyboard with a Linux driver that creates a Lambda works great as
long as your text editor maintains the UTF8 encoding from interaction with the keyboard
mapping software (driver). Once you have the UTF8 encoded Lambda in place, the browser
shows the Lambda fine to all audiences. So, although only 30% of you agree with me, I
think YES is the better answer. But, if you chose NO, you were in the majority and probably
none of you would remap your keyboard to type a single Lambda anyway. If I write this
question again, I might try to be clearer as to the text editor being UTF8 compliant.
I was hoping some of you would have written that clarification yourselves as I could
then have given you credit if you were thinking about that.
2. This is the fastest approach to provide a reliable Lambda character. 93% of you agreed
it would work fine.
3. Using an IMG tag is very reliable and will work for all audiences. It is a wasteful
approach to take but 90% of you agreed it would work.
4. Fonts only provide reliable characters if the audience has the font on their
computer system already. Fonts are not delivered with HTML pages. This is not
a reliable approach. 80% of you agreed with me.
5. If you know you have a valid UTF8 Lambda character on your clipboard (from the copy
command), and you see the Lambda as you paste it into your text editor, your audience
will see the Lambda character fine also when you publish your page. 70% of you agreed
with this assessment.
3. You surf the Web and find an HTML page you like visually. You view the source of the page
and see text that appears as <TR BGCOLOR=#0FBF0F>. What do you know as a result?
(circle one BEST answer for each of the two multiple choice questions)
a. The author added color to a single cell of a table.
b. The author added colored to one row of a table.
c. The author added color to a whole table.
d. The author is likely at risk of the browser mistaking his intent.
a. The Web page likely shows some red on the page.
b. The Web page likely shows some green on the page.
c. The Web page likely shows some blue on the page.
d. The Web page likely shows some yellow on the page.
Comments:
I expected everyone to get these correct. 90% of you knew that TR was the table
row element (v. TD for answer a or TABLE for answer c) and 73% of you knew
the #0FBF0F was predominantly green (remember: #RRGGBB which means the color
is 15/255 red, 176/255 green, and 14/255 blue). You can never have a yellow
hue with equal parts red and blue.
4. Which of the following are recommended HTML approaches you use to provide spacing in
a Web page?
(circle ALL that are recommended)
a. using a BR tag to apply a line break
b. using a P tag to apply a paragraph break
c. using a CB tag to apply a column break
d. using a HR tag to apply a visual section break
e. using the correct character entities for tabs and additional spaces
Comments:
93% of you knew there is no such CB tag in the HTML specifications. Column breaks
should be made via the appropriate use of TD tags. Exactly half of you knew
there were character entities available for some document spacing (such as
tabs and spaces). Perhaps you weren't sure that they were blessed by the
W3C? All character entities that comply to the UTF8 standard are recommended
by the W3C as the W3C recommends all use of UTF8 text.
5. When is it usually appropriate to use a relative URL instead of an absolute URL?
(circle ALL answers that are appropriate)
a. when you reference an image SRC on the same server as your Web page
b. when you reference a link to your style sheet on the same server as your Web page
c. when you reference an image SRC on a server different than your Web page
d. when you reference another bookmark in your Web page
Everyone but 1 of you selected a and b as correct. Only 53% of you knew that a
bookmark in the same page is referenced by a relative URL (for example, by using
HREF=#sectionX where sectionX is a named bookmark in your page).
Can you use a relative URL for all the above under ANY circumstances? YES NO
Only 40% of you agreed with the YES answer here. You will all now agree that
a, b, and d regularly use relative URLs. Because a domain controller server
provides a uniform URL presentation to the rest of the world, and because
the domain controller server can organize content from multiple servers
within the domain, you can access image SRC URLs relatively, even though the image
is on a different server. The domain controller just provides the addressable
illusion that the content is all on one server.
6. Using just the HTML 3.2 specification (and nothing specified after that time), which is the
best approach to controlling page layout to make it appear the same to all audiences?
(circle the one BEST answer)
a. use table tags and attributes along with images to stabilize the presentation
b. type your HTML code using fixed-width fonts
c. create your Web page, present it in a Web browser, and create an IMG element from a screen shot of the page.
d. implement a FRAMESET with appropriate tags and attributes
67% of you knew answer a is the best approach. 20% of you thought it would be
better to create an image of your content and put just the image on the page. That
approach would work but it is wasteful of the network and therefore is inferior. 13%
of you answered d. FRAMESETs are a great way to control Web site navigation, but
they just defer the page layout to the HTML documents that fill the frames. You
then still have unreliable layout in those frames.
7. Which of the following 4 technologies was not built specifically to coexist well with HTML?
(circle the one BEST answer that was not)
a. CSS b. DHTML c. SGML d. XML
I asked this exact same question on last year's HTML test. No one got it wrong
last year so I hoped to give you free points. 27% of you thought CSS was not
built specifically to work with HTML. CSS ties into HTML nicely as you will
see shortly in class. 10% of you chose XML. Next week you will see that XML
works well with HTML via the XLST translation process. In class, we discussed
where the HTML syntax got its start. SGML, a 1970s language, suggested the
syntax (using < and > in tags for example). Since it was developed before
HTML, it had no consideration of HTML within its specification. 67% of you
agreed with that.
8. Put the development of the following technologies in historical order:
(Type 1 for first oldest, 2 for second, 3 for third, 4 for fourth, and 5 for fifth)
4 Internet Explorer Web Browser
1 or 2 HTML 1.0
5 CSS 2
3 Netscape Web Browser
1 or 2 Mosaic Web Browser
60% of you ordered the answers correctly. This question came directly from lecture.
Extra: Which two were developed closest together in time? HTML 1.0 and Mosaic
9. Which of the following are valid HTML 3.2 elements for creating lists in Web pages?
(circle ALL that are valid)
a. Definition Lists (DL elements)
b. Ordered Lists (OL elements)
c. Tabbed Lists (TL elements)
d. Unordered Lists (UL elements)
e. Weighted Lists (WL elements)
Comments:
There are no such TL or WL elements in the HTML specification. 30% of you didn't
skim the section in the readings on DL lists. Only 17% of you suggested the TL
answer and 7% of you suggested the WL answer.
10. Which of the following are true statements regarding HTML Hyperlinks (aka Links)?
(circle ALL that are true statements)
a. Hyperlinks let you create a link to any Web page your browser can access by a URL.
b. Hyperlinks are best implemented via a LINK element.
c. Hyperlinks must link to the top or a bookmark within HTML Web pages only.
d. Anchors have 2 popular uses: Referencing other resources and naming bookmarks.
e. Audiences access hyperlink HREF URLs by clicking on text or images in your Web page.
Comments:
97% of you knew a and e were correct answers. 73% of you knew d was correct as well. Of course
Hyperlinks can link to any resource, not just HTML pages. You've seen examples by clicking
on a sound byte or software download from within a page. Perhaps I feel a bit like an NBA
referee on this one as I don't like my wording of answer c so well. I am thankful only
two of you selected it as true. The LINK element is used to link your Web page to another
page on the Web that needs to be interpreted along with your page in order to present your
content faithfully. The LINK element belongs in the HEAD section. We will be formally
introduced to the LINK element when we consider CSS integration.
11. To get you started: Place the letter for the best description in front of each term
(place each letter on the right once in front of the best term on the left).
__d__ XML Schema a. a document validating language not following XML syntax
__a__ DTD b. a methodology and syntax for generating new markup languages
__c__ XSLT c. a document translating language that strictly follows XML syntax
__b__ XML d. a document validating language that strictly follows XML syntax
Most of you got these correct. I would hope so as this answer is the minimum you should
know about XML and related technologies going forward in life.
12. Which of the following changes would you have to make to encode an HTML document according to
the XHTML specification? (circle the letter before all changes to be made)
a. add a <?xml ... ?> directive tag at the beginning of the document in place of the <HTML> tag
b. change each tag and attribute name, if necessary, to be consistent in case use
c. place a quotation mark (") before and after all attribute values that currently lack them
d. add forward slash characters ('/') before the ending > symbol of all img and br tags
e. convert all HTML 2 tags to HTML 4 tags
These should be obvious as you review Chapter 1 of our XML book (page 23). HTML 2 tags are
already HTML 4 tags as the HTML standard is backward compatible.
13. Which of the following are advantages of using XHTML instead of HTML for sharing presentation data over
the Web? (circle the letter before each correct answer)
a. XHTML is easier to validate because there is an available XML Schema that automates the process.
b. Human beings can write XHTML much easier than they can write HTML.
c. Applications that use XML documents are easier to write with a strict specification.
d. Languages built upon XML technology contain more specific subject matter than non-XML encodings.
e. XHTML has been available for use in popular Web browsers much longer than HTML
I threw out part d. of this question as I began to read it differently based on your answers.
My intent was to test your knowledge of whether XML had any built-in ability to specify the subject matter. The
subject matter must be added to the document by a domain specialist just as is necessary with a non-XML
encoded document. The XML is intended to be just a mark-up of existing data. But, you could have thought I was
asking about the schema's ability to keep the data within a defined range (or enumeration). I wasn't but I bet
some of you were thinking that way when you answered. The other answers should be obvious based on lecture and
reading the book. Most of you got them correct.
14. Which of the following statements are true regarding DTD and XML-Schema:
(circle the letter before all those that are true statements)
a. Both DTD and XML Schema exist to validate XML documents.
b. XML Schema is a more recent technology than DTD technology.
c. DTD includes native types and grouping elements that XML Schema does not.
d. DTD and XML Schema documents become more valuable as XML languages gain acceptance.
e. XML syntax rules apply to both DTD and XML Schema when determining document validity.
XML Schema includes the native types and grouping elements, not DTD.
There is no requirement that DTDs follow XML syntax rules (obvious by looking over the lack
of quotation marks around attribute values for example).
15. Which of the following does an XML Schema document give you that a DTD does not?
(circle the letter in front of all XML Schema benefits)
a. the ability to verify the XML Schema document using the same XML validation techniques as the XML document itself
b. a useful distinction between local and global objects
c. a finer distinction between data types for element content and attribute values
d. the ability to parse (identify the keywords within) the document with standard XML parsing software
e. backward integration with documents written prior to the XML specification
Most of you got these correct. XML Schema follows the XML specification. DTD allows for
backward integration with other validated documents prior to XML, not XML Schema
16. XML Schema documents are usually declared externally (in a separate file on a Web server). Which
of the following is the proper way to let an XML processing application know immediately there is
an external XML Schema document available for use? (circle the letter before the one best answer)
a. add a standalone="no" attribute to the opening <?xml directive.
b. add a standalone="yes" attribute to the opening <?xml directive.
c. add a public="no" attribute to the DOCTYPE element
d. add a public="yes" attribute to the DOCTYPE element
e. add a private="no" attribute to the DOCTYPE element
The DOCTYPE element is a DTD-related concept, not XML Schema. Most of you got this right.
17. Identify the significance of the following DTD element (place a letter from the right in the
blank before the best component on the left):
<!ELEMENT w x | (y, z)>
__b__ w a. the name of a single element that can be nested inside this element
__a__ x b. the name of a valid element for the XML document
__e__ | c. one element name that can be nested inside this element before another required element
__c__ y d. one element name that can be nested inside this element after another required element
__f__ , e. the declaration that a choice can be made
__d__ z f. the identification of the sequencing within the document
g. none of the above
An example of this would be <!ELEMENT circle center | (top, right)> for the definition
of the center of a circle.
18. Identify the significance of the following DTD element (place a letter from the right in
the blank before the best component on the left):
<!ATTLIST w x CDATA #IMPLIED>
__d__ w a. declares that the attribute is required
__c__ x b. declares that the attribute is optional
__e__ CDATA c. the name of a valid attribute for the XML document
__b__ #IMPLIED d. the name of a valid element for the XML document
e. declares that any stream of characters can be placed in the attribute value
f. none of the above
An example of this would be <!ATTLIST circle radius CDATA #IMPLIED> for part of the
definition of a circle.
19. Which of the following is true of XSLT? (circle the letter before all true answers)
a. One XSLT document is used to convert an XML document into many different types of documents.
b. XSLT processors are embedded in most of the popular Web browsers used to browse Web content.
c. XSLT generates output through the use of templates that connect to elements in an XML document.
d. XSLT includes XSL-FO (for Formatting Objects) technology that is also managed by the W3C
e. XSLT is designed in order to be able to convert HTML documents into XHTML documents
a. is incorrect because one XSLT document converts many different XML documents (all based on
the same schema) to one type of output document. b. is incorrect because you need an external application to
process XSLTs (such as SAXON mentioned in the book). d. is incorrect because XSL-FO is separate to XSLT and
explicitly split off from XSLT by the W3C. e. is incorrect because you can use XSLT to convert XHTML to HTML
but not the other way around.
20. Given a future where XML thrives even well beyond today's successes, which of the following make
sense as research directions for XML technology? (circle the letter before all correct answers)
a. Developing database technology where XML documents are stored in their raw XML format.
b. Developing document use analysis technologies that can help suggest proper schemas for XML-based languages.
c. Developing database technology where all Web database interaction is done via XML-based documents.
d. Developing better XML processing technologies that are made freely available to everyone
e. Developing Web services technology where all information passing and service interaction is done via XML-based documents.
XML is ripe to perform all these services and therefore these opportunities deserve continued research as
long as XML is thriving.
21. 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 certain elements must be in a certain order
__a__ 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
__e__ xsd:group e. tells the XML document these elements should be considered together
The class did very well on this question.
22. When considering XHTML (or HTML) presentation formatting with tables, which of the following are
true statements (circle the letter before all correct answers):
a. width attributes within td elements tend to define maximum width more so than minimum width.
b. height attributes should never force a change of font size according to the XHTML specification.
c. Tables automatically modify all visual elements equally to meet overall height and width requested.
d. A td element may contain a table element between its and | tags.
e. The ratio attribute can be used to guarantee image resizing to maintain aspect ratio.
Tables do not modify images ever, no matter what height and width specifications. There is no
such thing as a ratio attribute. The ratio is calculated internally based upon accessing the image file referenced.
23. Which of the following statements are true regarding Uniform Resource Locator (URL) use in Web technologies
such as XML and XHTML? (circle the letter before all correct answers)
a. URLs that begin with a protocol (http://, ftp://, udp:// etc.) specification are all absolute.
b. Relative URLs can identify a parent directory via the use of two periods (..).
c. Relative URLs can identify a child directory via the use of two periods (..).
d. Generally you should always use relative URLs, when possible, for portability.
e. The URL specification allows for the use of forward (/) or backward (\) slashes in valid addresses.
The class did very well on this question.
24. Which of the following statements are true regarding XML and related technologies? (circle the letter
before all true answers)
a. XHTML can be written with a simple text editor as it discourages word processing meta characters.
b. XSLT allows you to translate multiple XML documents with the same XSLT document.
c. An XML Schema document might refer to another XML Schema document when processing XML.
d. XML documents become more valuable as data is reused in multiple applications.
e. Agreeing on XML tag keywords for an industry with many constituents is often much more difficult than
writing an XML Schema document for it.
These are all true statements, especially e. Agreement of vocabulary and relationships between concepts
is a very complex task. Humans do it better than computers, but humans are also more easily biased than
computers. The personal biases ( or experiences) make the process significantly more difficult.
25. Which of the following zodiac_sign elements could be valid according to the W3C XML 1.0
specification? (circle the letter before all those that are valid (proper))
a. <zodiac_sign type=animal>Leo</zodiac_sign>
b. <zodiac_sign type="animal">Aries</zodiac_sign>
c. <zodiac_sign type=animal name=Taurus/>
d. <zodiac_sign type="inanimate object">Libra</zodiac_sign>
e. <zodiac_sign "life class"="animal">Cancer<zodiac_sign>
The class did very well on this question. a. is incorrect because you
must have quotes around attribute values and animal does not. c. is incorrect for the same
reason. e. is incorrect because attribute names can not have spaces in them and life class
has such a space.
26. If you want to guarantee that there are only a limited number of possible values for a leaf
node element (meaning an element without children) to contain in a valid document based on
your markup language, which XML Schema feature can you take advantage of to document the only
valid values (circle the letter before the one best answer):
a. the xsd:enumeration element.
b. the xsd:validlist element
c. the ability to identify valid values in a list within parenthesis
d. the ability to redefine elements of the same name multiple times
e. XML Schema does not provide the ability to guarantee limited valid values within elements
See page 83 in our XML book
27. Which of the following is true about the relationship between XHTML elements and attributes?
(circle the letter before all true answers)
a. All elements must contain at least one attribute.
b. Attribute names can be reused within tags of different element types.
c. Attributes extend elements to make the element more specific in significance.
d. Elements can contain other elements.
e. Attributes can contain other attributes.
The class did very well on this question.
28. Which of the following is the best description of the relationship between HTML and XHTML
(circle the letter before the one best answer):
a. XHTML is a subset of HTML
b. HTML is a subset of XHTML
c. HTML is an XML encoding of XHTML
d. XHTML is an XML encoding of HTML
e. HTML the result of an XSLT application of XHTML
Say that over and over again like I did in class and in your Project 1 Requirements. All other
answers are quite false in comparison. HTML is not the result of anything to do with XML. It came first.
29. Which of the following is the best description of the use of the match attribute within the XSLT
language (circle the letter before the one best answer):
a. Often found in the xsl:stylesheet element, the match attribute identifies which version of the validating schema should be used in the XSLT process.
b. Often found in the xsl:stylesheet element, the match attribute identifies which version of XML is being used when considering the input document in the XSLT process.
c. Often found within xsl:template elements, the match attribute identifies which elements in the source document should be input during this piece of the XSLT process.
d. Often found within xsl:template elements, the match attribute identifies which elements in the target document should be output during this piece of the XSLT process.
e. Often found within XSLT processing directive elements such as xsl:sort or xsl:filter, the match attribute identifies further information in terms of how to match input and output documents.
See page 139 in our XML book
30. Your turn. Write an XML-related question and answer that shows off your knowledge on the subject (i.e.
something not covered by questions in the test above):