You are on page 1of 8

APPROVED __________________________________________________________

EXAMINATION PAPER:

ACADEMIC SESSION 2006/2007

Campus School Department Level

Maritime Greenwich Computing and Mathematical Sciences Computer Science Three

TITLE OF PAPER COURSE CODE Date and Time

Web Engineering COMP1309 May 2007 3 hours BAHRAIN GREECE HONK KONG LONDON MALTA MALAYSIA SINGAPORE SYRIA TRINIDAD UAE ZAMBIA 15:00 15:00 18:30 13:00 15:00 18:30 18.30 14:00 09:30 17:00 15:00

Answer any FOUR of the following SIX questions. Each question is worth 25 marks. If you answer more than four questions, marks will ONLY be awarded for your FOUR best answers.

Web Engineering COMP1309


View Web Engineering Exam Questions and Answers Guide

APPROVED __________________________________________________________ 1 (a) Explain what is meant by the term stateless protocol and identify two techniques used to preserve state. [7 marks]

(b)

Identify three advantages of JavaScript over other computer languages. [3 marks]

(c)

Look at the following JavaScript code and explain line by line what it does.
1 2 3 4 5 6 7 8 9 10 11 12 13 var data=[Monday,Tuesday,Wednesday,Thursday,Friday]; var x=data.length; var rem=prompt(A question ?,); var tmp=new Array(data.length-1); var c2=0; for(var c=0;c<x;c++) { if(data[c]==rem) {c--; c2=c;} else {tmp[c2]=data[c]; c2++;} }

[5 marks]

(d)

Look at the following code and identify the error(s) in it. What would the code do after you correct the error(s)?

<html><head><title>XyZ Industries</title><head><body><script language=javascript><!var suk: vname=prompt(Enter your SUK code,):document.writeln(<h1>SUK:</h1>); document.writeln(<h1>+suk+</h2>); <body/>//--><script><html/>

[10 marks]

Web Engineering COMP1309 Page 2 of 8

APPROVED __________________________________________________________ 2 (a) Critically discuss and contrast the reasons that you would recommend someone to use ASP instead of CGI. [12 marks]

(b)
1 2 3 4 5 6 7 8 9

Look at the following ASP code snippet and add meaningful comments to the lines you think it will help the most:
set objFSO = CreateObject("Scripting.FileSystemObject") on error resume next Set objFolder = objFSO.GetFolder(sRoot & sDir) if err.number <> 0 then Response.Write "Could not open folder" Response.End end if on error goto 0 sParent = objFSO.GetParentFolderName(objFolder.Path)

[5 marks]

(c)

Study the code of the DHTML web page given below. Line numbers have been added that you may refer to in your answer. Describe in detail, with the aid of a figure, what you expect to see in the browser when this page has loaded. [8 marks]
index.css 1 body { 2 background:#DDEEFF; 3 font-family:sans-serif; 4 padding:1em; 5 } 6 h1 { 7 background:#BBCCFF; 8 text-align:center; 9 padding:0.5em; 10 margin:0px; 11 } 12 h2 { 13 text-align:center; 14 } 15 table { 16 width:60%; 17 margin-left:20%; 18 background:white; 19 } 20 td { 21 text-align:center; 22 } 23 #eMess, #pMess { 24 width:50%; 25 }

Question 2 continues on the following page Web Engineering COMP1309 Page 3 of 8

APPROVED __________________________________________________________ Question 2 continued: index.html


1 <html> 2 <head> 3 <title>Feline Forum</title> 4 <link rel="stylesheet" type="text/css" href="index.css"/> 5 <script type="text/javascript" src="index.js"></script> 6 </head> 7 <body onload="init()"> 8 <h1>Feline Forum</h1> 9 <h2>Where cat lovers go to talk about cats</h2> 10 <form method="post" action="auth.php"> 11 <table><tr> 12 <td id="eMess">Email</td> 13 <td id="pMess">Password</td> 14 </tr><tr> 15 <td><input type="text" name="email" size="20" onblur="validEmail()"/></td> 16 <td><input type="password" name="passwd" size="20"/></td> 17 </tr><tr> 18 <td colspan="2" style="color:white">X</td> 19 </tr><tr> 20 <td colspan="2"> 21 <input type="image" src="buttonA.gif" onmouseover="foo(this)" onmouseout="bar(this)" onclick="return validate(this.form)"/> 22 </td></tr></table> 23 </form> 24 </body></html>

index.js
1 function init(){ 2 img0 = new Image; 3 img0.src = 'buttonB.gif'; 4 } 5 6 function foo(x){ 7 x.src = 'buttonB.gif'; 8 } 9 10 function bar(x){ 11 x.src = 'buttonA.gif'; 12 } 13 14 function validate(theForm) { 15 var valid = true; 16 if (theForm.email.value == "") { 17 feedback('eMess','Enter your email address here',6); 18 valid = false;

Question 2 continues on the following page

Web Engineering COMP1309 Page 4 of 8

APPROVED __________________________________________________________ Question 2 continued:


19 } else valid = validEmail(); 20 if (theForm.passwd.value == "") { 21 feedback('pMess','Enter your password here',6); 22 valid = false; 23 } else if (theForm.passwd.value.length <= 5){ 24 feedback('pMess','Password too short',6); 25 valid = false; 26 } else feedback('pMess','Password',1); 27 if ( valid ) return true; 28 else return false; 29 } 30 31 function validEmail() { 32 email = document.forms[0].email; 33 var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.) +([a-zA-Z0-9]{2,4})+$/; 34 if (filter.test(email.value)) { 35 feedback('eMess','Email',1); 36 return true; 37 } else { 38 feedback('eMess','Not a valid email address',6); 39 return false; 40 } 41 } 42 43 function feedback(item,mess,count) { 44 document.getElementById(item).innerHTML = mess; 45 if ( count%2 == 1 ) { 46 document.getElementById(item).style.color = 'black'; 47 } else { 48 document.getElementById(item).style.color = 'white'; 49 } 50 count--; 51 var foo = 'feedback(\'' + item + '\',\'' + mess + '\',' + count + ')'; 52 if ( count > 0 ) { 53 setTimeout(foo,300); 54 } 55 }

