You are on page 1of 11

CONFIDENTIAL

UNlVERSlTl TEKNOLOGI MARA FINAL EXAMINATION

: INTERNET PROGRAMMING I
COURSE CODE

: ITC571 : 1 APRIL2005 : 2 HOURS (2.45 P.M. 4.45 P.M.)

-

:

NOVEMBER 2004 -APRIL 2005

INSTRUCTIONSTO CANDIDATES

1.

This question paper consists of three (3) parts : PART A (25 Questions) PART B (2 Questions) PART C (3 Questions) Answer ALL questions in the Answer Booklet. Start each answer on a new page for PART B and PART C. Do not bring any material into the examination room unless permission is given by the invigilator. Please check to make sure that this examination pack consists of: i) the Question Paper an Answer Booklet - provided by the Faculty. ii)

2. 3.

4.

DO NOT TURN THIS PAGE UNTIL YOU ARE TOLD TO DO SO This examination paper consists of 11printed. pages . .

-

O Hak Cipta Universiti Teknologi MARA

CONFIDENTIAL

edu. 3. window. A. 1 C. allows you to add an alternative text description about an image to assist when the image isn't viewable D.my) D. - A. userage=prompt("What is your age?") B. document.my" B.my B.href="http://www. userage=prompt("What is your age?". <a href="url" new> B. 7.my) C. allows you to add an alternative hyperlink Which of the following lines of code will. <a href="urln target="-blank"> D.my D.edu.my How many alert boxes will the following loop produce? for ( var lndex = 0. internal link C. mailto. external link B. allows you to add a comment in your code B.my" Which of the following lines of code correctly displays a prompt box with the message "What is your age?" and an empty textbox where the user type the age.tmsk. change the web page being displayed by the browser to FTMSK's homepage? A.luser@domain.change (htt~://www. 5.edu.uitm.uitm.CONFIDENTIAL PART A (50 MARKS) 1. " What is your age?") CONFIDENTIAL 4. <a href="url" window="new"> What does the ALT code do? A. mailto. userage) D. when executed. mailto:user@domain. <a href="url" target="new"> C. 0 6.uitm.tmsk.tmsk. O Hak Cipta Universiti Teknologi MARA .URL=" http://www.edu.edu. 3 A href attribute that includes the named anchor preceded with # symbol links to an 2. location. mailto:l/user@domain. prompt("What is your age?". lndex c= 2. document.edu.my C. e-mail composer D. " ") C.edu. and then stores the user's entry in a variable named userage? A. allows you to use an alternative image for a picture swap C. prompt(userage. 6.tmsk.change(htt~:Ilwww~uitm. 2 D. ++Index ) alert( lndex ). A syntactically correct value to assign to HREF is: A.edu. e-wallet feature How can you open a link in a new browser window? A.user@dornain.

<font size=5 colour="green" face="GaramondV> APA KHABAR </font> C. D. so that the text will be in green color. Which of the following statements is true? A. document. border @ Hak Cipta Vniversiti Teknologi MARA CONFIDENTIAL . Three parts that made up URLs A. document.images[O] B. document. margin D. B. The <LI> tag is used for list items for all types of HTML lists. The naming shceme of the mechanism. the vertical location of the image B. D. the user address and the name of the resource itself D. C. This <b><i>word</i><lb> will be in <b>bold</b> and in <i>italicsc/i>. The naming shcerne of the mechanism. <font size=5 color="green" type="Garamond> APA KHABAR </font> 14. When designing a layout using a table. The naming shceme of the hyperlink. 12. Definition lists are not useful fqr including custom bullets in a list. 10. information about where the image should be placed D. cellpadding C. padding B.CONFIDENTIAL 3 CSlMAR 2005lITC571 8.images[first] D. This <i><b>word</i></b> will be in <b>bold</b> and in <i>italics</i>. i>word<lb. Which of the following <font> tags directs the browser to display a text "APA KHABAR". This <b><i>word<lb><li> will be in <b>bold<lb> and in <i>italics</i>. text to use in place of images if the browser does not display images 9. This <b.images[irnagel] The ALT attribute is used with the <IMG> element to provide A. The naming shceme of the hyperlink. Which of the following is the most appropriate way to code in HTML? A. B. document. Ordered lists must start at a value of I. the user address and the name of the resource itself 13. the name of the machine hosting and the name of the resource itself B. C. sized of 5 and faced of garamond? A. Unordered lists are numbered with Arabic numbers by default. <font size=5 colour="green" type="Gararnond> APA KHABAR </font> B. the name of the machine hosting and the name of the resource itself C. <font size=5 color="green" face="Garamond"> APA KHABAR </font> D. 11. what attribute need to be used in the <table> tag to specify extra blank space around the inside edges of the table's cells? A.images[l] C. Which of the following code refers to the first image object on a web page? A. i> will be in <b>bold</b> and in <i>italics<li>. information about what font to use if the first choice is not supported C.

age = prompt("How old are you?".) A. 2. verticalalign D. "How old are you?") 20. B. Answer. To set the vertical alignment of text in a table cell. 1" (by itself) D. which has one parameter and sends it the string value "Cubaan 1. 3").*"> 17. Which of the following lines of code calls a function named Result. 3").a n d . function Result ("Cubaan 1. Answer. age = prompt("How old are you?" B. and then stores the user's entry in a variable named age. 2. which attribute should be used? A.CONFIDENTIAL 4 CSIMAR 200511TC571 15.message. // (by itself) C.*. 3". A. verticaltext 16. Result = "Cubaan 1. <frameset cols="1/5.. -21. D. +age) D. document. < ! . 2. I/ and I1 ( a pair) 18.1/5. defined in a form named message? A. <frameset columns="25%.> B. <frameset columns="20. Answer B. Which of the following are used to mark comments in HTML? A. 3").2.value GI Hak Cipta Universiti Teknologi MARA CONFIDENTIAL . (Assume that the age has already been properly declared.message. Result ("Cubaan 1.*. document.1/5~1155'~ C. B. Which of the following lines of code correctly displays a prompt box with the message "How old are you?" and an empty textbox where the user may type the name..25%.25%. Which of the following <frameset> tags has the correct syntax to create a frameset with 5 columns of equal width? A. C. <frameset cols="*. vertical C.20. prompt(age+.20. C. <input> <radio> <formtype> <radiobutton> 19.115.25%.value D. "0 ") C. message. valign B.2. D.20"> B.25%"> D. prompt("What is your name How old are you?".*.3". Which of the following lines of JavaScript code is used to access text that the surfer has entered in a text box named Answer. rAnswer C. message. Which HTML element is used to create a radio button? A. call Result ("Cubaan 1.20.

Which attribute may be used in a <body> tag to specify the color of the background on a web page? A. function displayR("Test 1.CONFIDENTIAL 5 22.2. backgroundcolor @ Hak Cipta Universiti Teknologi MARA CONFIDENTIAL .2.") B. 24. cellpadding="20 D.2. vspace="20" 6. <HR width=70% size=15> 25. displayR("Test 1. Which element is used to create a first line indent of 20 pixel? A. A.2." D. which has orie parameter and sends the string value "Test 1. hspace= "20" C. <HR width=70% height=15> D.") 23. color D. What is the html code to create a horizontal rule with a width of 70% of the window and a size of 15 pixels? A. call displayR("Test 1.". bodytcolor C.") C. bgcolor B. <Ruler width=70% size=l5> C.2. <Ruler width=70% height=15> B. cellspacing="20" Which of the following lines of code calls a function named displayR. displayR = "Test 1.

CONFIDENTIAL PART B (20 MARKS) QUESTION I Examine the following code segments and draw the appropriate output: a) <script language = "javascriptW> - document.write("<TABLEBORDER =1 WIDTH= "+(i*20)+"% ALIGN=CENTER> <TRXTD ALIGN=CENTER>Jika i mod 2 ! = 0 "+(i+l)I s </TD></TR>") + . loop " + (i+l) +"</TD></TR>") .write("<TABLEBORDER = 2 WIDTH= 100% align=center>") for(i=O. i++) ( if (i%2 ==0) document. i<5. (5 marks) CONFIDENTIAL O Hak Cipta Universiti Teknologi MARA . else document. loop I t marks) alert(t + " " + m </script> + " " + s + " " + k ).write("<TAB~E BORDER =1 WIDTH= "+(i*20)+"% ALIGN=CENTER> <TR><TD ALIGN=CENTER>Jika i mod 2 =0.

