Problem Q1.1.
[8 pts]
One of the lines we've been including in the head
section
of our XHTML files is the following.
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
This line mentions UTF-8. What is UTF-8?
UTF-8 is a technique for encoding Unicode characters in such a
way that the first 128 values are encoded as one byte per
character. This allows the software that only recognizes ASCII
characters to display files correctly for files that happen to
contain only characters that appear in the ASCII character set.
Problem Q1.3.
[6 pts]
Suppose in XHTML we describe a color using the code
#FFAAAA. Name what color you would see, and explain
how this code translates to the color you describe.
It is pink: We have the maximum possible red (FF), as well as
a lot of the other colors
(67%, since we have AA(16) = 170(10)
of the possible 255(10)). As a result,
we'll get a very light red — or as it's more popularly
called, pink.
Problem Q1.4.
[8 pts]
Suppose we have the following HTML form, which displays three
text fields and a button.
<form method="post" action="mean.php">
<p><input type="input" name="x" /></p>
<p><input type="input" name="y" /></p>
<p><input type="input" name="z" /></p>
<p><input type="submit" value="Compute" /></p>
Complete the following PHP file so that it displays the
average of the three numbers entered by the user.
For example, if the user enters 2, 4, and 9,
mean.php should display a response appearing as
follows; note that the answer, 5, is in boldface text.
Average Computation
The average is 5.
<?php import_request_variables("pg", "form_"); ?>
<html>
<head>
<title>Average among three</title>
</head>
<body>
<h1>Average Computation</h1>
<p>The average is <b><?php
$avg = ($form_x + $form_y + $form_z) / 3;
echo $avg;
?></b>.</p>
</body>
</html>