Web Engineering COMP1309 Page 5 of 8

APPROVED __________________________________________________________ 3. Open Source software is widely used for creating Web applications. What is meant by the term Open Source? Explain what you understand by the Open Source Initiative. [25 marks]

4 (a) What is XHTML and what is its relationship to HTML 4 and the Internet? [8 marks]

(b)

Critically discuss in terms of technology and specification how XHTML has evolved from XHTML 1.0 to XHTML basic and then to XHTML 1.1 [17 marks]

5 (a) An XHTML document is validated against a Document Type Definition (DTD).Explain how this is done with the help of an XHTML example for each DTD type. Include in your answer a brief description of the DTD used (what does it include?). [15 marks]

(b)

Discuss the relative merits of DTDs and XML schemas. [10 marks]

Web Engineering COMP1309 Page 6 of 8

APPROVED __________________________________________________________

6 (a) With the use of examples name three of the most important coding rules that make XHTML to differ from HTML 4.01. [9 marks]

(b)

While writing articles for an online journal you decide to collect your bibliographic references in an XML format using an XML markup language designed for bibliographic data, BibML. An example of your XML bibliography is shown below together with the XSLT used to render the XML into XHTML. The file bib.xml is a valid BibML document. Create a DTD for BibML. Note that an article may have one or more authors and a book may have one or more editors or more or more authors [16 marks]

bib.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE bibliography SYSTEM "bib2.dtd"> <?xml-stylesheet type="text/xsl" href="bib2.xsl"?> <bibliography> <reference cite="DOS99"> <book year="1999"> <editor>C. DiBona</editor> <editor>S. Ockman</editor> <editor>M. Stone</editor> <title>Open Sources</title> <publisher>O&#39;Reilly</publisher> <location>USA</location> </book> </reference> <reference cite="JC99"> <article year="1999"> <author>M. Jain</author> <author>M. Cross</author> <title>Finite Population Cellular Radio</title> <journal vol="23" part="1" fPage="77" lPage="86">Applied Mathematical Modelling</journal> </article> </reference> <reference cite="CR03"> <book year="2003"> <author>C. Ritchie</author> <title>Operating Systems</title> <publisher>Continuum</publisher> <location>London</location> </book> </reference> </bibliography>

Question 6 continues on next page Web Engineering COMP1309 Page 7 of 8

APPROVED __________________________________________________________ Question 6 continued

bib.xsl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <h2>Bibliography</h2><table> <xsl:for-each select="//reference"> <xsl:sort order="ascending" select="@cite"/> <tr><td> [<xsl:value-of select="@cite"/>] &#160; &#160; </td><td> <xsl:apply-templates select="book|article"/> </td></tr> </xsl:for-each></table> </html> </xsl:template> <xsl:template match="book"> <xsl:apply-templates select="author|editor"/> (<xsl:value-of select="@year"/>) <i><xsl:value-of select="title"/></i>, <xsl:value-of select="publisher"/>, <xsl:value-of select="location"/> </xsl:template> <xsl:template match="article"> <xsl:apply-templates select="author"/> (<xsl:value-of select="@year"/>) <xsl:value-of select="title"/>, <xsl:apply-templates select="journal"/> </xsl:template> <xsl:template match="author|editor"> <xsl:value-of select="."/>, </xsl:template> <xsl:template match="journal"> <i><xsl:value-of select="."/></i>, <xsl:value-of select="@vol"/> (<xsl:value-of select="@part"/>), <xsl:value-of select="@fPage"/>-<xsl:value-of select="@lPage"/> </xsl:template> </xsl:stylesheet>

View Web Engineering Exam Questions and Answers Guide

Web Engineering COMP1309 Page 8 of 8

You might also like