Practice Quiz

AJAX

Instructions

This practice quiz is posted to help you prepare for the final exam. The questions here are similar to those that will be on the exam. (Some of them may actually be on the exam.) Mark your selections using the radio buttons. Answers are shown by clicking the button at the bottom of the page.

  1. AJAX has become very commonly used because
    1. it allows pages to be interactive without further communication with the server.
    2. XML is a close relative of HTML.
    3. it avoids the need for JavaScript.
    4. it allows page content to be updated without requiring a full page reload.
  2. Which of the following is not a reason XML gained popularity as a data interchange format for AJAX?
    1. It has been around a while and libraries exist for many languages to work with it
    2. It can be navigated using JavaScript DOM methods.
    3. It is extensible, allowing it to be adapted to virtually any application.
    4. It is concise and simple to use.
  3. Following the same-origin policy, if the web page making an AJAX request has the URL https://www.example.com/products/order.php then which of the following URLs could be the target of the AJAX request?
    1. http://www.example.com/products/order.php
    2. https://www.partner.com/ads/frammis.html
    3. https://www.example.com/products/frammis.html
    4. All of the above.
  4. Which statement about XML is false?
    1. Every XML document must have a DOCTYPE tag.
    2. Every XML document must have a root element.
    3. Every XML tag must have a closing tag.
    4. Every XML document must start with an XML prolog.
  5. Which JavaScript DOM traversal method works with an XML Document object?
    1. getElementById
    2. getElementsByTagName
    3. querySelectorAll
    4. All of the above.
  6. The jQuery AJAX methods .get(), .post(), and .ajax() all require which parameter to be supplied?
    1. method
    2. url
    3. data
    4. headers
  7. Which of the following is not a restriction of JSON as a data interchange format relative to a plain object definition in JavaScript?
    1. Property names must be quoted.
    2. Single quotes may not be used as string delimiters.
    3. Properties may not include functions or expressions.
    4. Properties may only be objects, not arrays.
  8. If an AJAX request made using jQuery fails,
    1. the browser will automatically report the problem with an alert message.
    2. an error message will be displayed in the browser window content area.
    3. the programmer should arrange for it to be reported using the jQuery .fail() method.
    4. there is no way to notify the user.