Q1

Explain the Unix commands to

  1. mkdir public_html
  2. cd public_html
  3. ls
  4. chmod 755 public_html
  5. chmod 644 public_html
  6. rm filename

Q2

<table border="1" summary="This table gives some statistics.">
<caption><em>A test table with merged cells</em></caption>
<tr><th rowspan="2"><br/></th><th colspan="2">Average</th>
    <th rowspan="2">Red<br/>eyes</th></tr>
<tr><th>height</th><th>weight</th></tr>
<tr><th>Males</th><td>1.9</td><td>0.003</td><td>40%</td></tr>
<tr><th>Females</th><td>1.7</td><td>0.002</td><td>43%</td></tr>
</table>

Q3

<frameset cols="90,95,*">
     <frame src="sec1.html" name="sec1" frameborder="0">
     <frameset rows="30%,*">
        <frame src="sec2.html" name="sec2" frameborder="0">
        <frame src="sec3.html" name="sec3" frameborder="0">
     </frameset> 
     <frame src="sec4.html" name="sec4" frameborder="0">
    <noframes>
     <body>
       Your browser does not support frames. Please see
       <a href="alternate.html">nonframes version</a>.
     </body>
    </noframes>
</frameset>

Q4

&lt;p&gt;M&amp;m’s are my &quot;favorite&quot; candy snack.&lt;/p&gt;

Q5

  1. should use lowercase for the tag
  2. Forget to put quotation in the value of the attributes.

Q6

<style type="text/css">
  body { background: black; color: white;}
  pre { background: white; color: black; font-family: sans-serif; }
  p {font-style: italic; font-weight: bold;  color: blue}
</style>

Q7

<link href="myCss.css" rel="stylesheet" type="text/css">

Q8

<p>Things that I like most</p>
<ul style="list-style-type:square">
     <li>PIC40A
        <ul style="list-style-type:circle">
          <li>Midterms</li>
          <li>Finals</li>
        </ul>
     </li>
     <li>Validating HTML pages</li>
     <li>Writing CSS
         <ol style="list-style-type:lower-roman">
             <li>For class</li>
             <li>For fun</li>
         </ol>
    </li>
</ul>

Q9

<script type="text/javascript">
<!--
for(var i=1;i<=1000;i++) 
    document.writeln("<p>The square of "+i+" is "+ i*i + ".</p>");
// -->
</script>

Q10

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Q10</title>
<script type="text/javascript">
<!-- 
function change() {
   para = document.getElementById("change");
   sel = document.getElementById("color");
   para.style.background=sel.value;
}
// -->
</script>
</head>
<body>
<form action="">
<p>
<select name="color" id="color" onchange="change()">
<option>yellow</option>
<option>red</option>
<option>green</option>
</select>
</p>   
<p id="change" style="background:yellow">Change my background color!</p>
</form>
</body>
</html>

Q11

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Q11</title>
<script type="text/javascript">
<!-- 
function order() {
   var firstNum = document.forms[0].first.value;
   var secondNum = document.forms[0].second.value;
   
   if(parseFloat(firstNum) > parseFloat(secondNum)) {
     document.forms[0].first.value=secondNum;
     document.forms[0].second.value=firstNum;
   }
}
// -->
</script>
</head>
<body>
<form action="">
<p>
<input type="text"  name="first" size="5"/>
<input type="text"  name="second" size="5"/>
<input type="button" value="Order" onclick="order()"/>
</p>
</form>
</body>
</html>