HCT 114 2019
HCT 114 2019
Page 1 of 3
Question 1 [24 Marks]
i. Describe the steps that you go through when developing a website. [14 marks]
ii. Suggest and explain five techniques that can be used to improve the loading speed of a website.
[10 marks]
i. Write an html script to produce a table similar to the one given below. [10 marks]
Artist Song Release year
TK Smiling
2018
Maji
JJ
Nhamo 2017
SP Nzara 2016
ii. Write an html script to produce a list similar to the one given below (ignore background). [10 marks]
1. HCT
a. HCT120
b. HCT114
2. BCST
a. BS201
3. MTH
a. MTH114
b. MTH214
4. STH
a. STH134
b. STH11
iii. Assume that there is an image called za.jpg which is stored on the D drive of computer in sub-folder
named images. Also assume that you are developing a website and you are saving your webpages in
a folder called www which is on the D drive. You are required to:
a. write an html script which inserts the image (za.jpg) in a webpage saved in the www folder.
This image should have a height of 45px and length of 80px. In the event that the image fails
to render, alternative text ‘Image coming’ must be shown. [5 marks]
b. write a CSS script to position the image in part (a) above at an absolute position which is
110px from the left margin and 200px from the top margin. The image must have a padding of
5px and a solid red border which is 2px. [10 marks]
c. propose, justify and describe in detail the best approach of incorporating the CSS script in
part (b) in your html page given that there are 11 webpages in which the image in part (a) has
been inserted and the image must be styled the same across all webpages. [6 marks]
Page 2 of 3
Question3 [35 Marks]
Study the code given below and answer questions that follow.
1. <?php
2. $host = 'localhost';
3. $database = 'university';
4. $username = 'root';
5. $password = screte;
6. try
7. {
8. $dbh = new PDO("mysql:host=$hostname;dbname=$database,$username,$password);
9. //echo "The connection is successful";
10. catch()
11. {
a. echo $dbh->getMessage();
12. }
13. ?>
i. Using line numbers, identify all syntax errors in the code snippet above justify why you think they are
errors. [10 marks]
ii. Assuming that the above script is correct, write a PHP script to create a table called course in the
university database (the database already exists). The table must have three fields namely: narration,
code and program. [5 marks]
iii. Also making the same assumptions as in part (ii),
a. write a PHP script which inserts any three hypothetical records into the table called course
created in part (ii). [10 marks]
b. write a script which retrieves all the records from the course table and display them in a
Bootstrap table. [10 marks]
Page 3 of 3