Sei sulla pagina 1di 15

Suggested Answers with Examiner's Feedback

Question Paper Web Technologies (MC338) : January 2008

Section A : Basic Concepts (30 Marks)


This section consists of questions with serial number 1 - 30. Answer all questions. Each question carries one mark. Maximum time for answering Section A is 30 Minutes.

1.

Which of the following options is correct with regard to HTML? (a) (b) (c) (d) (e) It is a modelling language It is a DTP language It is a partial programming language It is used to structure documents It is a scripting language.

<Answer>

2.

Consider the following statement: GET /cgi-bin/dispenser.pl&want=whatsnew.html HTTP/1.0 Which of the following options is a correct one? (a) (b) (c) (d) (e) The above statement is a part of a request from a web client The above statement is a part of the input to a CGI program want is a variable and whatsnew.html is a value want is a variable and whatsnew.html HTTP/1.0 is the value dispenser.pl may be a CGI program.

<Answer>

3.

When trying to access a URL, the following message is displayed on the browser: Server; Error 403 What could be the reason for the message? (a) (b) (c) (d) (e) The requested HTML file is not available The URL refers to a CGI script and the header of the script does not indicate where the interpreter is located The path to the interpreter of the script file is invalid The first line of the output from the script is not a valid HTTP header The requested HTML file or CGI script has insufficient permission.

<Answer>

4.

Which of the following statements is incorrect regarding multimedia on the web? (a) (b) (c) (d) (e) The MPEG, AIFF and WAV are cross-platform formats The MPEG, AU and MIDI are cross-platform formats The SND format has a relatively low fidelity VRML can be used to model and display 3D interactive graphics The dynsrc attribute in the < img> element can be used to include videos in web pages.

<Answer>

Page 1

Suggested Answers with Examiner's Feedback


5. What would be the colours of the RGB where the hexadecimal values are #FF0000, #00FF00 and respectively? (a) (b) (c) (d) (e) 6. Blue, Green, Red Green, Blue, Red Green, Red, Blue Red, Blue, Green Red, Green, Blue. #0000FF

<Answer>

The elements <DIV> and <SPAN> have the following characteristics (a) (b) (c) (d) (e) Element <DIV> inherits properties defined for <SPAN> in a stylesheet <DIV> and <SPAN> have no real meanings as html tags unless stylesheet is applied Elements <SPAN> and <DIV> define content to be inline or block-level <DIV> and <SPAN> are used as alternatives for the element <P> <DIV> is used inside element <P>.

<Answer>

7.

Which of the following statement is not true regarding JavaScript? (a) (b) (c) (d) (e) JavaScript is a loosely typed language JavaScript is an object-based language JavaScript is event driven A JavaScript embedded in an HTML document is compiled and executed by the client browser JavaScript can not run in stand-alone mode (without a browser).

<Answer>

8.

The following is a web-page: <html> <head> <title>JavaScript</title> </head> <body bgcolor="#0000ff"> <script language="JavaScript"> <!-- document.write ("<h1> hello world </h1>"); //--> </script> </body> </html> When the above web page is loaded into a browser, what will happen? (a) (b) (c) (d) (e) The body of the web page will not contain any text The body of the web page will contain the text <h1> hello world </h1> The body of the web page will contain the text hello world as an H1 heading The background color of the web page will be green document.write ("<h1> hello world </h1 > ); is a comment.

<Answer>

9.

The following statements are about three important browser objects in JavaScript. I. window object : The highest of all objects in the client-side JavaScript object hierarchy. II. navigator object : A collection of information about the browser. Useful in browser sniffing. III. document object : Provides access to the document being viewed. Which of the above statements is/are true? (a) (b) (c) (d) (e) Only (I) above Only (II) above Only (III) above Both (I) and (II) above All (I), (II) and (III) above.
<Answer>

10. Consider the following script: <html>

Page 2

Suggested Answers with Examiner's Feedback


<head><title>JavaScript</title></head> <body> <script language="JavaScript"> var a=80 var b=(a==80 ? "pass" :"fail"); document.write(b ) </script> </body> </html> What will be the output of the above script? (a) (b) (c) (d) (e) pass fail null 80 Error at line 6.

