COMP 310 INTE 221 BBIT 221 COSF 124 WEB PROGRAMMING - Kabarak University

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 5

KABARAK UNIVERSITY

UNIVERSITY EXAMINATIONS
MAIN/TOWN CAMPUS
SECOND SEMESTER 2020/2021 ACADEMIC YEAR
EXAMINATION FOR THE DEGREE IN COMPUTER FORENSICS

COMP 310 INTE 221 BBIT 221 COSF 124 WEB PROGRAMMING

STREAM: Y1S2 TIME: 9:00-11:00AM


EXAMINATION SESSION: MAY-AUGUST DATE: 20/08/2021

INSTRUCTIONS TO CANDIDATES

1. Answer Question 1 and any other two questions in the answer booklet provided.

2. Do not write on your question papers. All rough work should be done in your answer booklet.

3. Clearly indicate which question you are answering.

4. Write neatly and legibly.

5. Follow all the instructions in the answer booklet

As members of Kabarak University family, we purpose at all times and in all places, to set apart in one’s heart, Jesus as
Lord. (1 Peter 3:15)
Kabarak University is ISO 9001:2015 Certified
Page 1 of 5
SECTION A: [Compulsory] TOTAL MARKS FOR THIS SECTION IS 30.

1.

(a) Define the following terms as used in web programming: [3 Marks]


(i) Web server
(ii) Loops
(iii) Functions
(b) Identify three different ways of applying CSS to a web page. [3 Marks]
(c) Differentiate between margin, borders, and padding as used in cascading style sheets
[4 Marks]
(d) CSS provides class and id selectors. [4 Marks]
(i) State two benefits of using id and class selectors for a developer.
(ii) What is the difference between the class and id selectors
(e) Describe the anatomy of a CSS ruleset [5 Marks]
(f) Write a PHP program to check the age of candidates and determines whether they qualify to
view for the presidency. Your code should print "CONGRATULATIONS, YOU QUALIFY TO BE
PRESIDENT" when the candidate's age is more than 35. Otherwise, it should print "OOPS!
YOU DONT QUALIFY TO BE PRESIDENT" [5 Marks]
(g) For each of the following HTML elements, identify the tag name, the attribute(s), the values and
the content of the element. [6 Marks]

i) <video width="320" height="240" controls="controls">


ii) <a href="https://developer.mozilla.org/">Programming</a>
iii) <img src="mdn-logo-sm.png" alt="Programming">

As members of Kabarak University family, we purpose at all times and in all places, to set apart in one’s heart, Jesus as
Lord. (1 Peter 3:15)
Kabarak University is ISO 9001:2015 Certified
Page 2 of 5
SECTION B. TOTAL MARKS FOR THIS SECTION IS 40.
ANSWER ANY TWO QUESTIONS FROM THIS SECTION. EACH QUESTION IN THIS
SECTION CARRIES 20 MARKS.

2.

(a) HTML, CSS and Javascript are client-side languages while PHP is a server-side scripting
language. Explain this statement [4 Marks]
(b) Explain the following attributes used in HTML tables [4 Marks]
(i) Rowspan
(ii) Colspan
(c) Write complete HTML codes to display the Quotation table below [6 Marks]

No Items Price Category


1. PC 40000
2. Laptop 60000 Computers
3. Printer 25000 Accessories
TOTAL 125000
Tax (16%) 20000
GRAND TOTAL 145000

(d) Write a well-documented PHP program that takes different values for the radius and uses that
to compute the circumference of a semi-circle. Show the use of comments, variables, and opera-
tors in your program [6 Marks]

3.

(a) List any four HTML5 tags which do not require a closing tag. [4 Marks]

As members of Kabarak University family, we purpose at all times and in all places, to set apart in one’s heart, Jesus as
Lord. (1 Peter 3:15)
Kabarak University is ISO 9001:2015 Certified
Page 3 of 5
(b) Describe the purpose of the following as used in HTML forms. Use HTML elements for each
case [6 Marks]
(i) Drop Down Boxes
(ii) Radio Buttons
(iii) Check Boxes
(c) Using a well labelled diagram of web communication architecture to answer the following ques-
tions:
(i) Describe webserver-client communication [5 Marks]
(ii) Distingush between the HTTP Request and Response [5 Marks]

4.

(a) Discuss three reasons why CSS instead of tables should be used to control page layouts
[4 Marks]

(b) Examine the code snippet below and answer the following questions:
<style type="text/css">
.a {color:red;}
.b {color:green;}
.c {color:blue;}
</style>
<div id="colorText">Select to change text color</div>
<select onchange="changeColor(this.value)">
<option value="a">Red</option>
<option value="b">Green</option>
<option value="c">Blue</option>
</select>
<script type="text/javascript">
function changeColor(value) {
Document.getElementById("colorText").className = value
}
</script>

(i) Identify and Explain all the CSS class and id selectors [4
Marks]
(ii) Explain the overall function of the JS in this code snippet [3 Marks]
(iii) Identify and explain all event handlers in the code [3 Marks]

(c) Write a PHP program to demonstrate count from 1 to 1000 in descending order using while loop
[6 Marks]

As members of Kabarak University family, we purpose at all times and in all places, to set apart in one’s heart, Jesus as
Lord. (1 Peter 3:15)
Kabarak University is ISO 9001:2015 Certified
Page 4 of 5
5.

(h) Use the web page given below to answer the following questions;

(i) Write HTML and CSS codes to reproduce “fruits classification” list [6 Marks]

(ii) The image in the web page above is called fruits_photo.jpg. Use HTML and CSS to place
the image in the web page [4 Marks]
(i) Several divs have a class of even. Write a style rule (as it would appear in an external
stylesheet) that gives each of these dark text (hex value 303030) on light gray background (hex
value e0e0e0), using 10pt verdana font, and the borders should be 1 pixel solid black lines all
around. In addition to verdana specify the appropriate generic font for computers that do not
have verdana installed. [4 marks]

(j) Which PHP functions are used to achieve the following with a MySQL database server on the
local machine? Use example to show how each is implemented [6 Marks]
(i) Connect to the server with username root and password Kabarak_pw01
(ii) Select a database called Kabarak_db002 to be used for queries
(iii) Execute a query select all rows and columns from the table Kabarak_users

As members of Kabarak University family, we purpose at all times and in all places, to set apart in one’s heart, Jesus as
Lord. (1 Peter 3:15)
Kabarak University is ISO 9001:2015 Certified
Page 5 of 5

You might also like