oDesk AJAX Test Answers
Question no-1
What should be called before 'send ()' to prepare an XMLHttpRequest object?
b. open () (Answer)
Question no-2
What is the correct way to execute the function "calc()" when an XMLHttpRequest is loaded?
a. myRequest.onreadystatechange = calc; (Answer)
Question no-3
Can AJAX be used with HTTPS (SSL)?
a. yes (Answer)
Question no-4
Can you call responseBody or responseText to get a partial result when the readyState of an XMLHttpRequest is 3(receiving)?
b. No (Answer)
Question no-5
How can you create an XMLHttpRequest under Internet Explorer 6?
b.var oReq = new ActiveXObject ("MSXML2.XMLHTTP.3.0"); (Answer)
Question no-6
Consider the following function:
function foo ()
{
return 5;
}
What will the following code do?
var myVar = foo;
function foo ()
{
return 5;
}
What will the following code do?
var myVar = foo;
b. Assign the pointer to function foo to myVar (Answer)
Question no-7
Can WebDav methods like PROPFIND be used with XMLHttpRequest.open()? |
a.Yes (Answer)
Question no-8
Can you start multiple threads with JavaScript? |
b No (Answer)
Question no-9
In the following list, which ones are used to fetch the result data of an XMLHttpRequest? |
e. responseXML (Answer)
Question no-10
Which of the following is not a valid variable name in JavaScript? |
b. 2myVar (Answer)
Question no-11
Which of the following is a block comment in JavaScript? |
b. /* */ (Answer)
Question no-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)
Question no-13
What language does AJAX use on the client side?
a. JavaScript (Answer)
Question no-14
Which of the following is not a JavaScript operator? |
e. All of the above are Javascript operators (Answer)
Question no-15
What is the standardized name of JavaScript? |
c. ECMAScript (Answer)
Question no-16
Which of the following cannot be resolved by using AJAX? |
d. Server crashes (failover) (Answer)
Question no-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)
Question no-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>
<div id="statusCode"></div>
b. var myDiv = document.getElementById ("statusCode");
myDiv.innerHTML = req.status; (Answer)
myDiv.innerHTML = req.status; (Answer)
Question no-19
What is the correct way to have the function checkState called after 10 seconds? |
b. window.setTimeout(checkState, 10000); (Answer)
Question no-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)
Question no-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)
Question no-22
When may asynchronous requests be used?
c.To load additional code from the server (Answer)
Question no-23
Which of the following are drawbacks of AJAX?
a.The browser back button cannot be used in most cases (Answer)
Question no-24
What is NOSCRIPT tag for?
c. To enclose text to be displayed if the browser doesn't support JS (Answer)
Question no-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
Question no-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)
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)
Question no-27
What is the common way to make a request with XMLHttpRequest?
d. myReq.send(null); (Answer)
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
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
What is the syntax for the event listener that monitors whether the XMLHttpRequest object's readyState attribute has changed?
onreadystatechange (Answer)
onProgress
onprogress
onReadyStateChange
onreadystatechange (Answer)
onProgress
onprogress
onReadyStateChange
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.
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.
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)
There is no advantage
Fewer HTTP requests and smaller loaded resources
Better cross-browser compatibility and faster speed of development (Answer)
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.
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.
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.
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.
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
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
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
documentXML
XMLDom
XMLDoc
responseXML (Answer)
responseText
Which method on the XMLHttpRequest object is used to send custom HTTP headers with a request?
setRequestHeader (Answer)
setXHRHeader
sendAdditionalRequestHeader
addHeader
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?setRequestHeader (Answer)
setXHRHeader
sendAdditionalRequestHeader
addHeader
JSON.stringify(returnedData);
returnedData.parse();
JSON.parse(returnedData); (Answer)
returnedData.parse("JSON");
No comments:
Post a Comment