COMP 105: HW #2


You are welcome to discuss these questions with your classmates, the instructor, or a TA, but I encourage you to try to think about them on your own first. If you make use of any outside information in answering these questions, or if you receive help from anyone, you need to acknowledge that along with your answer. Answers should be submitted through Kit as a plain text file or a PDF file.


  1. We've spent some time in class talking about web-development and HTML. We won't be able to devote much time to web-design: organizing web pages to communicate information clearly and effectively. It is a topic that's worth considering. The web has emerged as one of the most widely used communication mediums. It is very likely that, even after this class ends, you will find yourself in situations where a little bit of web-development is called for. Organizing information on the web brings it's own set of challenges; guidelines taken from the world of static document formatting often don't carry over to web-design.
  2. The following web page contains several errors. Find at least three HTML errors. Note the mistakes in the original HTML, and rewrite the HTML so that it is correct. (3 pts)
       
        </html>
             <title> Sample Web Page </title>
          <body>
             <h1> This is a really great web page!
             <a "http://www.cs.kzoo.edu/cs105"> link to COMP 105</a>
          </body>
        <html>  
    
        
  3. Information on the Internet is packet switched , that is, long messages are broken up into small packets that may each take a different route from the source to the destination. This is in contrast to the traditional phone system which is circuit switched. In a circuit switched network a dedicated connection is established between the source and the destination, and that connection persists until the communication ends. List two advantages that packet switching has over circuit switching, and one advantage that circuit switching has over packet switching. (3 pts)

  4. Which of the following represent valid variable names in JavaScript? Briefly explain what is wrong with each of the invalid variable names. (4 pts)
    varNameValid? Invalid? If invalid, why?
    1variable
    bob
    var
    good Name
    "number"
    Alice&Bob
    TIM
  5. There are three variables in the short JavaScript program below: a, b, and c. Fill in all of the empty boxes with the value that the corresponding variable will contain after the line of code on that line is executed. Be careful to distinguish between strings and numbers. Use quotation marks to indicate that the value in a box is a string. (5 pts)


    a b c
    var a = "20";   20? "20"?
    var b = a.length;    
    var c = a + b;      
    c = parseFloat(c);      
    c = c + 1