CS301 F2005 Final Review

Final exam will be 12/14 10:15am-2:45 pm Wednesday in class, open book open note.
Here are some old Exams for your practice:


CS301 S2000 Final Examine.

CS301 F2004 Final Examine.

The final exam will cover the following topics:


S2002 Final Exam

  1. CSS
    1. What are the new features provided by CSS1?
    2. 1. Allow to modify the presentation style of a tag. Yes No
      2. Can change the font size and color. Yes No
      3. Cannot change the margins of a tag's displaying area. Yes No
      4. A web page can reference multiple CSS files directly or indirectly. Yes No
      5. The CSS file can be shared and referenced by a HTML web page using the <LINK> tag. Yes No
      6. Cannot change a subset of tag instance with the same tag name. Yes No
      7. Can change individual instance of a tag. Yes No
    3. Specify the style of a class of tags with name called highlight and use helvetica font, font size=24, and blue color.

  2. Javascript
    1. Write a javascript function that check the correctness of the zip code. Note that both 80905 (5 digits) and 80933-7150 (9 digits with dash) formats are legal.
    2. For the timing control,
    3. 1. Use setTimeout to call a function after certain time from now expires Yes No
      2. Use setInterval to call a function in a regular time interval. Yes No
      3. The function call "setTimeout(10000, clock)" will execute the clock function call in 10 seconds. Yes No
      4. The statement "win = window.open("http://owl.uccs.edu/~cs301/");" creates a separate browser window and displays a web page whose url = http://owl.uccs.edu/~cs301/ Yes No
    4. For generating the web document,
    5. 1. Use document_print() Yes No
      2. Use document.write() Yes No
      3. Use print() Yes No
  3. DHTML

  4. The following code implements three buttons for controlling the show, hide, and move to the left by 100 pixels operations of a label.
    It can be used with IE5 and NS4.
    <script>
    ns4 = (document.layers)? true:false
    ie = (document.all)? true:false
    x = 100;
    function hide() {
       if (ns4) document.searchPopup.visibility="hide";
       else searchPopup.style.visibility="hidden";
    }
    function show() {
       if (ns4) document.searchPopup.visibility="visible";
       else searchPopup.style.visibility="visible";
    }
    function moveRight() {
       x += 100;
       if (x > 800) x = 0;
       if (ns4) document.searchPopup.left +=x;
       else searchPopup.style.left = x;
    }
    </script>
    <DIV ID="searchPopup" STYLE="POSITION: absolute; Z-INDEX: 20;
    VISIBILITY: visible; TOP: 38px; LEFT: 40px; BACKGROUND: lime">
    search popup
    </DIV>
    <form>
    <input type=button value="show" onClick="show();">
    <input type=button value="hide" onClick="hide();">
    <input type=button value="moveleft" onClick="moveRight();">
    </form>
    Add a button with label moveDown and  a Javascript function moveDown for the operation that moves the label down by 100 pixels and reset after reach 800 pixels.  Enter the moveDown button tag and moveDown javascript function in the following textarea.  The sample code is in http://wetterhorn.uccs.edu/~cs301/test.html.
  5. XML, XSL, DTD

  6. Given the following stock profile xml document template, create the DTD.  Assume the order of the tags need to be strickly followed and all attributes are required.   The exchange attribute allows only nyse, nasdaq, and amx.  The dt:dt attribute allows only number, int, and float.  Use the same dt namespace as in hw5 exercise.
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="portfolio.xsl"?>
    <portfolio xmlns:dt="urn:schemas-microsoft-com:datatypes" xml:space="preserve">
      <stock exchange="nyse">
        <name>zacx corp</name>
        <symbol>ZCXM</symbol>
        <price dt:dt="number">28.875</price>
        <share dt:dt="number">1000</share>

      </stock>
      <stock exchange="nasdaq">
        <name>zaffymat inc</name>
        <symbol>ZFFX</symbol>
        <price dt:dt="number">92.250</price>
        <share dt:dt="number">1500</share>
      </stock>
      <stock exchange="nasdaq">
        <name>zysmergy inc</name>
        <symbol>ZYSZ</symbol>
        <price dt:dt="number">20.313</price>
        
    <share dt:dt="number">2000</share>

      </stock>
    </portfolio>
    Enter the DTD in the following textarea.

    Create a portfolio.xsl that display the  profile  similar to grade.xsl in hw5, sorting the stock records according to the descending order of the price value.
    Enter the portfolio.xsl  in the following textarea.

  7. MySQL and DBI

  8. Specify the SQL command  for creating a new table called "drink" with the following columns: drink_name (varchar type, 30 characters),  SUP_ID (int type, 6 digits), PRICE (float type, 8 digits), INVENTORY (int type, 9 digits), and inserting a new record, where drink_name='sprite', SUP_ID=111, PRICE=0.6, INVENTORY=2000.

    Assume the above SQL command is saved as a file, drink.sql. Specify the mysql command that takes drink.sql and create a table in your database at blanca.uccs.edu.

    For a perl CGI script, orderDrinkDB.pl similar to orderCookieDB.pl that generates web page to allow  a customer to order drinks,
    1. Need to declare CGI to access database. Yes No
    2. Need to declare DBI to read customer's input data. Yes No
    3. The cgi  script should be reference as http://wetterhorn.uccs.edu/~cs301/cgi-bin/cs301/orderDrinkDB.pl for its execution  Yes No

