Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
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
<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>
Page 2
<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
<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
<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
<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>
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
( 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
( 5
marks)
<Answer>
( 7 ( 3
marks) marks)
b.
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
< TOP > < TOP > < TOP > < TOP > < TOP > < TOP > < TOP > < TOP > < TOP > < TOP > < TOP > < TOP > < TOP >
Page 9
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
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
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
iv.
XML
v. b.
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
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
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
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