oDesk AJAX Test Answer 2015



1. What should be called before 'send ()' to prepare an XMLHttpRequest object?
 b. open ()    (Answer)

2. What is the correct way to execute the function "calc()" when an XMLHttpRequest is loaded?
a. myRequest.onreadystatechange = calc; (Answer)

3. Can AJAX be used with HTTPS (SSL)?

a. yes    (Answer)

4. Can you call responseBody or responseText to get a partial result when the readyState of an XMLHttpRequest is 3(receiving)?
 b. No     (Answer)


5. How can you create an XMLHttpRequest under Internet Explorer 6?

b.var oReq = new ActiveXObject ("MSXML2.XMLHTTP.3.0");    (Answer)

 6. Consider the following function:

function foo ()
{
return 5;
}

What will the following code do?


var myVar = foo;
b. Assign the pointer to function foo to myVar    (Answer)

7. Can WebDav methods like PROPFIND be used with XMLHttpRequest.open()?
 a.Yes    (Answer)

8. Can you start multiple threads with JavaScript?

 b No    (Answer)

9. In the following list, which ones are used to fetch the result data of an XMLHttpRequest?
e. responseXML    (Answer)

10. Which of the following is not a valid variable name in JavaScript?
 b. 2myVar    (Answer)

 11. Which of the following is a block comment in JavaScript?
 b. /* */    (Answer)

12. Is it possible to make a page "reload-safe" when using AJAX?
 b.  yes, if each AJAX request modifies the server side context, which would render a page similar to the actual JS modified page, if reloaded.    (Answer)

 13. What language does AJAX use on the client side?

 a. JavaScript    (Answer)

 14. Which of the following is not a JavaScript operator?
 e. All of the above are Javascript operators    (Answer)

 15. What is the standardized name of JavaScript?
 c. ECMAScript    (Answer)

16. Which of the following cannot be resolved by using AJAX?
 d. Server crashes (failover)    (Answer)

17. It might be needed to set the request content-type to XML explicitly. How can you do so for an XMLHttpRequest Object?
e.  myReq.setRequestHeader ("Content-Type", "text/xml");    (Answer)

18. You want to update the following element with the XMLHttpRequest status. Which of the following approaches is correct for the purpose?
<div id="statusCode"></div>
 b.  var myDiv = document.getElementById ("statusCode");
myDiv.innerHTML = req.status;    (Answer)


19. What is the correct way to have the function checkState called after 10 seconds?

 b. window.setTimeout(checkState, 10000);    (Answer) 
20. What is true regarding XMLHttpRequest.abort()?
 a.  It can only be used with async requests
 b.  It will remove the onreadystatechange event handler    (Answer)

21. Which of the following request types should be used with AJAX?
 a. HTTP GET request for retrieving data (which will not change for that URL)
 d.  HTTP POST should be used when the state is updated on the server    (Answer)

22. When may asynchronous requests be used?
 c.To load additional code from the server    (Answer)

23. Which of the following are drawbacks of AJAX?
 a.The browser back button cannot be used in most cases    (Answer)

24. What is NOSCRIPT tag for?
 c. To enclose text to be displayed if the browser doesn't support JS    (Answer)

25. The server returns data to the client during an AJAX postback. Which of the following is correct about the returned data?
 a. It only contains the data of the page elements that need to be changed

26. Which of the following list is/are true regarding AJAX?
  a.     It can only be implemented with the XMLHttpRequest object
    b.     It can be used to update parts of a webpage without reloading it
    c.     It can be used to make requests to the server without blocking the user  (Answer)

27. What is the common way to make a request with XMLHttpRequest?
 d. myReq.send(null);    (Answer)

28. Which protocol is used to transfer data in an AJAX request?
    Advanced Server Protocol, ASP
    Hypertext Transfer Protocol, HTTP (Answer)
    Asynchronous Binary Transfer Protocol, ABTP
    AJAX Object Protocol, AOP

29. What is the syntax for the event listener that monitors whether the XMLHttpRequest object's readyState attribute has changed?
    onreadystatechange (Answer)
    onProgress
    onprogress
    onReadyStateChange

30. The onreadystatechange change event is used to invoke behavior when
    the browser window is closed or resized.

    users navigate away from a page with unsaved or uncommitted changes.
    elements on a page change appearance.
    the status of the asynchronous request changes. (Answer)
    a user indicates they are ready to continue from a dialog prompt.

31. What are the advantages of using JavaScript libraries (like jQuery) to implement Ajax?
    There is no advantage
    Fewer HTTP requests and smaller loaded resources
    Better cross-browser compatibility and faster speed of development (Answer)

32. Which browser features and/or technologies must be enabled, at a minimum, for AJAX techniques to function properly?

    Private browsing must be enabled.
    A Flash plugin must be installed
    Cookies must be enabled.
    JavaScript must be enabled. (Answer)

    A Java plugin must be installed and enabled.

33. The primary benefit of using AJAX techniques in a web application is:
    It makes pages more easily bookmarked, shared and navigated by users using standard browser controls.
    It makes web applications "advanced".
    It allows web applications to send asynchronous data requests to a server without a user initiated page load. (Answer)
    It makes it easier to create accessible (usable by people of all abilities and disabilities) web pages
    It makes web applications more easily crawlable by search engines like Google, Yahoo and Bing.

34. What arguments MUST be supplied to an XMLHttpRequest object's .open() method, and in what order?
    URL as string, HTTP method as string, URL parameters as string
    HTTP method as string, URL as string, async flag as boolean (Answer)
    URL as string, HTTP method as string, CORS flag as boolean
    HTTP method as string, URL as string, async flag as boolean, username as string, password as string

35. After a request completes, which property of the XMLHttpRequest object can be used to retrieve a DOM representation of a remote XML document?
    documentXML
    XMLDom
    XMLDoc
    responseXML (Answer)
    responseText

36. Which method on the XMLHttpRequest object is used to send custom HTTP headers with a request?
    setRequestHeader (Answer)
    setXHRHeader
    sendAdditionalRequestHeader
    addHeader

37. If an Ajax request loads JSON-formatted responseText into the variable returnedData, what code will turn the data into a readable JSON object in modern browsers, including IE8 and above?
    JSON.stringify(returnedData);
    returnedData.parse();
    JSON.parse(returnedData); (Answer)
    returnedData.parse("JSON");



Share on Google Plus

About Unknown

I'm a professional web designer and wordpress theme developer. I also like to write blog post.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment