CSCI 101: Intro to Computer Science

Solutions to Midterm Exam I

Correct answers to the questions are not unique. Only one example of a correct answer is presented.

  1. (15+10=25 points)   An analog device, such as the Differential Analyzer or the volume control on a radio, stores information by representing it as the continuous position of an object. The number 17, for example, might have been represented in the Differential Analyzer by a shaft that was rotated 17 degrees from its starting position. A digital computer, such as the abacus, represents each digit (ones, tens, hundreds, and so on) by a separate unit.
    1. What are the limiting factors to the accuracy of an analog computer, and how does this differ from the accuracy of a digital computer?

      Solution

      The accuracy of an analog computer is limited by the technology. It is technically difficult to rotate a shaft on exactly 17.245673 degrees, for example. The accuracy will also strictly depend on temperature. Another source of inaccuracy is a human factor. The operator who rotates the shafts influences a lot on the accuracy of data representation and computation.

      In contrast to this, the accuracy of a digital computer is determined by the number of bits that are used to represent numbers. It manipulate with numbers by manipulation single bits and is free on the limiting factors specified above.

    2. In particular, is it easier to increase the accuracy of an analog or a digital computer? Explain.

      Solution

      It is easier to increase the accuracy of a digital computer. Adding a number of devices to represent more bits is technically easier than to increase the accuracy of shaft rotation.

  2. (10+15 points)  
    1. Write HTML to produce the following output:

      • First Item
        • Second Item
          • Third Item
        • Fourth Item
      • Fifth Item

      Solution

      <ul type="square">
      <li> First Item
         <ul type="circle">
         <li> Second Item
            <ul type="square">
            <li> Third Item
            </ul>
         <li> Fourth Item
         </ul>
      <li> Fifth Item
      </ul>
      

    2. Write HTML to display the following formula:

      (x1 + x2)2 = x12 + x1·x2 + x22

      Solution

      (x<sub>1</sub> + x<sub>2</sub>)<sup>2</sup> =
      x<sub>1</sub><sup>2</sup> +
      x<sub>1</sub> &middot; x<sub>2</sub> +
      x<sub>2</sub><sup>2</sup>
      

  3. (25 points)   Write HTML to produce the following table:

    Address:  
    Dept. of Math & Comp. Sci     Office:     S332
    University of Wisconsin - Superior     Phone:     +1 (715) 394-8523
    Superior, WI 54880     Fax:     +1 (715) 394-8454

    Solution

    <table border="5">
    <tr><td bgcolor="lightyellow">
       <table border="0">
       <tr><td><b>Address:</b></td>
           <td colspan="4"> &nbsp; </td>
       </tr>
       <tr><td>Dept. of Math &amp; Comp. Sci</td>
           <td> &nbsp; &nbsp; </td>
           <td>Office:</td>
           <td> &nbsp; &nbsp; </td>
           <td>S332</td>
       </tr>
       <tr><td>University of Wisconsin - Superior</td>
           <td> &nbsp; &nbsp; </td>
           <td>Phone:</td>
           <td> &nbsp; &nbsp; </td>
           <td>+1 (715) 394-8523</td>
       </tr>
       <tr><td>Superior, WI 54880</td>
           <td> &nbsp; &nbsp; </td>
           <td>Fax:</td>
           <td> &nbsp; &nbsp; </td>
           <td>+1 (715) 394-8454</td>
       </tr>
       </table>
    </td></tr>
    </table>
    

  4. (25 points)   Write HTML to produce the following output.
    Make sure to color the corresponding cells into blue and red colors and use underlined, bold and italic fonts as it is shown in the picture. Also make sure to center the captions Table 1 and Table 2 above the corresponding tables and put the tables at the same horizontal level exactly as it is shown below.

    Table 1
    First Second
    Third
    Table 2
    Fourth
    Fifth Sixth

    Solution

    <table border="0">
    <tr><td bgcolor="white">
       <table border="1">
       <caption>Table 1</caption>
       <tr><td rowspan="2" bgcolor="lightblue"><u>First</u></td>
           <td>Second</td> </tr>
       <tr><td><b>Third</b></td> </tr>
       </table>
    </td>
    <td bgcolor="white">
       <table border="1">
       <caption>Table 2</caption>
       <tr><td colspan="2" bgcolor="red" align="center"><i>Fourth</i></td></tr>
       <tr><td>Fifth</td> <td>Sixth</td> </tr>
       </table>
    </td></tr>
    </table>