Chapter 4 Self-Review / Exercises

Tech 64095 Computer Technology
Ralph Varckette
Self-Review – Chapter 4
4.1
a) An ordered list cannot be nested inside an unordered list. False. Ordered list can
be nested inside an unordered list and vice versa.
b) XHTML is an acronym for XML HTML. False, XHTML is an acronym for
Extensible Hyper Text Markup Language.
c) Element br represents a line break. False, You can specify the width of any
column, either in pixels or as a percentage of the table width.
d) Hyperlinks are denoted by link elements. False, Hyperlinks are denoted by a
elements,
e) The widths of all data cells in a table must be the same. False. You can specify the
width of any column, either in pixels or as a percentage of the table width.
f) You are limited to a maximum of 100 internal links per page. False. You can have
an unlimited number of internal links.
4.2
a) The hr element insures a horizontal rule.
b) A superscript is marked up using element sup, and a subscript is marked up using
element sub.
c) The least important heading element is h6, and the most important heading element
is h1.
d) Element ul marks up an unsorted list.
e) Element p marks up a paragraph.
f) The type = “reset” attribute in an input element inserts a button that, when clicked,
clears the content of the form.
g) The tr element marks up a table row.
h) Asterisks are usually used as masking characters in a password box.
Exercises – Chapter 4
4.3
<html>
<h1>Internet and World Wide Web How to program: Fourth edition </h1>
<hr/>
<p>Welcome to the world of Internet Programing. We have provided </p>
<p>topical coverage for many internet related topics.</p>
</html>
1
Tech 64095 Computer Technology
Ralph Varckette
4.4
Why is the following markup language invalid?
This is markup is invalid because the <p> </p> code is not balanced. There are
two <p> and only one </p>. If the second <p> is removed then this becomes one
paragraph. If the first <p> is removed then there are two paragraphs.
<p>here is some text...
<br />
<p>and here is some more text… </p>
4.5
Why is the following markup language invalid?
This is markup is invalid because the <p> </p> code is not necessary. The line
break code <br> will place the second line over the first.
<p>here is some text... <br>
and here is some more text..</p>
4.6
An image named deitel.gif is 200 pixels wide and 150 pixels high. Write an XHTML
statement using the width and height attributes of the img element to perform each of the
transformations.
a) <img src="deitel.gif" width="200" height="150"/>
b) <img src="deitel.gif" width="300" height="225"/>
c) <img src="deitel.gif" width="200" height="100"/>
4.7
Create a link to each of the following
a)
b)
c)
d)
e)
4.8
<a href="files/index.html">index.html</a>
<a href="text/files/index.html">index.html</a>
<a href="index.html">index.html</a>
<a href="mailto:[email protected]">The President</a>
<a href = “ftp://ftp.cdrom.com/pub/readme”
Create an XHTML document containing three ordered lists of ice cream, soft serve and
frozen yogurt. Each ordered list should contain a nested, unordered list of your favorite
flavors. Provide a minimum of three flavors in each unordered list.
<html>
<h1>My Favorite Flavors</h1>
<ul>
<h2> <lh>Ice Cream</lh></h2>
<li>Chocolate</li>
<li>Moose Tracks</li>
<li>Vanilla</li>
2
Tech 64095 Computer Technology
Ralph Varckette
</ul>
<ul>
<h2> <lh>Soft Serve</lh></h2>
<li>Twist</li>
<li>Chocolate</li>
<li>Vanilla</li>
</ul>
<ul>
<h2> <lh>Frozen Yogurt</lh></h2>
<li>Cherry Chocolate</li>
<li>Vanilla</li>
<li>Blackberry</li>
</ul>
</html>
4.9
Create an XHTML doc that uses an image as an email link. Use the attribute alt to
provide a description of the image and link.
<html>
<a href="[email protected]"> <img src="images/amy.jpg"
alt="My Niece Amy" title=""/> </a>
</html>
4.10
Create an XHTML doc that contains links to favorite websites. Your page
should contain the heading - My Favorite Web Sites.
<html>
<h3>My Favorite Websites</h3>
<p><a href = "http://www.kent.edu">Kent</a></p>
<p><a href = "http://www.google.com">Google</a></p>
<p><a href = "http://www.wolfram.com">Wolftam Alpha</a></p>
<html/>
3
Tech 64095 Computer Technology
Ralph Varckette
4.11
Create an XHTML doc that contains an unordered list with links to all the examples
prsented in this chapter.
<html>
<body>
<ul>
<li><a href="first.html"> fig 4.1</a></li>
<li><a href="heading.html"> fig 4.2</a></li>
<li><a href="links.html"> fig 4.3</a></li>
<li><a href="link_email.html"> fig 4.4</a></li>
<li><a href="image.html">fig 4.5</a></li>
<li><a href="anchor.html">fig 4.6</a></li>
<li><a href="characters.html"> fig 4.7</a></li>
<li><a href="list1.html"> fig 4.8</a></li>
<li><a href="list2.html"> fig4.9</a></li>
<li><a href="table1.html"> fig 4.10</a></li>
<li><a href="table.2html"> fig 4.11</a></li>
<li><a href="form1.html"> fig 4.12</a></li>
<li><a href="form2.html"> fig 4.13</a></li>
<li><a href="internal_links.html"> fig 4.14</a></li>
<li><a href="meta.html"> fig 4.15</a></li>
</ul>
</body>
<html/>
4.12
Identify each of the following as either an element or an attribute:
a) html - Element
b) width - Attribute
c) href- Attribute
d) br - Element
e) h3 - Element
f) a - Element
g) src – Element
4.13
a) A valid XHTML document can contain uppercase letters in element names. False
b) Tags need not be closed in a valid XHTML document. False
c) XHTML documents can have the file extension .html. True
d) Valid XHTML docs can contain tags that overlap. False
e) & less; is the character entity reference for the less-than < character. False
f) In a valid XHTML doc, <li> can be nested inside either <ol> or <ul> tags. True
4
Tech 64095 Computer Technology
Ralph Varckette
4.14
a) XHTML comments begin with <!-- and end with . -->
b) In XHTML, attribute values must be enclosed in. < >
c) _____is the character entity reference for an ampersand.
d) Element <strong> can be used to bold text.
4.15
Categorize each of the following as an element or an attribute:
a) width - Attribute
b) td - Element
c) td - Element
d) name - Attribute
e) select - Element
f) type – Attribute
4.16
Create the XHTML markup that produces the table shown in Fig. 4.16. Use <em>,
<strong> tag as necessary.
<table border="1" width="100%">
<tr>
<td>
<h2>Objectives</h2>
<li>To be able to create tables with rows and columns of data.</li>
<li>To be able to control the display and formatting of tables.</li>
<li>To be able to create and use forms.</li>
</ul>
<em>Yea, from the table of my memory I'll wipe away all trivial fond
records.</em><br />
William Shakespeare
</td>
<td>
<img src="camel.gif"/>
</td>
</tr>
</table>
4.17
Write an XHTML document that produces the table shown in Fig. 4.17
<h2>Table Example Page</h2>
Here is a small sample table
<table border="1" width="200">
<tr><th colspan = "2"> This is the table head</th></tr>
<tr><th colspan = "2"> This is the body</th></tr>
<tr><th>This is the table</th><th>foot</th>
</tr>
</table>
5
Tech 64095 Computer Technology
Ralph Varckette
4.18
A local university has asked you to create an XHTML document that allows prospective
students to provide feedback about their campus visit. Your XHTML document should
contain a form with text boxes for a name, address and e-mail. Provide checkboxes that
allow prospective students to indicate what they liked most about the campus. The
checkboxes should include students, location, campus, atmosphere, dorms and sports.
Also, provide radio buttons that ask the prospective students how they became
interested in the university. Options - friends, television, Internet and other. In addition,
provide a text area for additional comments, a submit button and a reset button.
<html>
<h1><font color="#FF0000">College Visit Feedback Form</font></h1>
<p>
<h3>Please fill out this form to let us know how your
visit was so that we can improve our facilities to
better suit you and your peers' needs.</h3>
</p>
<form method = "post" action = "">
<p><label>Full Name:
<input name = "fullname" type = "text" size = "40" />
</label></p>
<p><label>Address 1:
<input name = "address1" type = "text" size = "40" />
</label></p>
<p><label>Address 2:
<input name = "address2" type = "text" size = "40" />
</label></p>
<p><label>Zip:
<input name = "zip" type = "text" size = "10" />
</label></p>
<p><label>E-mail:
<input name = "email" type = "text" size = "25" />
</label></p>
<br />
<p><h3>Check off all of the characteristics that
you enjoyed about the college:
</h3><br /></p>
<p>
<label>Campus
<input name = "likes" type = "checkbox" value = "campus"/>
</label>
<label>Students
6
Tech 64095 Computer Technology
Ralph Varckette
<input name = "likes" type = "checkbox" value = "students"/>
</label>
<label>Location
<input name = "likes" type = "checkbox" value = "location"/>
</label>
</p>
<p>
<label>Atmosphere
<input name = "likes" type = "checkbox" value = "atmosphere"/>
</label>
<label>Dorm Rooms
<input name = "likes" type = "checkbox" value = "dormrooms"/>
</label>
<label>Sports
<input name = "likes" type = "checkbox" value = "sports"/>
</label>
</p>
<br />
<p><h3>How did you become interested in
our college?</h3><br /></p>
<p>
<label>Friends
<input name = "interest" type = "radio" value = "friends" checked = "checked"/>
</label>
<label>Television
<input name = "interest" type = "radio" value = "tv"/>
</label>
<label>Internet
<input name = "interest" type = "radio" value = "internet"/>
</label>
<label>Other
<input name = "interest" type = "radio" value = "other"/>
</label>
</p>
<br />
<p><h3>Please give us any additional feedback
that you may have: </h3><br /></p>
<p>
<label>Comments:
7
Tech 64095 Computer Technology
Ralph Varckette
<textarea name = "comments" rows = "4" cols = "40"></textarea>
</label>
</p>
<p>
<input type = "submit" value = "submit"/>
<input type = "reset" value = "clear"/>
</p>
</form>
</html>
4.19
Create an XHTML document titled - How to get good grades. Use <meta> tags to
include a series of keywords that describe your document.
<html>
<meta name="keywords" content="study, homework, read">
<title>4.19</title>
<body>
<h2> How to get good grades!</h2>
</body>
</html>
8