a) <script language = javascript> var tata = new Array[1.71.6.6.3.CONFIDENTIAL QUESTION 2 Examine the following code segments carefully. document. var susunan = new Array[6. 1 alert (bilangan) . i < tata. + (i+l) "<BR>" + "Number: " + + 1 i=i+l.length. != n ) ) ( if (count alert (count) . var bilangan=O.2.4.3. count <=20.5. @ Hak Cipta Universiti Teknologi MARA CONFIDENTIAL . count = count + 1. i=O . <script language = javascript> var count = 2. for ( .write("Element: " tata(i) + " < B R > " ) .71.2. else break. var n = 5.4. List out the errors (if any) and correct them. ) { if (tatali) == susunanti)) I / / bilangan++.5. for ( .

c) Write an input box.5. e) Convert the following mathematical expression: &+ f (5 marks) @ Hak Cipta Universiti Teknologi MARA CONFIDENTIAL . which will not appear on the web. b) Write an event handler that call a function named. a) Print rounded number for 7. kiraowhen loading the page.CONFIDENTIAL PART C (30 MARKS) QUESTION 1 Write the JavaScript portion for each of the following statements. d) Convert an integer number into a string.

Answer the following questions: chtml><head> <title>LIST OF STUDENT</title> c/head><body> <table border="ln width="100%"> <tr> <td width="50%" valign="top"> <p align="center">cu><b>LIST OF STUDENTS</b></u></p> <table border="ONwidth="100%"> <tr> <td width="ll%" align="centerWbgcolor="black"> <b>N~.</p> <p>&nbsp.</b></td> Ctd width="47%" align="centernbgcolor="black"> <b>Name</b></td> < / tr> <tr> <td width="ll%"> <p align=" center*"><td> / <td width="42%"> <p align="centerl'><input type="textUname="Tll' size="21n></td> <td width="47%"> <p align="center"><input type="textVname="Tl" size="26"></td> </tr> </table> <p>&nbsp.</p> @ Hak Cipta Universiti Teknologi MARPI CONFIDENTIAL .</b></td> <td width=" 42%" align="center" bgcolor="black"> <b>Metric No.CONFIDENTIAL 9 QUESTION 2 Examine the html code below.</td> <td width="50%"><textarea rows="1SU name="SlU cols="54"></textarea> <p align="center"><input type="submit" value="PICK STUDENT name="Bl"><input type="reset" value="ResetU LIST!" name="B2"></td> < / tr> </table> <p>&nbsp.

