(10 pts) Write the complete HTML code that will
a) display in the browser's title bar the title "HTML is Fun!"
b) display in the same browser window a level 1 heading that says "Did Florida Really Vote For" and a centered level 3 heading that says "George Bush."
Solution:
<html>
<head>
<title> HTML is fun ! </title>
</head>
<body>
<h3>Did Florida really vote for </h3>
<center>
<h3> George Bush</h3>
</center>
</body>
</html>
<HTML >
<BODY > <UL > <LI > dishes <LI > pots <LI > pans </UL > <OL > <LI > dishes <LI > pots <LI > pans </OL > </BODY > </HTML > |
|
|
<OL>
<LI> Types of Dogs <UL> <LI> Cocker Spaniel <LI> Scottie <LI> Collie </UL> <LI> Types of Fish <UL> <LI> Walleyed Pike <LI> Northern Pike <LI> Eelpout </UL> </OL> |
3. (10 pts) Write the HTML code snippet that will display the image in the file "smiley.gif" so that it is left aligned in the browser window with the text "Here is My Smiley Face" to the right of the image. Also, please draw a picture of how you expect the browser to render your HTML code.
Solution:
The picture should be left aligned so that the text appears on the right of it.
Here is my smiley face!
<img scr="smiley.gif" align="left">Here is my smiley face!
|
<TABLE BORDER WIDTH=100%>
<TR> <TD>red </TD> <TD>white </TD> <TD>blue </TD> </TR> <TR> <TD>R </TD> <TD>G </TD> <TD>B </TD> </TR> </TABLE> |
5. Write the HTML code snippet for displaying a form with two checkboxes labeled "Check box 1" and "Check box 2" and two radio buttons labeled "Radio button 1" and "Radio button 2."
Solution:
<FORM NAME="form1">
<INPUT TYPE="checkbox" NAME="cb1" > Check Box 1
<INPUT TYPE="checkbox" NAME="cb2" > Check Box 2
<INPUT TYPE="radio" NAME="myRadio" VALUE="RB_1"> Radio Button 1
<INPUT TYPE="radio" NAME="myRadio" VALUE="RB_2"> Radio Button 2
</FORM>
temp = box A;
box A = box B;
box B = temp;
Write an algorithm that will calculate the average value in a collection of 8 boxes labeled "box1," "box2," ... "box8."
Solution:
The boxes are labelled "box1", "box2", ..... ,"box8".
Algorithm to calcuate the average:
In words: Add up all the numbers in boxes 1 through 8. Divide the total by 8. The value thus obtained is the average.
Psuedocode:
1. Initialize a number sum to 0.
2. Loop through boxes 1 to 8, each time adding the value of the current box to sum.
i.e. sum = sum + value(current box).
3. Average = sum / 8.
(Either one of the methods to explain the algorithm is acceptable.)
Find the largest number and remove it from the list, then find the largest number in the new list.
Find the largest number in the list, the find the largest number in the list and ignore the previous largest number.
Sort a list of n numbers in ascending order and return the n-1 number in the list.
Sort the list in descending order and return the 2nd number in the list.