<Answer>

11. The following web page is loaded into a web server: <html> <head><title>JavaScript question</title></head> <body> <script language="JavaScript"> book = new Array(1,2,3,4,5,6,7,8); document.write(book[1]); book[10]=10; document.write(book[10]); </script> </body> </html> Once the above web page is loaded what will its body contain? (a) (b) (c) (d) (e) 2 10 1 10 110 210 Error at line 7.

<Answer>

12. Which of the following statements is false regarding Cookies ? (a) (b) (c) (d) (e) Cookies are programs which run in the background of the web-client Cookies have the potential of being used to violate the privacy of users Cookies are very helpful in keeping track of users in developing online shopping cart applications, personalized portals and in advertising on web sites Cookies cannot contain more than 4Kb of data Cookies usually contain data in the form of name = value pairs.

<Answer>

13. Consider the following script: <html> <head><title>JavaScript</title></head> <body> <script language="JavaScript"> document.write ((125/5)%12); </script> </body> </html> What would be the output of the above script?

Page 3

Suggested Answers with Examiner's Feedback


(a) (b) (c) (d) (e) 0 1 2.083 3 25%12.

<Answer>

14. Which of the following statements is true regarding HTTP? (a) (b) (c) (d) (e) Web browsers use only HTTP as a communication protocol with servers It does not maintain any connection information on previous transactions It is designed to route information based on content It refers to resources using their Universal Resource Identifier (URI) It does not carry browser information to the server.

<Answer>

15. Which of the following is true about XHTML? (a) (b) (c) (d) (e) It is a new hybrid technology that is different from both XML and HTML It has totally replaced HTML as the tool for building Web pages It is a reformulation of HTML in XML One cannot use it to create Web pages It has to be converted to HTML using a style sheet.

<Answer>

16. While working on a JavaScript project, in your JavaScript application, which function would you use to send messages to users requesting for text input? (a) (b) (c) (d) (e) Display() Prompt() Alert() GetInput () Confirm().

<Answer>

17. Consider the following syntax: <MAP NAME="World Map"> <Area Coords="0,0, 100, 200" HREF="homepage.html "> </MAP> When would you use the above syntax? (a) (b) (c) (d) (e) When defining an image map When referring back to homepage.html When referring to World Map When embedding a graphic in JavaScript When aligning an image on a web page using JavaScript.

<Answer>

18. Which of the following is true about client-side script use in HTML documents? (a) (b) (c) (d) (e) Java, JavaScript, Jscript and VBScript are used on many web sites as Scripting languages Client side scripts are executed on the server and the resulting page will be downloaded and interpreted by the browser Client-side scripts increase the network traffic on execution of the script Client-side scripts can perform many functions such as data validation and provide interactive feedback to the user Browsers need plug-ins to execute client-side scripts.

<Answer>

19. Consider the following entries in a Cascading Style Sheet ( CSS) file. P {colour : blue; background- colour : white; border- colour : red; border-left: solid} BODY {colour : black; border- colour : green} What is the colour of text in a paragraph of an HTML document that uses the above style sheet? (a) green

Page 4

Suggested Answers with Examiner's Feedback


(b) (c) (d) (e) blue black red White.

<Answer>

20. Which property does one use to align text to the right side of a block-level element in Cascading Style Sheets? (a) (b) (c) (d) (e) horizontal-align align block-align justify text-align.

<Answer>

21. Which of the following statements is false about event handlers in JavaScript? (a) (b) (c) (d) (e) They can be included with input tags They can be associated with end of file processing for a database application They can be included with the form tag They are generally used to call functions when triggered They can be used to trigger server-side scripts.

<Answer>

22. What method is used to specify a container's layout in JSP? (a) (b) (c) (d) (e) setLayout () Layout() setContainerLayout () ContainerLayout () setConLayout (). JSP?

<Answer>

23. Which method of the Component class is used to set the position and size of a component in (a) (b) (c) (d) (e) setSize() setBounds () setPosition () setPositionSize () setSizePosition ().

<Answer>

24. What value does readLine () return when it has reached the end of a file in JSP? (a) (b) (c) (d) (e) Last character in the file False Null EOF True.

