UNIVERSITY OF TORONTO

Faculty of Arts and Science

DECEMBER EXAMINATIONS 2001

CSC 309H1 F

Duration – 3 hours

Examination Aids: One double-sided 8.5”x11” paper containing notes

 

 

NAME ______________________________________________________

 

 

STUDENT NUMBER ______________________________

 

 

PART I (Short Answers): _______ /50

 

PART II (Programming): ________/50                                        

Q. 25 ________/5

Q. 28 ________/5

Q. 26 ________/5

Q. 29 ________/5

Q. 27 _______/15

Q. 30 _______/15

 

Total: ___________/100

 

Part I of this examination is a series of short-answer questions. Answer theses questions in the spaces provided on this examination paper. There is no need to use more space than is provided. If you must, then use the back of the examination paper and so indicate in your answer.

 

Part II of this examination is a series of programming exercises. Answer these questions in the examination booklets provided.

 

General Advice:

·         Skim through the entire exam before beginning your detailed work, to get a sense of where best to spend your time; if you get stuck on one question, go on to another and return to the difficult question later

·         Show your work, not just the final answer.  Partial credit will be granted in cases that demonstrate correct reasoning, even if an error leads to an incorrect final result.

·         For the short answer questions, you may answer in point-form rather than complete sentences, but be clear.

·         For the programming exercises, if unsure of API details or language syntax details, try your best and include a comment for part marks indicating what you are attempting to achieve.

 

Total Pages = 13 (including this cover sheet)

PART I (short answers)  (total marks = 50)

1.      [2 marks] What is the relationship between XML, SGML, HTML4 and XHTML?

 

 

 

 

 

 

2.      [1 mark] What is CSS?  What has been deprecated in favour of CSS.  Why?

 

 

 

 

 

3.      [2 marks] Describe the relationship of Unicode, ISO-8859 and ASCII. Which is better?  Why?

 

 

 

 

 

 

 

4.      [10 marks] Explain the purpose of each line, and each part of each line, in the following XHTML prologue.

[1] <?xml [2]version="1.0" [3]encoding="iso-8859-1"?>

[4]<!DOCTYPE [5]html [6]PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "DTD/xhtml1-frameset.dtd">

[7]<html [8]xmlns="http://www.w3.org/1999/xhtml" [9]xml:lang="en" [10]lang="en">

[1]

[2]

[3]

[4]

[5]

[6]

[7]

[8]

[9]

[10]

 

 

 

 

5.      [1 mark] When a Unicode document is sent to a browser, is it always two bytes per character? Explain.

 

 

 

 

 

 

 

6.      [2 marks] Describe how GIF compression works. What is the main lossy step?

 

 

 

 

 

7.      [2 marks] Describe how JPEG compression works. What is the main lossy step?

 

 

 

 

 

 

 

8.      [1 mark] When would you use GIF on a Web page. When JPEG?  Why?

 

 

 

 

 

 

9.      [2 marks] What is dithering?  What is anti-aliasing? How does each affect the file size of GIF images?

 

 

 

 

 

 

 

10.  [1 mark] If 1000x2000 pixel image is to displayed on a web page in an area of 100x200 pixels, what are the pros and cons of shrinking the image size ahead of time versus downloading the larger image and allowing the client browser to shrink it?

 

 

 

 

 

11.  [2 marks] In the presence of multiple scripting languages that a browser can interpret, what is the standard fashion of indicating the script language in intrinsic event scripts and in <script> element scripts  giving an example of each.

 

 

 

 

 

12.  [2 marks] Describe the mechanisms used to protect against malicious code in Java Applets.

 

 

 

 

 

 

13.  [2 marks] What mechanism is used to translate a symbolic Web address such as yahoo.com into an IP address?  Where is the data used in the name to address translation stored?

 

 

 

 

 

 

 

14.  [4 marks] For the following form:

<form method="get" action="http://foo.cs:80/cgi/doit.pl?greeting=hello">

<input type="hidden" name="top" value="login">

<input type="hidden" name="bot" value="passwd">

<input type=”submit”>

</form>

i)                    show the complete HTTP request

 

 

 

 

 

ii)                  show the complete HTTP request if the method were post instead of get

 

 

 

 

 

15.  [1 mark] How many round-trip times (RTT’s) are saved in loading a Web page containing 5 embedded image objects through use of persistent connections?

 

 

 

 

