Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
EXAMINATION PAPER:
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.
APPROVED __________________________________________________________ 1 (a) Explain what is meant by the term stateless protocol and identify two techniques used to preserve state. [7 marks]
(b)
(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]
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 }
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;
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]
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'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>
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"/>]     </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>