write a JavaScript client to pick 10-student from the list randomly and display the list of 10 students in textarea as shown in an example below. I I 1s. (8 marks) Matric-No 123400000 123411111 123422222 123433333 123444444 123450000 123451111 123452222 123453333 123454444 123455555 123456666 123457777 123458888 123459999 123466666 123477777 123488888 123499999 Name QURRATUL AIN SAYUTI GAMAROFIZAN ZAlNAL SUMAIYAH SUMIN BAKAR BUSU BUNYAMIN BUNYAN ABU BAKAR CHU HAMlD OTHMAN SYARIFAH SAKINAH MOHD NlSFU SAKBAN NIK KAMAL NI PA TUAN YUNUS TUAN MAN FADllAHTUL HUDA ALIAS AHMAD SlRARl SIRJAN ZARKAWI ZAKWAN PAKHARUDDIN PAKHAN TAHIR TAHAR SIT1 NURHALIZ TAMAN KAMAR DURIN SAHAK HALIMAHTUN DAUD Note: You are required to apply looping where-it can dynamically retrieve aN records in the student table regardless of the total number of students. QURRATUL A I N S A Y U T I SYARIFAH SAKINAH F A D I L A H T U L HUD. II 9.. Utilize the html code above to write an ASP file for retrieving all the records automatically when the page is loaded. 10-scudcnt ploked randomly: .. named as sfudent. ..SIRJAN H A M I D OTHMAN S I T 1 N U R H A L I Z TAMAN KAXAR D U R I N S A H A K SUXAIYAH S U M I ~ PICK STUDENT LlSTl . A . - ( Reset I . .. .4 A L I A E TAHIR TAHAR HAL I M A H T U N D h U D AHMAD S I R A R I. llsz of 123400000 123452222 12345GGt6 123466666 123499999 123457777 123451111 123477777 123488888 123422222 .CONFIDENTIAL 10 CSIMAR 200511TC571 a... 10.. . The 1.. . . A4. Assuming the records had been stored in a database.. . 2. O Hak Cipta Universiti Teknologi MARA CONFIDENTIAL . . 8. (12 marks) . ... Upon completion question a) above.. named as studentlist through a table.. - r. 5. 7. .. b.... The records which are already stored in student table are as follows.

must range between 40 . print message: "You have passed this code!!" If condition 1 is not fulfilled. Condition 1: Take the course first Condition 2: The marks for a test. print message: "Please take this code next semester!!".CONFIDENTIAL QUESTION 3 Write a JavaScript to satisfy the following requirement: There are four conditions needed to pass a subject code called. must range between 10 .100 If all the conditions are fulfilled. If condition 3 is not fulfilled. (5 marks) END OF QUESTION PAPER @ Hak Cipta Universiti Teknologi MARA CONFIDENTIAL . print message: "Please re-take the test!!". print message: "Please take this code first!!: If condition 2 is not fulfilled. The conditions are as follows.15 Condition 4: The marks for the final examination. itc571.20 Condition 3: The marks for a mini project. print message: "Please present again!!: If condition 4 is not fulfilled. must range between 8 .