CISC103, Fall 2006

First Midterm Exam (E01)

October 10, 2006

Name: ________________________________________________________________


UD Email: _____________________________________________@ udel.edu

 

Are you classified as a freshman (circle one):        YES          NO


Circle your section number:      

     010 (Tuesday Lab)                     011   (Thursday Lab)

 

Do not write your name on any page except this one.

Answer the multiple choice questions on the scantron sheet.

Answer the remaining questions on this paper directly.

Total Points: ???


A hint about allocating your time:

You need to answer 100 points worth of questions in 75 minutes, so....

That will allow you to complete 100 points worth of questions in 50 minutes.
Then you'll have 25 minutes left over so that you can either


Multiple Choice: JavaScript Types

(Reference: Lecture Notes of Oct 3rd)

In JavaScript, every value and every variable has one of six types:

number null
string object
boolean function

I've eliminated "function" as one of the possible responses. Given that, for each of following indicate what the browser would show as the result, if the JavaScript given were placed in the address bar of the browser.

Example:

javascript: x=5; typeof(x);

(a) number (b) string (c) boolean (d) null (e) object 


Answer: (a) number

  1. (3 pts)

    javascript: x=13; typeof(x);

    (a) number (b) string (c) boolean (d) null (e) object 

  2. (3 pts)

    javascript: x='Fred'; typeof(x);

    (a) number (b) string (c) boolean (d) null (e) object 

  3. (3 pts)

    javascript: x=true; typeof(x);

    (a) number (b) string (c) boolean (d) null (e) object 

  4. (3 pts)

    javascript: x='false'; typeof(x);

    (a) number (b) string (c) boolean (d) null (e) object 

  5. (3 pts)

    javascript: x="new Date"; typeof(x);

    (a) number (b) string (c) boolean (d) null (e) object 

  6. (3 pts)

    javascript: x=new Date; typeof(x);

    (a) number (b) string (c) boolean (d) null (e) object 

  7. (3 pts)

    javascript: x=5 + 1; typeof(x);

    (a) number (b) string (c) boolean (d) null (e) object 

  8. (3 pts)

    javascript: x="5" + 1; typeof(x);

    (a) number (b) string (c) boolean (d) null (e) object 

  9. (3 pts)

    javascript: x="Fred's"; typeof(x);

    (a) number (b) string (c) boolean (d) null (e) object 

  10. (3 pts)

    javascript: x="<p>5</p>"; typeof(x);

    (a) number (b) string (c) boolean (d) null (e) object 


    Multiple Choice: Relative vs. Absolute Links

    (References: Head First HTML p. 59-71, lab03, Sep 12 notes)

    For each of the following links, indicate whether it refers to (a) an absolute path, or (b) a relative path

  11. (2 pts)

    <a href="foo.html">foo</a>

    (a) absolute (b) relative 

  12. (2 pts)

    <a href="http://www.udel.edu/help">help page </a>

    (a) absolute (b) relative 


    Short Answer: JavaScript

    (References: Lecture Notes of Sep 26)

    For each of the following alert boxes, write beside it, the JavaScript statement that would produce it.

    Example:

    alert box with Blah in it      window.alert("blah");
  13. (4 pts)

    alert box with x in it

  14. (4 pts)

    x in quotes

  15. (4 pts)

    x in quotes

  16. (4 pts)

    x in quotes

    Short Answer: HTML

    (References: Labs 02-05, Head First HTML Chapters 1-3, Lecture Notes of Oct 3)

  17. (50 points total---see breakdown on separate sheet)

    Along with this exam, you were given a separate handout with an example web page (shown in color) about Antioxidants. and a page of specific instructions on how to write that page.

    In the space below and continuing on the following page(s), please write the HTML for this web page, according to the following specific instructions. (Note: if you don't know how to do part of this, just do the parts you do know how to do, for partial credit.)


    <!-- extra space for your answer -->

    <!-- extra space for your answer -->

    Short Answer: HTML

    (p. 18 of the JavaScript book, and p. 94-97 of the Head First HTML book, Lecture Notes of Oct 3rd)

  18. (10 pts) In the space below, briefly explain the difference between a block element and an inline element. In your explanation, give a specific example of each kind of element, making specific reference to the web page about antioxidants you wrote in the previous question.

 


(End of Exam)

Instructions for Question 17

Note that I'm giving you a lot of the details here, because I'm not interested in testing your ability to memorize—instead I want to test your ability to use HTML and CSS and to apply concepts such as nesting, elements, attributes, properties and values, and write them using the proper syntax.

    1. (2 pts) Include the following DOCTYPE so that the page will validate. Be sure that all of your tags are properly nested.
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
      "http://www.w3.org/TR/html4/loose.dtd">
    2. (8 pts) Be sure that your page has the following elements, all nested properly, and in the proper order: body, head, html, style, and title.
      • you need to figure out what the proper order and nesting is for those five elements
      • One of these elements requires the attribute type with the value text/css
        so don't forget to add that.
      • Leave enough room inside your style element to add about
    3. (10 pts) Put all the text inside the body element, and in appropriate tags to indicate whether it is a regular paragraph, or a heading. You'll need the <p> tag, as well as the <h1>, <h2> and <h3> tags.
    4. (2 pts) Use the CSS property text-align with the value center to center the top level headline "Antioxidants"
    5. (2 pts) Use two hr elements (with a self-closing tag) to separate the three sections of the web page.
    6. (2 pts) Use an <em> tag to markup the text wild so that it is emphasized (and by default, appears in italics).
    7. (3 pts) Use an <a> tag to make the word "caffeine" be a link to the web address http://en.wikipedia.org/wiki/Caffeine
    8. (3 pts) Use CSS to change the default font for the entire page to a sans-serif font. The property you need is font-family and the value is sans-serif. Hint: what element should you apply the property to so that it affects the entire web page?
    9. (3 pts) Use CSS to make all the second level headlines red (as shown in the figure).
    10. (2 pts) Use an id attribute on the appropriate HTML element, along with CSS to make the words "Green Tea" the color green. (Remember that in the style sheet, you put a # in front of the name of an id before specifying its properties. The property you need is color)
    11. (3 pts) Use a class attribute to make the words "Blueberries" and "Black Currant" appear in the color blue.