16.  [2 marks] The Internet's IP network layer is responsible for end-end packet delivery from sender to receiver.

i)                    Why does the Internet use an additional end-end transport layer between the sender and receiver? 

 

 

 

 

 

ii)                  Which transport layer protocol does HTTP use?

 

 

 

 

17.  [1 mark] How does a proxy server know when to refresh its content?

 

 

 

 

 

18.  [1 mark] What programming languages can be used for CGI programming?

 

 

 

19.  [1 mark] Can a CGI program return anything other than HTML files?  How?

 

 

 

 

 

 

20.  [2 marks] (a) How is an HTTP cookie sent from the HTTP client to the HTTP server?   (b) How does an HTTP client decide whether to send a cookie to an HTTP server?

 

 

 

 

 

21.  [2 marks] Suppose I receive a legal document with a digital signature based public/private key technology.  How can I be sure that the document has not been altered from the original?  How do I know that the signature really belongs to the person who claims to have sent the document?

 

 

 

 

 

 

22.  [4 marks] In the CGI protocol:

i)                    How is the part of the URL after the '?' passed to an executing program?

 

 

 

 

ii)                  For an HTTP POST request, how is the posted data presented to the executing program?

 

 

 

 

iii)                How does a CGI program pass the HTTP response data back to the server after a GET request?

 

 

 

 

iv)                Does the server parse this data or forward it directly to the client browser?  Why? 

 

 

 

 

 

23.  [1 mark] How does the Tomcat servlet engine implement sessions?

 

 

 

 

 

 

 

 

24.  [1 mark] Your company’s VP of Marketing has just issued a press release announcing full support for Oracle in all products; problem is, your product actually supports Pointbase.  As the manager of a servlet development unit, your programmers will have to create new versions of servlets in order to provide Oracle support.   Show the lines of code your programmers will have to modify in servlets, as they would appear in the current Pointbase version.


PART II (to be answered in examination booklets provided)

25.  [5 marks] Develop an XML application for keeping track of your DVD collection.

Important information about each DVD are

·        Title

·        audio formats ('dd' or 'dts' combined with one of 'mono', 'stereo', '5.1', '6.1')  (one or more of them)

·        video format ('anamorphic' or not plus one of 'standard' or 'widescreen')  (one or more of them)

·        special features (name plus a brief description) (zero or more of them)

Provide a DTD plus a short sample XML file.

Ensure your XML tags are in their own namespace: 'http://www.cs.toronto.edu /csc309/exam/dvd'

26.  [5 marks] CSS

i)                    Write a css that eliminates space above each <ul> and below each <h1> tag.

ii)                  Do the same thing, but define classes nospaceabove and nospacebelow, and show an example HTML file using it.

27.  [15 marks total] Write a Web page (and associated program scripts) that presents a form asking for the user's name.  After the user enters their name and hits a 'Done' button, a new Web page displays "Hello <name entered>”.

i)                    [5 marks] First write this Web page using exclusively client-side code (Javascript).

ii)                  [5 marks] Then write it using CGI-bin code in PERL.

iii)                [5 marks] Then write it using Servlets.

28.  [5 marks] Write a Java Applet called "PlaySound" that alternately plays (in a loop) the indicated sound clip and stops it when the method togglePlay() is called.  (The sound is supplied as parameter "sound" from the <applet> tag and is a general URL).  Give an example HTML page that displays an image and toggles the sound playing when the user clicks on the image.  

Hint: There is an interface java.applet.AudioClip with methods loop() and stop().  The java.applet.Applet baseclass has the method

AudioClip getAudioClip(java.net.URL url)

29.  [5 marks] Use cookies and CGI/Perl to implement a Welcome page that greets a user with a "Welcome Back <user>" if the user has already been to the site, or a page that queries the user's name if he/she has not.

 

30.  [15 marks] Write a servlet to implement AcroCat, the acronym catalogue.   Your servlet will interface with the user through a single page with two parts:

i)                    Upper add acroynms section, that provides form-based input for user-definition of new acronyms,

ii)                  Lower catalogue display, that presents the existing catalogue entries in the form of a table, with acronym names in bold font.

A sample of what your page would look like after three entries had been made is shown below.  To keep things simple, you need only implement adding new acronym entries, not modification, deletion or sorting of existing entries in the catalogue.  Your servlet should ensure that concurrent AcroCat execution by multiple users does not result in any loss of data (new definitions being added by concurrent users). Use a relational database for persistent storage.