Training Guide: Programming in HTML5 with JavaScript and CSS3 Ebook

(Nora) #1

Answers CHAPTER 9 413


Answers


This section contains the answers to the lesson review questions in this chapter.

Lesson 1



  1. Correct answer: A
    A. Correct: Use the pipe method to chain asynchronous operations because it pro-
    vides access to progress, failure, success, and complete.
    B. Incorrect: The done method executes code when completed but does not provide
    access to failure, progress, and complete.
    C. Incorrect: The resolve method indicates success but is not used for chaining.
    D. Incorrect: The always method executes on completion regardless of success or
    failure. This method does not provide access to progress, success, or failure.

  2. Correct answer: C
    A. Incorrect: The resolve method resolves an existing promise object, but it doesn’t
    create a new resolved promise object.
    B. Incorrect: The done method executes code upon success of a promise object, but
    it does not create a resolved promise object.
    C. Correct: The $.when() method creates a resolved promise object.
    D. Incorrect: The $.Deferred() method creates an unresolved promise object.

  3. Correct answer: A
    A. Correct: The done method executes code upon successful completion.
    B. Incorrect: The alway method executes code regardless of success or failure.
    C. Incorrect: The complete method does not exist.
    D. Incorrect: The success method does not exist.

  4. Correct answer: B
    A. Incorrect: The progress method executes code when progress has changed; it does
    not to indicate a change in progress.
    B. Correct: The notify method indicates a change in progress.
    C. Incorrect: The done method executes code when completed but does not indicate
    a change in progress.
    D. Incorrect: The resolve method indicates success, not a change in progress.

Free download pdf