CS301 F98 Final

Enter your answers on the web page and after completing your answers, push the submit button.  You have 2 hours 30 minutes to finish the midterm. Treat these questions as mulitple-choice questions. You must choose either yes or no for each answer. There are two questions that require you to enter answers to the TextArea. Save or Print a copy of your answers for record. 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 on CS UNIX machines:
Work/Home Phone number (option):


  1. On-Line Graphics

  2. Using GD/gd package
    1. What image file format generated by the GD/gd package?
    2. 1. JPEG  YesNo
      2. GIF YesNo
      3. PNG YesNo
      4. MPEG YesNo
    3. What content type should the perl script (acounter.pl) generate for the return image?
    4. 1. text/html. YesNo
      2. text/image. YesNo
      3. image/gif. YesNo
      4. image/jpg. YesNo
    5. Where the  image is saved, after it was generated?
    6. 1. as a file YesNo
      2. in the main memory YesNo
      3. in the cache YesNo
      4. in the disk YesNo
    7. For acounter.pl that generates access counters,  where it kept the counter values?
    8. 1. a plain file. YesNo
      2. dbmfile. YesNo
      3. database. YesNo
      4. in the main memory during execution YesNo
  3. CSS
    1. What are the new features provided by CSS1?
    2. 1. Allow to modify the presentation style of a tag. YesNo
      2. Can change the font size and color. YesNo
      3. Cannot change the margins of a tag's displaying area. YesNo
      4. Can be saved as a file and shared by multiple web pages. YesNo
      5. The CSS file is typically referenced by a HTML web page using the <LINK> tag. YesNo
  4. Javascript
    1. How to check the user input is a telephone number?

    2. <script>
      re=/^\(?\d{3}\)?[\s-]?\d{3}[\s-]?\d{4}$/
      function checkPhone(item) {
         if (!re.test(item.value)) { alert("not a telephone number?"); return false}
         else return true;
      }
      </script>
      </script>
      1. When the phone number is (719 262-3360, alert msg is popped up.  YesNo
      2. The phone number has to have 10 digits. YesNo
      3. The phone number can have '-' after the area code.  YesNo
    3. For the timing control,
    4. 1. Use setTimeout to call a function after certain time from now expires YesNo
      2. Use setInterval to call a function in a regular time interval. YesNo
      3. The function call "setTimeout(10, clock)" will execute the clock function call in 10 seconds. YesNo
      4. The statement "win = window.open("http://owl.uccs.edu/~cs301/");" creates a separate browser window and displays a web page whose url = http://owl.uccs.edu/~cs301/ YesNo
    5. For generating the web document,
    6. 1. Use document_print() YesNo
      2. Use document.write() YesNo
      3. Use print() YesNo
    7. What is wrong with the following HTML?

    8. <body>
      <script> form1.phone.value=777-3332 </script>
      <form name=form1 action="http://owl.uccs.edu/cgi-bin/cs301/fullecho.pl">
      <input name=phone type=text>
      </form>
      </body>
      1. It should be document.form1.phone.value. YesNo
      2. The form is referenced before it is created. YesNo
      3. It did not declare the method used by the form. YesNo
      4. 777-3332 should be replaced with '777-3332' YesNo
  5. XML, XSL, DTD
  6. MySQL and DBI