<Answer>

25. Which class in JSP provides the capability to implement a growable array of objects? (a) (b) (c) (d) (e) Array class GrowAbleArray class Container class Vector class DynamicArray class.

<Answer>

26. In JSP, the classes that allow primitive types to be accessed as objects are known as (a) (b) (c) (d) (e) Primitive classes Object classes Boxing classes UnBoxing classes Wrapped classes.

<Answer>

Page 5

Suggested Answers with Examiner's Feedback


27. In JSP, a Canvas object provides access to a Graphics object via one of its method called: (a) (b) (c) (d) (e) getCanvas() getGraphics() paint() getPaint() accessGraphics ().

<Answer>

28. In ASP the function which returns the current system date is: (a) (b) (c) (d) (e) getDate() Date() Now() getCurrentDate () CurrentDate ().

<Answer>

In ASP the function which returns an expression formatted as a date or time is: 29. (a) (b) (c) (d) (e) 30. FormatDateOrTime() FormatDateAndTime () FormatTimeDate () FormatDateTime () FormatDT().

<Answer>

The function returns a Boolean value that indicates whether a specified expression can be evaluated as a number; in ASP is (a) (b) (c) (d) (e) IsNumeric() IsNumber() IsNotNumeric() IsNotNumber() IsNumberOrNot(). END OF SECTION A

<Answer>

Section B : Problems (50 Marks)


1. a. b. 2. a. b. 3. a. This section consists of questions with serial number 1 5. Answer all questions. Marks are indicated against each question. Detailed workings should form part of your answer. Do not spend more than 110 - 120 minutes on Section B.
( 5 ( 5 ( 4 ( 6 marks) <Answer> marks) marks) <Answer> marks)
<Answer>

Write a small JavaScript code to display the X, Y co-ordinates of mouse pointer, whenever it is clicked in an HTML document. Display the values through Alert box. Write an ASP code to display a different content each time a user visits a page. How does JSP handle run-time exceptions? What is SOAP message? What are the syntax rules for it? Give one example for it. The below figure is a web page containing an HTML form. Study the figure carefully and write

Page 6

Suggested Answers with Examiner's Feedback


3. the HTML code which generates the web page. The form will enable the user to select a course from the Course list BIT, MSC, PGDipFT and PGDipPT. The topics list contains HTML, JavaScript, PERL and ASP.

( 8

marks)

b.

