Next: , Up: (dir)

Scripting Languages G22.3033-002 Summer 2008


Previous: Top, Up: Top

Scripting Languages G22.3033-002 Summer 2008 quiz3

Thursday 7/17/2008. 30 points.

http://www.cs.nyu.edu/courses/summer08/G22.3033-002/


Up: quiz3

Quiz 3 problems.


Next: , Up: quiz3-problems

quiz3-1 Closures

(4+3+3 = 10 points) Consider the following JavaScript code:

     var a = 1;
     function outer(b) {
       function inner() {
         document.write("a=" + a + ", b=" + b + "</br>\n");
       }
       return inner;
     }
     var my_closure = outer(2);
     my_closure();
     a = 3;
     my_closure();
  1. What does the code print?
  2. What is the function of closure my_closure?
  3. What is the environment of closure my_closure?


Next: , Previous: quiz3-1, Up: quiz3-problems

quiz3-2 AJAX

(2+5+3 = 10 points) Consider a web email application that lets the user create an attachment. After the user selects the file to attach, the application uploads it to the server in the background. At the same time, the user can interact normally with the application. When the file is uploaded, the page changes so the user knows the file is at the server.

  1. What do the letters A, J, A, X stand for in the acronym AJAX?
  2. Draw an interaction diagram that illustrates how the web email application uses AJAX. Your diagram should start as follows:

  3. What is the advantage of using AJAX for this application?


Previous: quiz3-2, Up: quiz3-problems

quiz3-3 Security

(4+3+3 = 10 points)

  1. What is a SQL injection vulnerability in a server-side script?
  2. Give an example for a bad thing that could happen due to a SQL injection attack.
  3. How can you prevent SQL injection attacks on your applications?