UNIVERSITY EXAMINATIONS: 2013/2014
ORDINARY EXAMINATION FOR THE BACHELOR OF SCIENCE
IN INFORMATION TECHNOLOGY
BIT 4303 ADVANCED WEB
DATE: APRIL, 2014 TIME: 2 HOURS
INSTRUCTIONS: Answer Question ONE and any other TWO
QUESTION ONE
(a) Differentiate between the following terms:
(i) a class selector and ID selector (4 Marks)
(ii) a weakly typed and a strongly typed language (4 Marks)
(b) Define Cascading style sheets as used in web development (2 Marks)
(c) Styles sheets were added to HTML 4.0 to solve a problem. Using examples to
illustrate, explain the problem solved by use of style sheets. (5 Marks)
(d) Describe situations where it might be necessary to place java script code in an
external file. (3 Marks)
(e) Using an example to illustrate explain how java script code can be placed in an
external file (6 Marks)
(f) Provide syntax to illustrate how JavaScript functions are defined (4 Marks)
(g) Explain the relationship between functions and events in JavaScript (2 Marks)
QUESTION TWO
(a) Study the following HTML registration form and write a function validate which:
i. Validates the “@” symbol in the e-mail address and returns “Not a valid email” message in case its missing.
ii. Checks that Name should not be more than 16 letters
(12 Marks)
(b) Explain briefly, any three security threats to a Web server (8 Marks)
QUESTION THREE
(a) Describe the main parts of a style sheet rule using an example to illustrate
(8 Marks)
(b) Define Event Handlers as used in JavaScript (3 Marks)
(c) Using appropriate event handlers write a javascipt code that changes the
background colour when the mouse is placed and then taken off the link
(4 Marks)
(d) Describe three ways of adding style sheets to a web page
(e) Describe the following Javascrpt events
i. onBlur
ii. OnChange
iii. OnLoad
iv. OnFocus
v. OnClick
(5 Marks)
QUESTION FOUR
(a) Explain the steps that take place when the client makes a request for a Web page
(5 Marks)
(b) Explain any three advantages of using CSS(cascading style sheets)
(3 Marks)
(c) Using appropriate event handlers write a javascipt code that changes the
background colour when the mouse is placed and then taken off the link
(6 Marks)
(d) Define Event Handlers as used in JavaScript (2 Marks)
(e) List the functions of any four form input types. (4 Marks)
QUESTION FIVE
(a) Sketch the output of the following (6 Marks)
<HTML>
<HEAD>
<TITLE> JavaScript Exercise 3 </TITLE>
<PRE>
<SCRIPT LANGUAGE = “JavaScript”>
<!– HIDE THE SCRIPT FORM OTHER BROWSERS
document.writeln(“<CENTER><H1>Welcome to</H1>”);
document.writeln(“<H2>Informatics Computer School</H2><HR>”);
document.writeln(“JavaScript is fun!!!!!!!!!!!”);
document.write(“I am learning JavaScript, “);
document.write(“and this is the third exercises.</CENTER>”);
// STOP HIDING FORM OTHER BROWSERS –>
</SCRIPT>
</HEAD>
</HTML>
(b) Study the php code below and answer the questions that follow:
<html>
<body>
<?php
$db = mysql_connect(“localhost”,”root”);
mysql_select_db(“mydb”,$db);
$result = mysql_query(“SELECT * FROM employees”,$db);
printf(“First Name: %s<br>\n”, mysql_result($result,0,”first”));
printf(“Last Name: %s<br>\n”, mysql_result($result,0,”last”));
printf(“Address: %s<br>\n”, mysql_result($result,0,”address”));
printf(“Position: %s<br>\n”, mysql_result($result,0,”position”));
?>
4
</body></html>
Describe the purpose of each of the following statements in the code above (6 Marks)
i. mysql_connect() function
ii. mysql_select_db()
iii. mysql_query()
iv. mysql_result()
(c) The Internet has the potential to provide many benefits to companies in terms of
communication. Describe FOUR processes that a business may carry out using
the Internet explaining the application involved and the benefit to the company.
Outline any drawbacks involved in each process. (8 Marks)