2016 - KIT502 Web Development

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

1

Student ID number:
________________
Pages : 8
____ Questions : 21

UNIVERSITY OF TASMANIA

ORDINARY EXAMINATIONS FOR DEGREES AND DIPLOMAS

June 2016

KIT502 Web Development

Examiner
Soonja Yeom
Saurabh Garg

Time allowed: TWO (2) hours

Reading Time: FIFTEEN (15) minutes

Instructions:
There are a total of 120 marks available. Answer ALL questions.

Section A contains 18 questions; each question is worth 5 marks.


You should spend approximately 90 minutes on this section.

Section B contains 3 questions; each question is worth 10 marks.


You should spend approximately 30 minutes on this section.

All answers must be written in the supplied exam booklet, do NOT write your
answers on the exam paper.
-2- KIT502 Web Development

SECTION A
Attempt ALL EIGHTEEN (18) questions from Section A. Each question is worth FIVE (5)
marks. This section is worth 90 marks and 75% of the examination.

Question 1
List four super global variables and provide a brief explanation for each.
[5 marks]

Question 2
Explain two advantages and two disadvantages of client-side scripting.
[5 marks]

Question 3
Briefly explain symmetric-key encryption and public-key encryption. What are the
different goals that each encryption is aiming at?
[5 marks]

Question 4
When creating web sites, separating presentation information from other content is
recommended. Explain three different ways of implementing presentation
information and their pros and cons.
[5 marks]

Question 5
What is SSL and how does it work?
[5 marks]

Question 6
What does the system need to do to prevent XSS or any other code phishing attack?
[5 marks]

Question 7
Which problem can be minimised by using the real_escape_string() function
in web development? Provide a brief example.
[5 marks]

Question 8
What are the technologies involved in AJAX? Identify them with a brief explanation.
[5 marks]

Question 9
PHP provides a large number of functions that can be used to manipulate a
MySQL database. Give the names of TWO (2) of these functions and explain briefly
what each of them does.
[5 marks]

Question 10
What is CGI (Common Gateway Interface)? Describe the concept of CGI.
[5 marks]

Continued …
KIT502 Web Development -3-

Question 11
What is the purpose of templates in PHP? Explain two advantages of templates.
[5 marks]

Question 12
Describe the encryption processes used with digital signatures.
[5 marks]

Question 13
This question is about HTTP messages. Explain what information is required for
request and response messages.
[5 marks]

Question 14
The following questions are about “State Management”.

a HTTP transactions are said to be stateless. What does stateless mean? And
what weakness is caused by being stateless?
[1 mark]

b Session_start() is a PHP function. Briefly explain what this does and


where you would expect to see calls to this function.
[2 marks]

c How do programmers store values in the $_SESSION variable? Write code


that would do the following:
• Store an element with the key ‘mode’ and the value ‘edit’
• Store an element with the key ‘username’ and the value ‘jsmith’
[2 marks]

Continued …
-4- KIT502 Web Development

Question 15
The output of the following code displays a form. When the form is loaded, the
cursor automatically focuses on the username field. Fill the box (a) to complete the
code by using jQuery.

<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js">
</script>
</head>
<body>
<script>
(a)
</script>
<form>
username: <input id="username" type="text"/><br/>
<input type="submit" name="submit" value="Login"/>
</form>
</body>
</html>

[5 marks]

Question 16
What is the output of the following code? (what you see in the browser)

<?php
$var='final exam';
$var1="Fun!";
$var2=3;
echo $var.$var2."<br/>";
echo $var1+$var2."<br/>";
echo "'$var1' Wait!".'<br/>';
?>

[5 marks]

Question 17
There are two advantages of using jQuery: resolving “cross-browser issues” and
“method chainability”. Describe “cross-browser issues” and “method chainability”.
[5 marks]

Question 18
What is an accessible web site? Explain two points you consider for building an
accessible web site and suggest how to implement them.
[5 marks]

Continued …
KIT502 Web Development -5-

SECTION B
Attempt ALL THREE (3) questions from Section C. Each worth TEN (10) marks each. This
section is worth 30 marks and 25% of the examination.

Question 19
Consider the Implementation of the “city-viewer system”. The completed system
should perform as below. This program consists of two files, “Index.html” and
“get_cities.php”.

[When the page is loaded]

[Dropdown list - Country]

[When the country is selected]

Continued …
-6- KIT502 Web Development

a The code below is the source code for “Index.html”. Write answers to replace
the numbered boxes, 1- 10.

<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js">
</script>
<script type="text/javascript">
function setup_country_change(){
$( (1) ).change( (2) );
}
function update_cities(){
var country = $( (3) ).attr( (4) );
$.post( (5) );
}
function show_cities(cities){
$( (6) ).html( (7) );
}
$(document).ready( (8) );
</script>
</head>
<body>
<form id="select_country" name="select_country" method=""
action="#">
<table>
<tr> <th>Country</th>
<td><select name="country" id="country">
<option value="" selected="selected">Please
select country.</option>
<option (9) >Australia</option>
<option (9) >United States</option>
<option (9) >United Kingdom</option>
</select></td>
</tr>
<tr> <th>Cities</th>
<td id="cities"> (10) </td>
</tr>
</table>
</form>
</body>
</html>
[5 marks]

Continued …
KIT502 Web Development -7-

b The code below is the source code for “get_cities.php”. Write answers to
replace the numbered boxes. There is one mark for each box that is correctly filled
in.

<?php
switch( (1) )
{
(2) "au":
$cities = array('Adelaide','Brisbane','Canberra');
break ;

(2) "us":
$cities = array ('Chicago','Dallas','Houston');
break ;

(2) "uk":
$cities = array('Birmingham','Glasgow','Leeds');
break;
(3) :
$cities = false;
break;
}
if( (4) ) echo "Please select country";
else echo " (5) ";
?>

[5 marks]

Question 20
The following table displays several PHP functions. Write a description for each
function.

Functions Description
trim() (a)
strip_tags() (b)
html_specialchars() (c)
real_escape_string() (d)

[5 marks]

What is a possible attack we can prevent by using them? Describe the potential attack.
[5 marks]

Continued …
-8- KIT502 Web Development

Question 21

For the following relation schema:


employee(employee-name[PK], street, city)
works(employee-name, company-name[PK], salary)
company(company-name [PK], city)
manages(employee-name[PK], manager-name)

Give an expression in SQL for each of the following queries:


a. Find the name of the employees who live in “Hobart” city?
[2 Marks]
b. Find the name of the employee, city they live and salary they are earning?
[2 Marks]
c. Find the manager-name and number of employees work under that manager?
[2 Marks]
d. Find the names of all employees who live in the same cities as the companies
for which they work.
[4 Marks]

---- The End ----

Continued …

You might also like