bcs2303 - web scripting 21112

Upload: vinoden-singaraveloo

Post on 13-Oct-2015

29 views

Category:

Documents


0 download

DESCRIPTION

exam paper

TRANSCRIPT

  • 5/22/2018 Bcs2303 - Web Scripting 21112

    1/15

    UniversitiJ alaysiaPAHANGEngineering Technology reativity

    FACULTY OF COM PUTER SYSTEM S SOFTWARE ENGINEERING FINAL EXAMINATION

    CO URSEEB SCRIPTINGCOURSE CODECS2303LECTURERG CHOON CHINGD ATE2 JUNE 2012D URATIONHOURSSESSION SEMESTER :ESSION 2011/2012 SEME STER IIPROGRAMME CODE :C S/BC N

    INSTRUCTIONS TO CANDIDATE:1 This question pap er consists of THREE 3 ) Sections: Sections A, B , andC. Answer AL L qu estions.2 Write your answers in the answer booklet provided.3 Answer EAC H question from Sections B and C o n a new page.4 All calculations and assumptions must be clearly shown.

    EXAMINATION REQUIREMENTS:

    NONEDO NOT TURN THIS PAGE UNTIL YOU ARE TOLD TO DO SO

    This exam ination pap er consists of FIFTEEN 15) printed pages including the front page.

  • 5/22/2018 Bcs2303 - Web Scripting 21112

    2/15

    CONFIDENTI LCSIBCNI1112II IBCS2303SECTION 15 MARKS]Choose the correct answer

    1. HTML (HyperText Markup Language) is a special type of computer languagecalled a n) language designed to specify the content and structure ofweb pages (also called documents) in a portable manner.

    A. scriptingB. markupC. object-oriented programmingD. procedural programming

    2 s used to specify the presentation or styling of elements on a w eb page (e.g., fonts, spacing, sizes, colors, positioning).

    A. HyperText Markup Language HTML5 )B. Cascading Style Sheets (CSS)C. JavaScript

    3. simplifies JavaScript programming by making it easier to manipulate aweb page s elements and interact with servers in a portable manner across variousweb b rowsers.

    A. jQueryB. JavaScriptQueryC. CSS3W K W N

  • 5/22/2018 Bcs2303 - Web Scripting 21112

    3/15

    ONFIDENTI LCS BCN 11 1211 BCS23034 The? in the URL www google com/search?q= deitel separates thefrom the rest of the UR L in a request .A UIUB post requestC. query s tr ingD cache

    5 HTIvIL5 text is marked up with elimited by ha t a rekeywo rds conta ined in pairs of________

    A. elements, angle brackets, tagsB. angle brackets, elements, tagsC. tags, elements, angle bracketsD elements, tags, angle brackets

    6. A l ink to an e-m ail address is c reated us ing the no tat ionPaul.

    @LAUNCH emailB mailto: email ddressC email: em ailA ddressD em ailA ddress

    7. Which s ta tem ent i s FALSE?

    A. The code; syntax is reserved for spec ia l characters .B. T h e del eleme nt is used to delete text .C. The sup and sub elements are used to denote supersc rip t and subscrip t

    characters.D T h e hr element introduces a horizontal rule.

  • 5/22/2018 Bcs2303 - Web Scripting 21112

    4/15

    CONFIDENTI LCS BCN 111211 BCS23038 Which of the following is the MOST accurate statement concerning internalhyperlinks?A. The internal refers to the internal conten ts of a tableB. Internal ly-linked locat ion names can be assigned to any point in an HTM L5

    f i lC href = page. html&name is the proper format used to link to an internal

    location of an other pageThe internal refers to the host machine on which the browser is running

    9 The t tribute places the cursor in a sp ecified text field after the brow serloads and renders the page.

    A requiredB placeholderC valueD autofocus

    10. An example of the CORRECT format for inline styles is:

    A

    A

    B

    C

    11. Which of the fol lowing selections is the proper way to apply this CSS rule:blue { color: blue

    A.

    B.

    C.

    D .

  • 5/22/2018 Bcs2303 - Web Scripting 21112

    5/15

    CONFIDENTIALCS BCN 1 1 12111BCS23 312. Which of the following statements would correctly print out the sentence HelloWorld in blue?A. document.write(

    );B. document.write(

    style = \ color: blue\ Hello World

    );C. document.write('

    13

    if ( y > 13document.writeln( x and y are > 13 );

    elsedocument.writeln( X is 13D. x is

  • 5/22/2018 Bcs2303 - Web Scripting 21112

    6/15

    CONFIDENTI LCS BCN 11 1211 BCS230314. W hat will the browser d isplay if the following script as illustrated in Figure 2 isexecuted and the user enters at both prompts?

    < --var firstNumber = window.prompt(var secondNumber=window.prompt(var thirdNumber;thirdNumber = firstNumber + secodocument.write( thirdNumber );1 >

    "Enter an integer", "0" );"Enter an integer", "0" );

    ndNumber;

    Figure 2A. nothingB. C. 1D.55

    15. Choose the CORRECT statement that refers to the SQ L q uery given in Figure 3.

    SELECT lastName FROM AuthorsWHERE iastName LIKE ' e'

    Figure 3

    A. selects from the table uthors the lastName fields which start with anysingle character followed by an e , then any num ber of additional characters.

    B. selects from the table Authors the lastName fields which start with eitherthe letter e followed by any number of additional characters.C. selects from the table Authors the lastName fields which constist of any

    num ber of characters followed by an e and any single character.D selects from the table Authors the lastName fields which end w ith the letter

    e .

  • 5/22/2018 Bcs2303 - Web Scripting 21112

    7/15

    ONFIDENTI LCS/BCN/1 11211/BC S2303SECTION B5 5 M AR K S]QUESTION 114 Marks]A w ell-rounded we b designer needs to understand m any of the technical and artisticaspects of web design, although not necessarily needing to specialize in both.

    a) Describe TWO 2) factors of aesthetic a web designer needs to consider duringthe development.

    [4 M arks]

    b) Describe the important of learning from the usage statistics as part of the designrequirements?

    [2 Marks]

    c) Give the reason that a k ey factor in the usability of a site is its navigation?[2 Marks]

    d) Give THREE 3) methods of usable designing.[6 M arks]

    7

  • 5/22/2018 Bcs2303 - Web Scripting 21112

    8/15

    CONFIDENTIALCS/BCN/1 11211/BCS2303QUESTION 2Marks]Web application has been widely used in content management system customerrelationship management, decision support system, online retail sales, forum, socialnetworks and perform many other functions.

    a) Draw a diagram to illustrate the Model View Controller MVC) of webapplication.

    [3 Marks]

    b) Explain each phase of the model view controller.[6 M arks]

  • 5/22/2018 Bcs2303 - Web Scripting 21112

    9/15

    ONFIDENTI LCS BCNI1 1 1211/BCS2303QUESTION 1 Marks]HTM L is the lingua franca for publishing hypertext on the World W ide Web. B asedon the source code in Figure 4 , answer the following q uestions.

    < DOCTYPE html>

    Table Example Page< h2>

  • 5/22/2018 Bcs2303 - Web Scripting 21112

    10/15

    CONFIDENTI LCSIBCNI 1 1211 BCS2303QUESTION 41 Marks ]avaScript is a scripting language which is used to enhance the functionality andappearance of web pages Based on the source code in Figure 5 answer the followingquestions

    < DOCTYPE html>

    Switching between HTML5 List Formats

    var choice; II user's choicevar startTag; II starting list item tagvar endTag; II ending list item tagvar validlnput = true; 1 true if input valid else falsevar iistType; II type of list as a stringchoice = window.prompt( Select a list style:\n +

    "1 (Unordered), 2 (Ordered)", "1" );switch ( choice

    case "1":startTagendTag = "";listType = "Unordered List";break;

    case "2":startTag =endTag = "";listType = "Ordered List";break;

    default:validlnput = false;break;

    //end switchif ( validlnput === true

    document.writeln( listType + startTag );

    for ( var i = 1; i

  • 5/22/2018 Bcs2303 - Web Scripting 21112

    11/15

    CONFIDENTIALCS BCN 111211 BCS2303(a) Trace the output of the source code when user enters the choice value as 1 asshown in Figure 6. J a v a S c r i p t

    S e l e c t a l i s t s t y le1 Unordered ) , 2 Ordered)

    1oKCanc e lFigure 6

    [3 m arks]

    (b) Trace the output of the source code when user enters the choice value as 12 asshown in Figure 7.

    J a v a S c r i p tS e l e c t a l i s t s t y le1 Unordered ) , 2 Ordered)Ka n c e l

    Figure 7[3 m arks]

    c) Write the code to change the default style of unordered and ordered list intosquare bullet and letter list, respectively, as highlighted in Figure

    [4 m arks]

  • 5/22/2018 Bcs2303 - Web Scripting 21112

    12/15

    ONFIDENTI LCS BCN 1 11211 BC S2303QUESTION 52 M arks ]PHP or PHP: Hypertext Preprocessor has become the most popular server-sidescripting language for creating dynamic w eb pages. It is an independent platform andalso supports many databases, including M ySQL.

    a) In PHP casting and s ttyp have been used for conversion between types.Explain the MO ST significant difference between these two conversions.

    [2 marks]

    b) Assume that PHP variable $firstString = Hello ; and $secondstring= World ;. Write a code to combine both variables into $resultString withthe value Hello World .

    [2 marks]

    c) Trace the outpu t of the PHP codes given in Figure 8.

    Figure 8

    [4 marks]

    12

  • 5/22/2018 Bcs2303 - Web Scripting 21112

    13/15

    ONFIDENTI LCS BCN 11 1211 BCS2303d) Figure 9 shows the associative array $ record in PHP. W rite a PHP statementthat creates 2 normal arrays using numerical index) named 'month' n d'number'. Elements of array 'month' are the same as the keys of hash array'record' and elements of array 'number' are the same as the values of the hasharray.

    $record = array(January first , February second ,March third , April fourth ,May fifth , June sixth ,July seventh , August eighth ,September ninth , October tenth ,November > eleventh , December => twelfth

    Figure 9

    [4 M arks]

    3

  • 5/22/2018 Bcs2303 - Web Scripting 21112

    14/15

    CONFIDENTI LCSIBCN 1112111BCS2303SECTION C30 M AR KS]QUESTION 615 Marks]You are given an H TML output as shown in Figure 10. It is a com bination of HTMLform and table. Write a complete HTM L code to produce the sam e output as shown inFigure 10.

    [ 5 Marks]

    eedback ormPlease fillout this form to help us improve o ur site

    conmients.

    113-mad Address:[iiiIIiII__Jnter coeentsherjThings you Ilk-ed: kite design [I) Links Li Ease of use Images LI Source code LiHowdyou get toose?:JiSthengine 4 Lit-A cs fromanothersite 1Deiteicoxn Web site.Reference inabook C llthei 0Rate our site

    Goo,____

    SubmitPoor

    Figure 10

    QUESTION 715 Marks]Based on Figure 10 assume that this form will submit to a PUP file namedregister. php . A fter personal information is manually filled in the form, and the

    button Submit is clicked the output of register. php will be display ed asshown in Figure 11. Figure 12 shows MY SQL database named my_db to be usedwith the table nam ed survey . W rite a complete PHP script based on Figure 10 andFigure 11. The script must display the information in Figure 11 and the information issaved in survey table.

    [15 Marks]4

  • 5/22/2018 Bcs2303 - Web Scripting 21112

    15/15

    CONFIDENTIALC S B C N l 1 1 2 11 1 B C S 2 3 0 3You have successfully typed-in these following information:-Name Selamat JawabC o mmen ts: This is a fantastic w ebsite.Email: selamat@examplecom Things you liked: Site design, LinksHow did you get to our site?: Search engineRate our site: Very Good

    Figure 11

    su v yField Type Null Defaul t Comments M I M E

    name varchar 50) N ocomments text Noemail varchar 50) N ofavourite varchar 50) Noresource varchar 50) N orating varciiar 50) N o

    Figure 12

    END OF QUESTION P PER5