Midterm Answer Key

General Notes

There were 6 "bonus points" on the exam, so you should subtract your points off from 106. Note that your score is the circled number/100, not /106.

Key for exam form with first question: "Some allowed suffixes..."

  1. (12 Points)

    1. T
    2. F
    3. T
    4. F
    5. F
    6. F
    7. F
    8. T
    9. T
    10. F
    11. T
    12. F

  2. (10 Points)

    The bug: The words "Advantages for Apple" should be enclosed in <title></title> tags

    When the bug is fixed, this HTML will put the words "Advantages for Apple" on the title bar, and the following in the browser window:

    Here are some advantages for Apple.



  3. (6 Points)

    Part 1: 21
    Part 2: 0

  4. (28 Points)


  5. (16 points)


  6. (8 Points)


    INDEX01234 56789
    VALUE17102610 1511162223

  7. (26 Points)


    import java.awt.*;
    import awb.*;
    
    public class e1 extends java.applet.Applet
    {
       double rr[];
       int i, numZeros;
       Button x1;
       IntField s1Field;
       
       public void init()
       {
          rr = new double[100];
          Button x1 = new Button("X1");
          s1Field = new IntField();
          s1Field.setLabel("Answer");
          add(s1Field);
          add(x1);
       }
    
       public boolean action(Event e, Object obj)
       {
          if (e.target == x1)
          {
             i = 0;
             numZeros = 0;
    	 while (i < 100)
             {
    	    if (rr[1] == 0)
        	    {
    	       numZeros = numZeros + 1;
    	    }
    	    i = i + 1;
    	 }
             s1Field.setInt(numZeros);
    	 return true;
          }
          return true;
       }
    }