Internet Programming
Internet Programming
TIME: 3 HOURS
INSTRUCTIONS:
Attempt any 4 questions. All questions carry equal marks.
1.
Appendix A shows the HTML code for a simple web page in which the user is
shown some form to make the necessary choices.
a).
Sketch the expected appearance of the web page when it is loaded into a standard
browser.
14pts
b).
Write a code segment that would allow you include your picture at the end of the
html document.
6pts
c).
Explain what happens when you click on different buttons rendered in the html
document.
5pts
2. a).
6pts
b).
c).
Write the command (in PHP) to connect to a database named myDB that resides in
172.16.12.3, using the username root and the password dbserv. Check whether the
connection is successful.
8pts
e).
What is the difference between do {....} while () loop and a simple while () {.....}
loop in javascript?
6pts
3. a). Explain how Cascading Style Sheets can be associated to XHTML tags.
Furthermore, name the three locations where style information can be stored.
5pts
8pts
b).
Compare and contrast HTML and XML tags. Define each; describe their
differences.
8pts
c).
What are Elements in relation to XML documents? Name at least three parts that
make up an element definition.
6pts
d)
3pts
4. a). Describe how cookies can be used to store information on a computer and how the
6pts
information can be retrieved by a PHP script. Assume that cookies are not disabled
on the client.
b).
Write a PHP script that tests whether an e-mail address is input correctly. Verify
that the input begins with series of characters, followed by the @ character, another 7pts
series of characters, a period (.) and a final series of characters.
c).
d).
Identify and correct the error in each of the following PHP code statements:
i).
ii).
<?php
$name = "Paul";
print( "$Name" );
?><!-- end PHP script -->
6pts
6pts
What are the differences between JPEG and GIF image formats?
3pts
d).
Contrast the security level of using XML and XSL (and any related elements such
as cascading style sheets) with the security level of using JavaScript on the client
computer.
6pts
e).
6pts
What does the following JavaScript script do? Describe what is presented to the
viewer.
<html>
<head>
<title>JavaScript quiz</title>
<script language="JavaScript"
type="text/javascript">
<!-- Engage Cloaking Device
function play() {
var player = Math.round(Math.random() * 100)
% 6+1;
var house = Math.round (Math.random() * 100)
% 6+1;
var winner = "";
if (player > house) {
winner = "Player";
}
else if (house > player) {
winner = "House";
}
else winner = "Nobody";
var game = "Both Players Role\n\nPlayer Rolls A
" +
player + "\nHouse Rolls A " + house + "\n\n" +
winner + " WINS";
alert(game);
}
// Drop Cloak -->
</script>
10pts
</head>
<body>
<form>
<input type = "button"
onclick = "play()">
</form>
</body>
</html>
value = "Play"
6. a). What are the rules that make an XML document to be referred to as a wellformed XML?
b).
A CSS file that can be used to display the data in the XML file
5pts
10pts
10pts
Appendix A
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- popcorn.html
This describes popcorn sales form page>
-->
<html xmlns = "http://www.w3.org/1999/xhtml">
<head> <title> Popcorn Sales Form </title>
</head>
<body>
<h2> Welcome to Millenium Gynmastics Club Popcorn
Sales
</h2>
<form action = "">
<!-- A borderless table of text widgets for name and address -->
<table>
<tr>
<td> Buyer's Name: </td>
<td> <input type = "text" name = "name"
size = "30" />
</td>
</tr>
<tr>
<td> Street Address: </td>
<td> <input type = "text" name = "street"
size = "30" />
</td>
</tr>
<tr>
<td> City, State, Zip: </td>
<td> <input type = "text" name = "city"
size = "30" />
</td>
</tr>
</table>
<p />
<!-- A bordered table for item orders -->
<table border = "border">
<!-- First, the column headings -->
<tr>
<th> Product Name </th>
<th> Price </th>
<th> Quantity </th>
</tr>
<!-- Now, the table data entries -->
<tr>
<td> Unpopped Popcorn (1 lb.) </td>
<td> 3000 </td>
<td> <input type = "text" name = "unpop"
size ="2" />
</td>
</tr>
<tr>
<td> Caramel Popcorn (2 lb. cannister) </td>
<td> 3500 </td>
<td> <input type = "text" name = "caramel"
size = "2" />
</td>
</tr>
<tr>
<td> Caramel Nut Popcorn (2 lb. cannister) </td>
<td> 4500 </td>
<td> <input type = "text" name = "caramelnut"
size = "2" />
</td>
</tr>
<tr>
<td> Toffey Nut Popcorn (2 lb. cannister) </td>
<td> 5000 </td>
<td> <input type = "text" name = "toffeynut"
size = "2" />
</td>
</tr>
</table>
<p />
<!-- The radio buttons for the payment method -->
<h3> Payment Method: </h3>
<p>
<label> <input type = "radio" name = "payment"
value = "visa" checked = "checked" />
Visa
</label>
<br />
<label> <input type = "radio" name = "payment"
value = "mc" /> Master Card
</label>
<br />
<label> <input type = "radio" name = "payment"
value = "discover" /> Discover
</label>
<br />
<label> <input type = "radio" name = "payment"
value = "check" /> Cheque
</label>
<br />
<label> <input type = "radio" name = "payment"
value = "check" /> Cash
</label>
<br />
</p>
<!-- The submit and reset buttons -->
<p>
<input type = "submit" value = "Submit Order" />
<input type = "reset" value = "Clear Order Form" />
</p>
</form>
</body>
</html>
Appendix B
<enquiry>
<title>ONLINE BANK STATEMENT</title>
<header>
<row />
<row>
<caption>Customer:</caption>
<caption>150550898</caption>
<caption>YOUR KOOL MANAME</caption>
</row>
<row>
<caption>Account:</caption>
<caption>MG1012100693</caption>
<caption> YOUR KOOL MANAME </caption>
<caption>Check Off / Endorsed Loan</caption>
</row>
<row>
<caption>Statement Period:</caption>
<caption>01 MAY 2010</caption>
<caption>-</caption>
<caption />
</row>
<row>
<caption>Balance at Period Start</caption>
<caption>0.00ALERT-HIGH18</caption>
<caption />
<caption>Balance at Period End:</caption>
<caption>6,995,227.77ALERT-LOW18</caption>
<caption />
</row>
<columnheaders>
<columnheader>TXN DATE</columnheader>
<columnheader>DESCRIPTION</columnheader>
<columnheader>VALUE DATE</columnheader>
<columnheader>MONEY OUT</columnheader>
<columnheader>MONEY IN</columnheader>
<columnheader>LEDGER BALANCE</columnheader>
</columnheaders>
</header>
</enquiry>