Mid Semester Examination I 2011/2012 Web Programming
SECTION A: MULTIPLE-CHOICE (18 QUESTIONS, 18 MARKS) Instruction: Please select the BEST answer from the given choices.
1. All the following are browsers, EXCEPT: (a) Internet Explorer (b) Mozilla (c) WAMP (d) Google Chrome
2. Which one of the following statements is TRUE? (a) Suitable domain for Malaysia Ministry of Finance web site is com. (b) http://www.mydomain is an example of correctly formulated URL. (c) Suitable domain for Association of the Computer and Multimedia Industry Malaysia (PIKOM) web site is org. (d) Links make the page load slower.
3. What kind of graphic should be inserted in web page? I. Small or medium sized of graphic files that do not take too much time to load. II. Meaningless or useless graphics. III. Graphics that in BMP format. IV. Graphics with no alt labels (a) I, II and III (b) I and II only (c) I, II and IV (d) I only
4. Which of the following is the attribute? (a) form (b) table (c) width (d) img
Page 2 of 9 Mid Semester Examination I 2011/2012 Web Programming
5. Which of the following is the TRUE statement concerning internal hyperlinks? (a) To create an internal link in a Web page, the value of the href attribute includes the named anchor preceded by a * (asterisk) symbol. (b) The "internal" refers to the internal contents of a table. (c) Internally-linked location names can be assigned to any point in an XHTML file. (d) href = "page.html&name" is the proper format used to link to an internal location of another page
6. Given: <body bgcolor=bbbbb text=cccccc link=dddddd vlink=eeeeee alink=ffffff background=gggggg> Which of the following is a CORRECT match between the attribute and its usage? I. bgcolor Sets the Background colour for the page II. text Sets the colour of the ordinary text III. link Sets the colours of links IV. vlink Sets the colour for visited links V. alink Sets the colour for active links (a) I, II and III only (b) III, IV and V only (c) I and II only (d) All of the above
7. What is the correct XHTML for a horizontal line? (a) <hr /> (b) <hr> (c) <horizontol line> (d) <hl />
Page 3 of 9 Mid Semester Examination I 2011/2012 Web Programming
8. What property is used to set margins around elements? (a) Margin (b) Padding (c) Border (d) Spacing
9. The CSS ________ property is used to layer elements in front or behind each other. a) a-index b) y-index c) x-index d) z-index
10. What is the correct HTML for referring to an external style sheet? a) <link style src="mystyle.css"> b) < link href="mystyle.css" style="external"> c) <link rel="stylesheet" type="text/css" href="mystyle.css"> d) <link rel="external style sheet" href="mystyle.css">
12. Figure 2 shows a table of some of the more common units and the abbreviations used to represent them. Units Abbreviation I. pixels px II. points pt III. pica pc IV. inches in V. meter m Page 5 of 9 Mid Semester Examination I 2011/2012 Web Programming
VI. centimeters cm VII. percentage % Figure 2 Which one of the above is NOT the unit used in web page development? (a) I only (b) III only (c) VII only (d) V only
13. ___________ allows users to control the look of the web pages that they visit. (a) Inline Style Sheet (b) Internal Style Sheet (c) Developer Style Sheet (d) User Style Sheet
Figure 3 14. What is content in line 2? (a) Element (b) Attribute (c) Value (d) Variable
15. What should you do to make line 5 as XHTML code? (a) Replace <br> with <BR> (b) Add ; (semicolon) after Bye bye (c) Replace Bye bye to Byebye (d) Replace <br> with <br/> Page 6 of 9 Mid Semester Examination I 2011/2012 Web Programming
Refer to Figure 4 to answer Question 16 17
1 <html> 2 Welcome Page 3 <body> 4 Welcome to My Website 5 </body> 6 </html>
Figure 4 16. How to fix the errors of codes shown in Figure 4? (a) Remove <body> tag in line 3 and write it in line 1, before Welcome Page text. (b) Remove <body> tag from the whole document. (c) Change <body> tag to <BODY> tag. (d) Insert semi colon (;) at the end of line 2.
17. How to bold Welcome to My Website text (in line 4)? (a) Insert <b><\b> between Welcome to My Website. (b) Insert <bold><\bold> between Welcome to My Website. (c) Insert <BB><\BB> between Welcome to My Website. (d) Insert <em><\em> between Welcome to My Website.
18. Which XHTML codes create a link to a mail message? (a) <html> <body> This is an email link: <a href="mailto:someone@example.com">Send Mail</a> </body> </html>
(b) <html> <body> This is an email link: <a href="e-mail to:someone@example.com">Send Mail</a> </body> </html>
(c) <html> <body> This is an email link: <a href="someone@example.com">Send Mail</a> </body> </html>
Page 7 of 9 Mid Semester Examination I 2011/2012 Web Programming
(d) <html> <body> This is an email link: <a href="mailto\someone@example.com">Send Mail</a> </body> </html>
SECTION B: SHORT ANSWER QUESTIONS (2 QUESTIONS, 24 MARKS) Instruction: Answer ALL questions.
Question 1 Figure 5 shows an XHTML page that applies internal style sheet. Figure 6 presents the User Style Sheet.
<html><head> <style type="text/css"> .large {font-style: italic;} .largefont {font-style: italic;} p { color: red; } strong { font-size:26px; } </style> </head> <body> <div class="large"> This is a DIV sample. </div> Span is not at the <span class="largefont">block level</span>. <p>This is an example <strong>showing HTML inheritance. </strong></p> </body></html>
Figure 5
p { color: green; }
Figure 6 (a) Sketch the expected output of codes shown in Figure 5. At this stage, the User Style Sheet (Figure 6) is not applied. [8 marks]
Page 8 of 9 Mid Semester Examination I 2011/2012 Web Programming
This is a DIV sample- italic 2 marks block level- italic- 2 marks This is an example..- red 2 marks ..showing HTML inheritance big size text- 2 marks
(b) If User Style Sheet shown is Figure 6 is applied, are there any changes to the output produced in Question 1(a)? If no, provide the reason. If there are changes to the output, sketch to show how it looks like. [3 marks] Answer: No changes. Reason: Conclict happen. Style defined by developer win.
Question 2
Given:
1 <html><head> 2 <style type= "text/css"> 3 h2{color:blue}; 4 body h2{color:red}; 5 ul{list-style-type: lower-roman}; 6 </style> 7 </head> 8 <body> 9 <h2> If a job worth doing, it's worth doing it right </h2> 10 <ul style= "list-style-type: upper-roman"; > 11 <li> One </li> 12 <li> Two </li> 13 </ul> 14 </body></html>
Figure 7 (a) Conflicts occur in codes shown in Figure 7. Sketch the expected output to show how the conflicts are resolved. [6 marks]
(b) What type of CSS is shown in line 10? [2 marks]
Page 9 of 9 Mid Semester Examination I 2011/2012 Web Programming
(c) Rewrite the codes shown in Figure 7 to apply External Style Sheet. [5 marks] ANSWERS (a)
If a job worth doing, it's worth doing it right 1 MARK Size like H2 and red color 3 MARKS Roman numbering 2 MARKS
(b) What type of CSS is shown in line 10? Inline style sheet 2 MARKS [2 marks]
(c) Rewrite the codes shown in Figure 6 to apply External Style Sheet. [5 marks]
<html><head> <link rel="stylesheet" type="text/css" href="theme.css" /> 3 MARKS </head> <body> <h2> If a job worth doing, it's worth doing it right </h2> <ul style= "list-style-type: upper-roman"; > <li> One </li> <li> Two </li> </ul> </body></html>
2 MARKS
h2{color:blue}; body h2{color:red}; ul{list-style-type: lower-roman};