CS301 F2004 Midterm

Enter your answers on the web page and after completing your answers, print a hard copy for your own record and push the submit button.  You have until 10/18/2004 11:59pm to finish the midterm.Treat these questions as mulitple-choice questions. You must choose either yes or no for each answer. There are five open questions that require you to enter answers to the textareas.
Print a copy of your answers before hitting the submit button.   If you have problem accessing the web server for submitting the answer, slide your hard copy with answers under my office door Tuesday Morning.
Enter the following information. The password is used to verify the person submitting the answers.
Your name:
Your login on CS UNIX machines:
Your password (Last four digits of your Student ID):


  1. Introduction to WWW systems

  2. Basic Web Access
    In the demo CGI script we set up for hw3 we saw the following URL appear in the address box of the browser.

    http://sanluis.uccs.edu/~cs401/cgi-bin/processOrder.cgi?disk=100&dvd=200&memory=AA
    1. What part of the information from the above URL will be sent by the browser  to DNS (Domain Name System)?
    2. 1. scheme/protocol Yes No
      2. sanlius.uccs.edu Yes No
      3. processOrder.cgi Yes No
      4. domain name Yes No
    3. What information the browser gets back from DNS?
    4. 1. domain name of the browser. Yes No
      2. IP address of the browser. Yes No
      3. domain name of the server. Yes No
      4. IP address of the server. Yes No
    5. What are the steps included during a basic web access?
    6. 1. browser sends  domain name query to DNS. Yes No
      2. with IP address of server, the browser sends HTTP request to server. Yes No
      3. server sends HTTP response to browser. Yes No
      4. browser parses the return html web page, then send additional HTTP requests for the referenced images or media files. Yes No
    7. If we type in the IP address instead of the domain name in the url, will the browser accept that?
      For example, sanluis.uccs.edu has 128.198.162.62 as IP address. Will the browser accept
      http://
      128.198.162.62/~cs401/cgi-bin/processOrder.cgi?disk=100&dvd=200&memory=AA
      Yes No
    8. Can a machine run multiple web servers at different ports, say one at port 80 and the other at 443? Yes No
    9. What is the url of the default web page for the web server running at port 443 on cs.uccs.edu?
    10. 1. http:\\\cs.uccs.edu\443\ Yes No
      2. http://cs.uccs.edu#443/ Yes No
      3. http://cs.uccs.edu:443/ Yes No
      4. https://cs.uccs.edu/ Yes No
    11. In the URL, http://sanluis.uccs.edu/~cs401/cgi-bin/processOrder.cgi?disk=100&dvd=200&memory=A
      what character separates the file name of the cgi script and the name value pairs?
       

    12. what character separates the name and value of a name value pair?
      what character separates the the value pairs?
    13. Is "post    /~cs301/cgi-bin/inventory.cgi   HTTP/1.0" a legal HTTP request?  Yes No
    14. Where the browser gets  the first parameter of the HTTP request command line,

    15. such as "/~cs301/cgi-bin/inventory.cgi" in the above example ?
      1. From the url value entered by the user in the adddress or location field Yes No
      2. From the value of method attribute in a form. Yes No
      3. From the name attribute value of an  textarea  tag Yes No
      4. From the href attribute value of a hyperlink. Yes No
    16. What are the possible ways to improve WWW system performance?
    17. 1. Use cache and share the documents in a proxy cache server Yes No
      2. Increase the bandwidth between the browser and the server. Yes No
      3. Using client side imagemap instead of server side imagemap Yes No
      4. Verify the user input using Javascript before sending back to the web server. Yes No
  3. HTML Basics
    1. How to create an anchor within a document?
    2. 1. Specify <HERF> tag with NAME attribute. Yes No
      2. Specify <ANCHOR> tag with NAME attribute. Yes No
    3. How to reference an anchor within a web page?
    4. 1. Is <a href="http://cs.uccs.edu/~cs301/homeworks.html#hw3>  a legal tag? Yes No
      2. When a link with anchor is selected, the  browser will display the anchor point of the web page at the top of the display window. Yes No
    5. How to set up the background image or color?
    6. 1. <Body bkground="marble.gif"> Yes No
      2. The background image will be repeated like tile pattern on the browser. Yes No
      3. What background color the following tag chooses? <body bgcolor="#ffff00">
         
        a. Red. Yes No
        b. Green. Yes No
        c. Blue. Yes No
        d. Yellow Yes No
    7. OL

    8. What is the effect of nested <OL> tags?
      1. alternating between numbered list and un-numbered list Yes No
      2. indentation.  Inside <OL> list will shift to the right. Yes No
    9. Table, TH, TR, TD

    10. A <table> tag can be used to align columns of items on a web page. Yes No
  4. Using Multimedia in Web Page
    1. Client side Image map
    2. 1. specifies how the selected areas of the image map should be translated into the  HTTP requests in the HTML web page. Yes No
      2. support polygon areas. Yes No
      3.  is faster because it does not need to go back to the original web site to find out what is the url to be used by the browser to retrieve the web document. Yes No
      4. the size of the web page is bigger than the corresponding server side image map. Yes No
    3. How big is a raw 2 minutes, stereo, audio file sampled with 22kHz and 8 bits per sample?
      1.  
        1. 352000 bytes. Yes No
        2. 10560000 bytes. Yes No
        3. 2640000 bytes. Yes No
    4. How to reference video?
    5. 1. Use hyperlink such as <a href ="uccs.avi"> Yes No
      2. Use object tag such as <object data="http://cs.uccs.edu/~cs301/video/uccs.avi"></object> Yes No
      3. Use embed tag such as   <EMBED NAME=inlineRMvideo
      SRC="video/your_login.rm"
      WIDTH=240 HEIGHT=180>
      to displays the video image on the same web page.
      Yes No
      4. The <a href ="video.avi"> embeds the video image on the same web page. Yes No
  5. Perl
    1. http://sanluis.uccs.edu/~cs301/cgi-bin/testPhoneNo.cgi contains the following code
      #!/usr/bin/perl
      use CGI qw(:standard);
      $phoneNo = param('phone');
      print header;
      print start_html(title=>'check phone number'),
         h1('Check Phone Number Result'),
         hr;
      print "You have entered phone number=$phoneNo<br>";
      if ($phoneNo =~ /^\d?[\s-]?\(?(\d{3})\)?[\s-]?(\d{3})[\s-]?(\d{4})$/) {
         print "It follows correct input format.<br>";
         print "The area code is $1.<br>";
         print "Save phone number as ($1)$2-$3.<br>";
      } else {
         print "It does not follow correct input format.<br>";
      }
      print end_html;
    2. 1. (303) 252-3391 satifies the regular expression here. Yes No
      2. 303)-252-3391 satisfies the regular expression here. Yes No
      3. param is a function provided by CGI perl module. Yes No
      4. $3 contains the last four digits entered as phone number. Yes No
    3. What are the advantages of using associate array compared to the simple array?

    4. 1. Associate array allows a name instead of a number as an index for accessing the array element. Yes No
      2. dbmfile is used to save associate array for future accesses. Yes No
      3. $price{$type} is an associate array element of @price. Yes No
      4. remove $price{$type} will remove the delete the associate arry element from %price. Yes No
    5. Write a dbmopen statement that open a password dbmfile in order directory for read-only access?

    6. Regular expression.

      Write a conditional statement that use regular expression to check the credit card number contained in $creditCardNo. It accepts both nnnn-nnnn-nnnn-nnnn and nnnnnnnnnnnnnnnn (without dash) as legitimate patterns where n is the digit. When the input data follows the correct credit card number pattern, print the message "Input correct and accepted". When the input data does not follow the pattern, print the message "Input does not follow the pattern. Please correct."
  6. Form & CGI
    1. Retrieve values submitted in a form
    2. 1. Use param("email") to retrieve the valule entered in a text input box with name="email" in the input tag. Yes No
      2. Use @names = param;  we can get the list of names in submitted name value pairs of a form. Yes No
    3. GET vs. POST method
    4. 1. For POST method, the input data of the form is sent in the first line of the http request. Yes No
      2. For GET method, the input data of the form is passed through the STDIN by the web server to the CGI process. Yes No
    5. Point out four errors in the following short CGI perl script.
      #/usr/bin/perl
      use CGI qw(:standard)
      print "HelloWorld!";

If you feel some of the questions are ambiguous, state the problem # and your assumptions on the answers.