BIT 2207: WEB DESIGN AND DEVELOPMENT II Past Paper

W1-2-60-1-6
JOMO KENYATTA UNIVERSITY
OF
AGRICULTURE AND TECHNOLOGY
University Examinations 2016/2017
THIRD YEAR FIRST SEMESTER EXAMINATION FOR THE DEGREE
OF BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
BIT 2207: WEB DESIGN AND DEVELOPMENT II
DATE: DECEMBER 2016 TIME: 2 HOURS
INSTRUCTIONS: ANSWER QUESTION ONE AND ANY OTHER TWO QUESTIONS

Question One (30 Marks)

a) State the function of each of the following three languages all web developers must learn: (6 Marks)

(i) HTML

(ii) CSS

(iii) Javascript

b) Explain the term javascript function. (2 Marks)

c) With suitable examples, show where a javascript is positioned within a HTML page. (4 Marks)

d) State four (4) methods of displaying data in javascript. (4 Marks)

e) Explain the functions of PHP. (4 Marks)

f) Write the basic PHP syntax. (2 Marks)

g) Given a form has three fields:
FirstName, Last Name and Age. Write a non-validated PHP script that can post the three form content to a database. (6 Marks)
h) Differentiate between GET and POST methods. (2 Marks)

Question Two (20 Marks)

a) Write a PHP script to check if a string contains specific string. (4 Marks)

Sample string: ‘The quick brown fox jumps over the lazy dog’.
Check whether the said string contains the sting ‘jumps’.

b) Explain the behaviour of the html(specialchars) function. (3 Marks)

c) Describe the actions of the $_SERVER [“PHP_SELF”]. (3 Marks)

d) Write a PHP script that selects the id, firstname and lastname columns from the students table and displays it on the page as follows: (10 Marks)
id: 1 – Name: John Kamau
id: 2 – Name: Mary Mwajuma
id: 3_ Name: Julie Odogo

Question Three (20 Marks)

a) Explain the following PHP terms: (6 Marks)

(i) Polymorphism

(ii) Data Abstraction

(iii) Encapsulation

b) Below is a PHP code extract which defines a class of type Books:

< ? Php
Class Books {
/*Member variables*/
Var & price;
Var & title;

/*Member functions*/
function set Price ($ Par) {
$ this – > price = $ par;
}
function get Price ( ){
echo & this – > price. “<br/>”;
}
function set Title (& Par) {
& this – > title = & par ;
}
function get Title ( ) {
echo & this – > tittle . “<br/>”;
}
}
? >

(i) Explain five (5) parts of the code. (5 Marks)

(ii) Demonstrate how to create three books Maths, Physics and Chemistry using the new operations. (3 Marks)

(iii) Show how to set title and prices of the three books by calling member functions. (6 Marks)

Question Four (20 Marks)

a) The javascript function in the program has an error find out the error and fix it. (6 Marks)

< ! DOCTYPE html>
< html >
< body >

<P id = “demo” > < / P>

<script>
func MyFunc {
document . getElementById (“clemo”)
innerHTML = “Hello World!” ;
}
MyFunction ( )
</script>
</body>
</html>

b) Write a function in javascript to display the product of 5 * 5 (4 Marks)

c) (i) State the function of a switch statement. (2 Marks)

(ii) Write the syntax for the switch statement. (2 Marks)

(iii) The getDay ( ) method returns the weekday as a number between 0 and 6.
(Sunday = 0, Monday = 1, Tuesday = 2 ……) use the weekday number to calculate weekday name: (use switch statement). (6 Marks)

 

Question Five (20 Marks)

a) Explain the term object in javascript. (2 Marks)

b) State three (3) ways to create a new object. (3 Marks)

c) Write a javascript function to convert degrees Celsius to degrees Fahrenheit. The output should be presented as shown below: (15 Marks)

Insert a number into one of the input fields

below:
Degrees Celsius

equals

Degrees Fahrenheit

(Visited 270 times, 1 visits today)
Share this:

Written by