COSC 465 Final Exam

Fall 2013

Solutions


    1. XMLHttpRequest
    2. onreadystatechange
    3. Javascript
    4. Php
    5. lists and associative arrays (hash tables or dictionaries are acceptable alternatives)
    6. prototype-instance model

  1. Ajax allows Javascript to send an asynchronous request to the server and the user can continue to work with the web page while the server processes the result. When the server is done it sends the result back to Javascript and Javascript can appropriately update the webpage, without having to re-load the entire page.

      1. Cookies: A client-side solution in which the browser stores information about a session in a special file on the client. The advantages of cookies is that the server does not have to provide storage for the session information and that multiple servers can handle the interation with the client without having to know which servers previously handled the session. The disadvantage is that cookies have been abused to keep tracking information about clients and hence many people disable them.
      2. Hidden Form Elements: A client-side solution in which information about a session is transmitted to the browser via hidden form elements. The advantages of hidden form elements is that the server does not have to provide storage for the session information, they cannot be blocked by the client, and that multiple servers can handle the interation with the client without having to know which servers previously handled the session. The disadvantage is that hidden form elements must be re-transmitted with each page fetch, it is fairly cumbersome to create hidden form elements, and the information is easily visible to hackers by looking at the page source, and the information may be manipulated by a sophisticated hacker
      3. PHP Sessions: A server-side solution in which the server maintains information about a session in a global hash table called $_SESSION. The advantages of PHP sessions is that the information is kept on the server, where it is more secure, PHP handles the bookkeeping of initializing and storing the hash table, and the information is easily accessible. The disadvantage of PHP sessions is that the information is stored with the initial server that handles the session and thereafter only this server may be used to manage the session (i.e., the data can only be viewed from that server).
      4. Database: A server-side solution in which the server maintains information about a session in a database. The advantages of databases are that the information is kept on the server, where it is more secure, and the session may be managed by multiple, independent servers. The disadvantages of databases is that the programmer must implement the bookkeeping to store the session information and the information is stored on disk, where it may be somewhat slower to retrieve.
    1. In general it is better to keep the session information on the server side because it is more secure. Information that is kept on the client can be more easily tampered with by a sophisticated hacker.

  2. Advantages for XML:

    1. Its data is human-readable
    2. It supports semi-structured data that may have different attributes based on an element's type

    Advantages of a Database (not all have these answers would need to be cite--two or three would be acceptable)

    1. Given the same amount of data, it provides much more compact storage
    2. It can execute queries more efficiently
    3. It provides greater data security
    4. It provides powerful query operators that allows end-users without programming experience to quickly combine data from different schemas and generate reports
    5. It provides better support for concurrent updating of its data
    6. It is less likely to have redundant data that is subject to update anamolies

    1. /^\.\d{1,3}$/
    2. /^[A-Za-z]+[#!?^]?\d+$/