1. 2 points each
    1. XMLHttpRequest
    2. onreadystatechange
    3. XML
    4. DOM parser
    5. Expat parser
    6. SimpleXML parser
    7. Regular expressions

  2. 2 points each
    1. Javascript
    2. Regular Expressions
    3. DTD
    4. SQL
    5. PHP (1 point for Javascript)

  3. 4 points for properly explaining the cascade and 2 points each for properly explain the three factors that determine the cascade.

    The cascade is the process by which a virtual style-sheet is assembled for an element via inheritance, specificity, and location. Inheritance can be used to determine the values of unspecified styles while specificity and location can be used to resolve conflicts between styles.

    1. Inheritance is the process by which CSS properties applied to one tag are passed on to nested tags.
    2. Specificity refers to the tie breaking procedure used when multiple styles apply to the same tag. In this case the most specific selector is used.
    3. Location refers to the tie breaking procedure used when there is equal specificity between one or more selectors. In this case, the last style to be specified in physical order wins.

  4. 3 limitations of Javascript: 3 points for each limitation with partial credit assigned for the clarity of the answer and explaining why the limitation is either an advantage or is mitigated on the client side.
    1. It cannot write to files: This makes it safe to run on the client-side since a user knows that a javascript program cannot maliciously modify the user's file system.
    2. It cannot perform formatted output: Javascript assumes that it will be run with a graphical interface, so formatted output is not required.
    3. It cannot read inputfrom a console: Javascript assumes that it will receive input from a graphical form, so reading from the console is not required. If necessary, Javascript can also request input from the user via the prompt command.

  5. 2 points for telling me the feature, which is system-related commands, and 3 points for telling me that the commands are system-independent, thus lending themselves to portablity across multiple platforms

    Perl became popular with system administrators because it included system-independent commands, such as rename or unlink, for manipulating the file system. This meant they could write general scripts that would run on any operating system. Prior to Perl, they had to worry about finding which directory contained the Unix commands they were using and include it in the path variable. Additionally, if they wanted the script to run on both Windows and Unix platforms, then they had to have the script test some variable to see which platform they were running on, and then use the appropriate system-specific command.

  6. 2 ways in which the prototype-instance model differs from the class-instance model: 4 points for each difference, with credit depending on the clarity and conciseness of the answer.

    1. prototypes are actual objects that exist at run-time whereas classes represent templates from which objects may be created, but they are not objects themselves.
    2. prototypes allow properties to be dynamically added and deleted to both the prototype or the instance, whereas the instance variables in a class are a fixed set that can neither be added to nor subtracted from at runtime.

  7. 2 sample Ajax applications and how I would use Ajax to implement them: 2 points each for the applications and 4 points each for giving me a clear, concise, and specific description of what parts of the application would use Ajax.

    1. Email: An email handler can be written with a client side in Javascript and a server side written in PhP. Ajax can be used to incrementally remove mail items from the list, add mail items to the list in response to queries to the server, display email messages, etc. Each request--delete, fetch new mail, display mail message--can be handled with requests to the server followed by updating the email form presented to the user. You might launch requests to fetch new mail every few seconds using a timer.

    2. Polling: Many web-sites, such as American Idol or news sites, allow users to respond to poll questions without having to reload the entire page. This is done by sending an Ajax request to the server to update the vote tallies when the user presses an appropriate radio button and using a timer object to periodically send requests to the server to retrieve updated vote counts.

  8. Javascript code to compute the sales tax amount and store it in the salestax form element. Since the sales tax is a text for element, we can change its value by changing the value field. If the sales tax is greater than 50, it also displays the amount in a red font.
    • (4 points): Correct calculation of the salestax amount including extracting the values from the appropriat1e form elements.
    • (4 points): Correctly assigning the salestax amount to the salestax form element
    • (4 points): Correctly setting the color of the salestax form element to red if the salestax
    with(document.forms.tax) { salestax_amt = parseInt(amount.value) * parseFloat(taxrate.value) salestax.value = salestax_amt.toString() if (salestax_amt > 50) salestax.style.color = 'red' else salestax.style.color = 'black' }
  9. A line of javascript code to change the sales tax html element to reflect the computed sales tax:

    (5 points) The two important elements of this question involve using getElementById to retrieve the tax element and using either the innerHTML or the firstChild.nodeValue properties.

    document.getElementById('tax').innerHTML = salestax_amt;
    document.getElementById('tax').firstChild.nodeValue = salestax_amt.toString();
  10. 3 points for part a and 6 points each for parts b and c. The amount of credit you receive depends on how fully your answer complies with the request of the problem..
    1. mysql_connect("schools.com", "cs460", "correct"); mysql_select_db("questions");
    2. SELECT QuestionText, Answer FROM Questions WHERE Course = 'CS302';
    3. SELECT Questions.QuestionText, Options.OptionText FROM Questions, Options WHERE Questions.Course = 'CS302' and Questions.Answser = Options.OptionId;