Practice Test

Short Answer Questions [15 marks]

  1. [1 mark]For LZW compression, assume an initial dictionary of three elements:
    a0
    b1
    What stream of numbers would be sent for the string 'aabaabaab'?
  2. [2 marks] Very generically, what are <div> and <span> used for in HTML?
  3. [1 mark] How does an HTTP client know that the HTTP server is sending back HTML as opposed to, say, JPEG data?
  4. [2 marks] What does TCP add on top of what IP provides already?
  5. [1 mark] True or false: when using the Location: redirect in a header, the HTTP server includes the text of the new destination page in the body section after the header.
  6. [3 marks] Describe three ways of implementing the notion of a session in CGI.
  7. [1 mark] What is the issue with CGI program and caching? How can the issue be resolved?
  8. [1 mark] In JDBC, what are the differences between a Statement object and a PreparedStatement object? When is a PreparedStatement the better choice?
  9. [1 mark] Suppose you have just telnet'd to port 80 on the blah.com HTTP server, and you are initiating an HTTP/1.0 connection. Write the text that you would enter to initiate the retrieval of the document http://blah.com/doc/intro.html
  10. [2 mark] Why is &lt; defined as <!ENTITY lt "&#38;&#60;">?

Programming Questions [15 marks]

  1. [2 marks] Write an html document that displays three other html documents, "1.html", "2.html", "3.html" as a set of frames such that 1 occupies 3/4 of the top, and 2 and 3 occupy the bottom 1/4, with 2 using 100 pixels on the left, and 3 using the rest.
  2. [2 marks] Write a css that defines a class called 'red' that colors the text red for tags of that class. Show an example HTML files that uses this stylesheet to color an <h2> element red.
  3. [5 marks] Write an XML DTD for storing information about groceries, including name, price, quantity on hand, and the name of its gif image. Include a small example XML file. Then write an XSL stylesheet that displays this information in an HTML table within a web page.
  4. [6 marks] Write a web application using HTML forms and using using first JavaScript, then CGI/Perl, then Servlets, that asks you to guess a number between 1 and 10, and then says "correct" if the number is 1, and "incorrect" otherwise.