Consider the following XML DTD for a book catalogue. <!DOCTYPE catalogue[ <!ELEMENT catalogue (book +)> <!ELEMENT book (authors, title, publisher, year)> <!ELEMENT authors (# PCDATA)> <!ELEMENT title (# PCDATA)> <!ELEMENT publisher (# PCDATA)> <!ELEMENT year (#PCDATA)> ]> If this is a valid DTD, explain what each line defines. If not, explain what is wrong.

( 2

marks)
<Answer>

4. a.

Explain each of the following XML terms and provide an example XML statement for each of them. i. Attribute ii. Empty Elements iii. Root iv. XML Declaration v. Comments. Write the DTD corresponding to the XML document given below. <?xml version= 1.0?> <!DOCTYPE address-book SYSTEM address-book.dtd >

( 5

marks)

b.

Page 7

Suggested Answers with Examiner's Feedback


<address-book> <entry> <name>ABCDEF</name> <address> <street>Panja Gutta</street> <region>Hyd West</region> <postal-code>500082</postal-code> <locality>West</locality> <country>India</country> </address> <tel preferred= true>09122222222</ tel> <tel>09112345678</ tel> <email href= mailto:aaa@ bbb.com /> </entry> <entry> <name> <fname>Nimal</fname><lname>Jayakody</lname> </name> <tel>09123456789</ tel> <email href= mailto:bbb@ ccc.com /> </entry> </address-book> 5. a. Describe the similarities and differences between client side scripting and server side scripting with respect to browser dependence, database access, response time, authentication, security and script execution along with the advantages and disadvantages. Write about the different conversion function available in ASP. END OF SECTION B

( 5

marks)
<Answer>

( 7 ( 3

marks) marks)

b.

Section C : Applied Theory (20 Marks)


This section consists of questions with serial number 6 - 7 . Answer all questions. Marks are indicated against each question. Do not spend more than 25 -30 minutes on Section C.
<Answer>

6. What are the benefits of using CSS? Also list the drawbacks of it. 7. Write a short note on the following: a. b. jsp:plugin Element. jsp:fallback Element. END OF SECTION C END OF QUESTION PAPER

( 10

marks)

<Answer>

( 6 ( 4

marks) marks)

Page 8

Suggested Answers with Examiner's Feedback

Suggested Answers Web Technologies (MC338) : January 2008


Section A : Basic Concepts
Answer 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. D E E A E C D A E A D A B B C B A D B E B A B C Reason All the other options are wrong and incorrect for the question asked. All the other options are wrong and incorrect for the question asked. Server error 403 means insufficient permission. All the other options are correct for the question asked. The values are hexadecimal equivalent for Red, Green, Blue. According to the specifications of <SPAN> and <DIV> they are used to define the contents inline or block level. As the remaining all the options are correct and valid for JavaScript. Because of the comment nothing will be printed. According to the definitions of browser objects, all the statements are true. Because the outcome of the ternary operator. Because book[1] prints 2 and book[10] prints 10 Because cookies are not programs. 125/5 is 25 and 25%12 is 1(Remainder) All the other options are wrong and incorrect for the question asked. All the other options are wrong and incorrect for the question asked. Promt( ) is used to get input text from the user. All the other options are wrong and incorrect for the question asked. All the other options are wrong and incorrect for the question asked. Because for applying styles to text of a paragraph P is used in CSS. And hence the text is printed in Blue color. According to the CSS syntax for text alignment. Event handlers in JavaScript can t be associated with end of file processing for a database application. In JSP setLayout () method is used to specify a container's layout. The remaining all the options are incorrect. Component. setBounds () is used to set the position and size of a component in JSP. According to the semantic of the readLine () method, it returns null when it reaches the end of a file in JSP.
< TOP > < TOP > < TOP > < TOP > < TOP > < TOP >

< TOP > < TOP > < TOP > < TOP > < TOP > < TOP > < TOP > < TOP > < TOP > < TOP > < TOP > < TOP > < TOP >

< TOP > < TOP > < TOP >

< TOP > < TOP >

Page 9

Suggested Answers with Examiner's Feedback


25. 26. 27. 28. 29. 30. D E C B D A In JSP Vector class is used implement a growable array of objects. According to the definition of the wrapper class. According to the definition of the paint() method, The remaining all the options are wrong. According to the definition of the Date() method of ASP, The remaining all the options are wrong. According to the definition of the FormatDateTime () method of ASP, The remaining all the options are wrong. In ASP, IsNumeric() function returns a Boolean value that indicates whether a specified expression can be evaluated as a number.
< TOP > < TOP > < TOP > < TOP > < TOP >

< TOP >

Section B : Problems
1. a. Cursor position in javascript <html> <head> <title> Find Cursor Position </title> <script type="text/ javascript "> function show_coords(event ) { x=event.clientX ; y=event.clientY ; alert("X coords: " + x + ", Ycoords: " + y); } </script> </head> <body onmousedown ="show_coords(event )"> <p>Click in the document. An alert box will alert the x and y coordinates of the cursor.</p> </body> </html> html> <body> <p><b>Note:</b> This example won't work because ASP 3.0 is not installed on our server. </p> <p> <a href="demo_textads.asp "><img border="0" src="/images/btn_view_text.gif "></a> </p> <% set cr=server.createobject("MSWC.ContentRotator ") response.write(cr.ChooseContent("text /textads.txt")) %> <p> NOTE: Because the content strings are changed randomly in the text file, and this page has only four content strings to choose from, sometimes the page will display the same content strings twice in a row. </p> </body> </html> < TOP >

b.

Page 10

Suggested Answers with Examiner's Feedback


2. a. You can use the errorPage attribute of the page directive to have uncaught runtime exceptions automatically forwarded to an error processing page. For example: <%@ page errorPage="error.jsp" %> redirects the browser to the JSP page error.jsp if an uncaught exception is encountered during request processing. Within error.jsp, if you indicate that it is an error-processing page, via the directive: <%@ page isErrorPage="true" %> the Throwable object describing the exception may be accessed within the error page via the exception implicit object. Note: You must always use a relative URL as the value for the errorPage attribute Simple Object Access Protocol is a communication protocol used for communication between applications by sending messages via Internet. SOAP is platform and language independent and is based on XML. A SOAP message is an ordinary XML document containing the following elements: A required Envelope element that identifies the XML document as a SOAP message An optional Header element that contains header information A required Body element that contains call and response information < TOP >

b.

An optional Fault element that provides information about errors that occurred while processing the message All the elements above are declared in the default namespace for the SOAP envelope: http://www.w3.org/2001/12/soap-envelope and the default namespace for SOAP encoding and data types is: http://www.w3.org/2001/12/soap-encoding Syntax Rules Here are some important syntax rules: A SOAP message MUST be encoded using XML A SOAP message MUST use the SOAP Envelope namespace A SOAP message MUST use the SOAP Encoding namespace A SOAP message must NOT contain a DTD reference

A SOAP message must NOT contain XML Processing Instructions Skeleton SOAP Message <?xml version="1.0"?> <soap:Envelope xmlns:soap ="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle ="http://www.w3.org/2001/12/soap-encoding"> <soap:Header > ... </soap:Header > <soap:Body > ... <soap:Fault > ... </soap:Fault > </soap:Body > </soap:Envelope > 3. <html> <head> <TITLE>Web Technologies exam - MC333 Jan-2008</TITLE> </HEAD> < TOP >

Page 11

Suggested Answers with Examiner's Feedback


<body> <form name="Register" method="post" > <pre> Login Name: <INPUT TYPE="text" NAME="name" SIZE=20>< br> Password : <INPUT TYPE="password" NAME="password" SIZE=20>< br> Course : <select name="course" size=1> <option>BIT <option>PG Diploma <option> MSC </select><br> Topics to Cover: <select name="topics" size=3 multiple> <option>HTML <option>JavaScript <option> PERL <option>Security <option>Protocols </select> Method of Payment: cash <input type="radio" name="payment" value="cash"> MasterCard <input type="radio" name="payment" value=" mcard"> Visa <input type="radio" name="payment" value="visa"> Cheque <input type="radio" name="payment" value=" cheque "> <br> Preferred time slots: 08:00-11:00 on Fridays <input type="checkbox" name="morning"> 12:00-15:00 on Fridays <input type="checkbox" name="afternoon"> 17:00-20:00 on Fridays <input type="checkbox" name="evening"> 10:00-13:00 on Saturdays <input type="checkbox" name="weekend"> <input type="submit"> <input type="reset"> </pre> </form> </body> </html> It is valid: Line 1 gives the name of the document type catalogue. Line 2 defines that a catalogue consists of one or more books.

b.

Line 3 says that a book consists of its authors, title, publisher and year. Lines 4, 5, 6 & 7 say that each of these is of string type. 4. i. It is possible to attach additional information to elements in the form of attributes. Attributes have a name and a value. <tel prefered= true>2581247</ tel> Elements that have no content are knows as empty elements. Usually, they are enclosed in the document for the value of their attributes. <details href=www.somecompany.com /> At the root of the document there must be one and only one element. In other words, all the elements in the document must be the children of a single element. <?xml version= 1.0?> < TOP >

ii.

iii.

Page 12

Suggested Answers with Examiner's Feedback


<address-book> <contact> <name> Kamal </name> <tel>2456789</ tel> </contact> </address-book> The XML declaration is the first line of the document. The declaration identifies the document as an document. <?xml version= 1.0?> Comments are used for notes. <!-- this line is a comment--> <!ELEMENT address-book (entry+)> <!ELEMENT entry (name, address*, tel*, fax*, email*)> <!ELEMENT name (#PCDATA | fname | lname)*> <!ELEMENT fname (#PCDATA)*> <!ELEMENT lname (#PCDATA)*> <!ELEMENT address (street, region?, postal-code, locality, country)> <!ATTLIST address preferred (true | false) false> 5. Similarities: Both are dynamic. Can be used to enhance the functionality of the web page like user interaction Differences Bowser Database Response Authentication Security Script Client side scripting Browser dependant Cannot access database Depends on the client machine speed Authentication cannot be done Security problems are less dangerous Downloaded, interpreted and executed by the client browser User can view the code Validation is instantaneous and catches any erroneous data before it goes anywhere. Browser dependent, therefore generated results also browser dependent. If the browser disabled or not supported, data validation not occur at all Function
Asc CBool CByte CCur

iv.

XML

v. b.

< TOP >

Server side scripting Browser independant Can access database Depends on the server and network speed Authentication can be done Security problems are dangerous Run on the server and output is displayed on the client browser User only can view the rendered HTML page Browser independent.

Advantage

Disadvantage

The data has to be send back and forth between the browser and server therefore take time

b. Description Converts the first letter in a string to ANSI code Converts an expression to a variant of subtype Boolean Converts an expression to a variant of subtype Byte Converts an expression to a variant of subtype Currency

Page 13

Suggested Answers with Examiner's Feedback


CDate CDbl Chr CInt CLng CSng CStr Hex Oct

Converts a valid date and time expression to the variant of subtype Date Converts an expression to a variant of subtype Double Converts the specified ANSI code to a character Converts an expression to a variant of subtype Integer Converts an expression to a variant of subtype Long Converts an expression to a variant of subtype Single Converts an expression to a variant of subtype String Returns the hexadecimal value of a specified number Returns the octal value of a specified number

Section C: Applied Theory


6. Benefits of Using CSS Separation of Style and Structure Consistency in Style Condensed Code ease of maintenance Flexible Design increase accessibility Easier Modification Allows additional features, e.g. dynamic capabilities Recommended standard - assures compatibility with present & future designs Reduce use of non-standard tags One CSS multiple Web pages Offers much more detailed attributes < TOP >

Faster download time Reasons for Using CSS 1. Build from the ground up to replace traditional Web design methods 2. Faster download times 3. Shorter development time 4. Greater control over the typography in a Web page 5. It's easy to write 6. Improvements in accessibility 7. Print designs as well as Web page designs 8. Better control over the placement of elements in Web page 9. The design of Web pages is separated from the content 10. Better search engine rankings Drawbacks of Using CSS Browsers slow to adopt (a shrinking issue) Tools slow to adopt (a shrinking issue) One more thing to learn and apply 7. a. The jsp:plugin element instructs the server to build a tag appropriate for applets that use the plug-in. The simplest way to use jsp:plugin is to supply four attributes: type, code, width, and height. <jsp:plugin type="applet" code=" MyApplet.class " width="475" height="350"> </jsp:plugin > The jsp:plugin element has a number of other optional attributes. Most, but not all, parallel attributes of the APPLET element. Here is a full list. < TOP >

Page 14

Suggested Answers with Examiner's Feedback


type For applets, this attribute should have a value of applet. However, the Java Plug-In also permits you to embed JavaBeans elements in Web pages. Use a value of bean in such a case. code This attribute is used identically to the CODE attribute of APPLET, specifying the top-level applet class file that extends Applet or JApplet . Just remember that the name code must be lower case with jsp:plugin (since it follows XML syntax), whereas with APPLET, case did not matter (since HTML attribute names are never case sensitive). width This attribute is used identically to the WIDTH attribute of APPLET, specifying the width in pixels to be reserved for the applet. Just remember that you must enclose the value in single or double quotes.

b.

height This attribute is used identically to the HEIGHT attribute of APPLET, specifying the height in pixels to be reserved for the applet. Just remember that you must enclose the value in single or double quotes. The jsp:fallback element provides alternative text to browsers that do not support OBJECT or EMBED. You use this element in almost the same way as you would use alternative text placed within an APPLET element. <jsp:plugin type="applet" code=" MyApplet.class " width="475" height="350"> <jsp:fallback > <B>Error: this example requires Java.</B> </jsp:fallback > </jsp:plugin >
< TOP OF THE DOCUMENT >

Page 15

Potrebbero piacerti anche