100% found this document useful (1 vote)
25 views

Assignment2 PDF

Uploaded by

matika700
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
25 views

Assignment2 PDF

Uploaded by

matika700
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Fundamental of Web Design Assignment 2

Please Submit a PDF


(On practical questions submit both code and Screenshots)
(Also, on practical questions put your Name and Reg number as two buttons at the top of
your interface so that it will show on your screenshot)
Failure to follow above instructions will result in getting a zero for such questions.

Answer all the questions

Question 1
a) While it might be more difficult to design a website with a database back-end, it might
be a lot easier to maintain a database-driven website. Why? Explain at least two reasons
why database-driven websites are easier to maintain. [2]
b) Describe three of the four main advantages of standardization in the web design world.
[4]
c) Write the CSS code to add a pink background color to a class selector called “prince”
[1]
d) There are four ways to associate with an HTML document. List and explain how you
can use them. [10]
e) How do you write “Hello Zimbabweans” in PHP? [2]

Question 2

a) How do you create an Array in PHP? [2]


b) Consider the following HTML form:
<form method="post" action="addcomment.php">
Subject:
<input name="subject" type="text" size="40" class="mytextbox"> <br/>
Name:
<input name="username" class="mytextbox" type="text" size="40"><br/>
Comment: <br />
<textarea name="comment" cols="60" rows="8"></textarea> <br />
<input type="submit" value="Submit">
</form>
i) How many form variables are defined in the form above? [1]
ii) How many form elements are defined in the form above? [1]
c) Assuming this form was loaded in a web browser, what exactly happens when the user
clicks the submit button, i.e., submits this form? [4]
d) Why is the use of inline CSS often considered bad practice in web design? [2]
e) State two different ways of specifying CSS for a webpage. [3]
f) The use of tables can cause issues in web design.
i. List 3 potential problems of using tables for web page design. [3]
ii. List 3 issues of using tables when designing web pages for use on mobile
devices. [3]
g) What is the correct HTML for referring to an external sheet? [1]
Question 3

Consider the following CSS code:


#myblockdiv {
margin: 15px 20px 30px 45px;
padding: 5px 10px 15px 20px;
width: 700px;
}
a) What is the top margin? (1)
b) What is the left padding?(1)
c) How much total width will myblockdiv actually take up?(2)
d) Describe what is wrong with this CSS code: <b> { color: black; } (2)
Consider the following CSS code:
em { color: red; }
strong { color: blue; }
h1 {color: green;}
strong em {color: yellow; }
h1 em strong {color: purple; }
e) What color will the text be? <em><strong>text<strong></em>(1)
f) What color will the text be? <strong><em>text</em></strong>(1)
g) What color will the text be? <h1><em>text</em></h1>(1)
h)What are the three levels of CSS Style Sheets? Show them in the order they will be
searched for by the browser. (5)
i) What is the correct CSS syntax to set background colour of a webpage to powder-blue? (2)
j) Where in an HTML document is the correct place to refer to an external style sheet?(2)
k) In external style sheet, how do you display hyperlinks without an underline? (2)

Question 4

a) Write a PHP program to display count, from 1 to 10 using a PHP loop. Hint One can use a
for loop or while loop [10]
b) Write a program in PHP to create the pattern below:
*
***
****
*****
******
*******
******** [10]
Hint: use a for nested loop
Question 5

a) Which one of these has an illegal name? [1]


I. $myVar
II. $my_Var
III. $my-Var
b) State two ways to declare a variable in PHP [2]
c) What is php.ini file [2]
d) Write a PHP script to retrieve a list of students who passed a course,’BIT201’.You can
assume that the database schema is called ZOUDB, and an entity called CourseResult which is
defined with attributes course-code, student-pin and score. You can assume that Student and
course table exist as a separate table in the same schema. Your script should show the name of
student, the course name and mark in an HTML table of results. [10]
e) What is the name of the script which is called by the request string? [2]
f) What php code snippet would you use rip the variables in the query string? [2]
g) State one application of PHP [1]

You might also like