MCQs > IT & Programming > Ajax MCQs > Basic Ajax MCQs

Basic Ajax MCQ

1.

What does the following code do? var xhttp, xmlDoc, txt, x, i; xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { xmlDoc = this.responseXML; txt = ""; x = xmlDoc.getElementsByTagName("QUESTION"); for (i = 0; i < x.length; i++) { txt = txt + x[i].childNodes[0].nodeValue + "
"; } document.getElementById("demo").innerHTML = txt; } }; xhttp.open("GET", "questions.xml", true); xhttp.send();

Answer

Correct Answer: responseXML gets response as XMLDocument

Note: This Question is unanswered, help us to find answer for this one

2.

How can you send cookies in CORS Ajax call ?

Answer

Correct Answer: You must set the withCredentials flag on the XMLHttpRequest transport. xhr.withCredentials = true;

Note: This Question is unanswered, help us to find answer for this one

3.

AJAX is used to create a very _____ web interface.

Answer

Correct Answer: dynamic

Note: This Question is unanswered, help us to find answer for this one

4.

How can you stop jQuery AJAX response from being cached?

Answer

Correct Answer: Set cache:false in jQuery.ajax() call

Note: This Question is unanswered, help us to find answer for this one

5.

Which object shares a powerful set of methods that can be used to expedite communications between the client and server?

Answer

Correct Answer: XMLHttpRequest()

Note: This Question is unanswered, help us to find answer for this one

6.

Can the XMLHttpRequest object be disabled via browser settings?

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

7.

Which of the answers is correct in order to send the following data with request? var requestData = "username=" + escape(document.getElementById("username").value) + "&password=" + escape(document.getElementById("password1").value) + "&firstname=" + escape(document.getElementById("firstname").value) + "&lastname=" + escape(document.getElementById("lastname").value) + "&email=" + escape(document.getElementById("favorite").value);

Answer

Correct Answer: abcRequest.open("POST", url, true); abcRequest.send(requestData);

Note: This Question is unanswered, help us to find answer for this one

8.

Why would a public api return a non valid json like this? for(;;); {"key1":val1,"key2": "val2"}

Answer

Correct Answer: These strings are commonly referred to as an "unparseable cruft" and are security measures.

Note: This Question is unanswered, help us to find answer for this one

9.

Which of the following parameters to request.open() are correct?

Answer

Correct Answer: request.open("GET", url, true);
request.open("POST", url, true);

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

10.

Which of the following is true to convert AJAX JSON response into object?

Answer

Correct Answer: eval(' + request.responseText + ');

Note: This Question is unanswered, help us to find answer for this one

11.

Which of the following is true about asynchronous request?

Answer

Correct Answer: User has to wait while request is taking place

Note: This Question is unanswered, help us to find answer for this one

12.

Which of the following is the correct way to disable register button while request is processing?

Answer

Correct Answer: document.getElementById("register").disabled = true;

Note: This Question is unanswered, help us to find answer for this one

13.

To check if DOM element 'currentDiv' don't have any child nodes, we can use which one of the following conditions?

Answer

Correct Answer: currentDiv.childNodes.length == 0

Note: This Question is unanswered, help us to find answer for this one

14.

Which of the following methods is NOT supported by the XMLHttpRequest object?

Answer

Correct Answer: quit

Note: This Question is unanswered, help us to find answer for this one

15.

By default, browsers do not support cross domain AJAX requests.

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

16.

Which of the following statement best describes the below code (function worker() { $.ajax({ url: 'ajax/test.html', success: function(data) { $('.result').html(data); }, complete: function() { setTimeout(worker, 5000); } }); })();

Answer

Correct Answer: Periodically performs an ajax request

Note: This Question is unanswered, help us to find answer for this one

17.

For the following code fragment function Foo() { this.data = 42, document.body.onclick = this.method.bind(this); } Foo.prototype.method = function() { console.log(this.data); }; choose the option that shows the output to the console log

Answer

Correct Answer: 42

Note: This Question is unanswered, help us to find answer for this one

18.

The readyState property in onreadystatechange event equal to 1 means ?

Answer

Correct Answer: server connection established

Note: This Question is unanswered, help us to find answer for this one

19.

for the code fragment below $.ajax({ type: 'POST', url: 'submit1.php', data: $("#regist").serialize(), dataType: 'json', success: function() { // code here} }); Choose the statement that best describes the role of the success ‘key’

Answer

Correct Answer: Defines an AJAX callback for a response with status code 200

Note: This Question is unanswered, help us to find answer for this one

20.

Which of the following will not execute request asynchronously provided usernameRequest object already exists?

Answer

Correct Answer: usernameRequest.open("GET", "abc.php", false); usernameRequest.send(null);

Note: This Question is unanswered, help us to find answer for this one

21.

Choose the best statement for the expression JSON.stringify(jsObj);

Answer

Correct Answer: Will fail if the browser lacks native JSON serialization

Note: This Question is unanswered, help us to find answer for this one

22.

What does the status == 404 means ?

Answer

Correct Answer: the Ajax call to the page was not found

Note: This Question is unanswered, help us to find answer for this one

23.

In an ajax request function callback you have the following code $('#childdiv').html(data); choose the most probable reason why a previous delegated 'click' event no longer functions

Answer

Correct Answer: If you do use event delegation, you must bind to a non-changing parent element.

Note: This Question is unanswered, help us to find answer for this one

24.

Which of the following object.method is responsible for writing text to current web page?

Answer

Correct Answer: document.write

Note: This Question is unanswered, help us to find answer for this one

25.

Which of the following can be used to display 'inProcess.png' image while processing request?

Answer

Correct Answer: document.getElementById("status").src = "inProcess.png";

Note: This Question is unanswered, help us to find answer for this one

26.

Which of the following will change the class of XHTML element having ID of 'username'?

Answer

Correct Answer: document.getElementById("username").className = "approved";

Note: This Question is unanswered, help us to find answer for this one

27.

What is wrong in the following function ? function loadDoc() { varxhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 3 &&this.status == 200) { console.log(this.responseText); } }; xhttp.open("GET", "cd_catalog.xml", true); xhttp.send(); }

Answer

Correct Answer: In line 4, the comparison of this.readyState should be with 4

Note: This Question is unanswered, help us to find answer for this one

28.

Which of the following are not 'document' object methods?

Answer

Correct Answer: document.replace(element)

Note: This Question is unanswered, help us to find answer for this one

29.

Choose the best answer to describe ‘Deferred objects’

Answer

Correct Answer: jQuery's custom implementation of promises

Note: This Question is unanswered, help us to find answer for this one

30.

Which of the following methods are used for cross domain AJAX calls?

Answer

Correct Answer: Both of the above

Note: This Question is unanswered, help us to find answer for this one

31.

For the code fragment function x(a,b,e,d,c){ c=new XMLHttpRequest; c.open(e||'get',a); c.onload=b; c.onerror=error; c.send(d||null) } Choose the option that best describes the parameter d

Answer

Correct Answer: Form data

Note: This Question is unanswered, help us to find answer for this one

32.

Can we make a HTTP POST Ajax call?

Answer

Correct Answer: Yes, set method param of open() function to POST

Note: This Question is unanswered, help us to find answer for this one

33.

For the code fragment below, function ajax(a,b,c) { c=new XMLHttpRequest; c.open('GET',a); c.onload=b; c.send() } Choose the option that best describes the parameter c

Answer

Correct Answer: A variable definition

Note: This Question is unanswered, help us to find answer for this one

34.

Which of the following is NOT a valid method in the key/value pair to configure ajax request in jquery.ajax()?

Answer

Correct Answer: pass

Note: This Question is unanswered, help us to find answer for this one

35.

What does the getAllResponseHeaders() function do ?

varxhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 &&this.status == 200) { console.log(this.getAllResponseHeaders()); } }; xhttp.open("GET", "ajax_info.txt", true); xhttp.send();

Answer

Correct Answer: Get all response headers of Ajax call

Note: This Question is unanswered, help us to find answer for this one

36.

For the following code fragment function Foo() { this.data = 42, document.body.onclick = this.method; } Foo.prototype.method = function() { console.log(this.data); }; choose the option that shows the output to the console log

Answer

Correct Answer: undefined

Note: This Question is unanswered, help us to find answer for this one

37.

For the following code fragment foo(function(r) { // code }); Choose the correct description of the ‘function(r)’

Answer

Correct Answer: A callback

Note: This Question is unanswered, help us to find answer for this one

38.

Which of the following methods can be used to assign multiple event handlers?

Answer

Correct Answer: addEventListener()

Note: This Question is unanswered, help us to find answer for this one

39.

Which of the following XMLHttpRequest Object method returns all the header information?

Answer

Correct Answer: getAllResponseHeaders()

Note: This Question is unanswered, help us to find answer for this one

40.

Which of the following is correct for the term 'Progressive enhancement'? (choose all that apply)

Answer

Correct Answer: Progressive enhancement allows everyone to access the basic content and functionality of a web page, using any browser or Internet connection, while also providing an enhanced version of the page to those with more advanced browser software or greater bandwidth.
The reverse of 'Graceful Degradation'

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

41.

Which of the following are General HTTP headers?

Answer

Correct Answer: Connection
Date
Mime-Version
Trailer

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

42.

Which of the following are HTTP response headers?

Answer

Correct Answer: Age
Public
Retry-After

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

43.

The responseText or responseXML property of the XMLHttpRequest ____?

Answer

Correct Answer: object

Note: This Question is unanswered, help us to find answer for this one

44.

For the code fragment below function foo() { var httpRequest = new XMLHttpRequest(); httpRequest.open('GET', "/echo/json"); httpRequest.send(); return httpRequest.responseText; } var result = foo(); What will be the value of ‘result’

Answer

Correct Answer: Undefined

Note: This Question is unanswered, help us to find answer for this one

45.

The browser will put 'text' that the server returns in which of the following Request Object property?

Answer

Correct Answer: responseText

Note: This Question is unanswered, help us to find answer for this one

46.

Fill the correct blanks in following code: Function processXhrChange() { // Check readyState to make sure the XMLHttpRequest has been fully loaded if (Xhr.readyState == ______ ) { // Check status code from server for "OK" if ( Xhr.status == ______ ) { // Process incoming data // Update our hit counter Hit = hit + 1; } else { // Request had a status code other than 200 Alert ("There was a problem communicating with the server\n"); } }

Answer

Correct Answer: 4 200

Note: This Question is unanswered, help us to find answer for this one

47.

Which of the following property of XMLHttpRequest object holds its status?

Answer

Correct Answer: readyState

Note: This Question is unanswered, help us to find answer for this one

48.

Can ActiveXObject work on browsers like Chrome and Firefox?

Answer

Correct Answer: No, ActiveX is only supported by IE - the other browsers use a plugin architecture called NPAPI

Note: This Question is unanswered, help us to find answer for this one

49.

Which of the following statements is true about following code? $.ajax({ method: "GET", url: "test.js", dataType: "script" });

Answer

Correct Answer: Load and execute the JavaScript file

Note: This Question is unanswered, help us to find answer for this one

50.

Which of the following method can be used to delete node from DOM tree?

Answer

Correct Answer: removeNode()

Note: This Question is unanswered, help us to find answer for this one

51.

Which of the following numbers, in callback function of request object, can be tested against request.readyState to make sure that server has finished processing request?

Answer

Correct Answer: 4

Note: This Question is unanswered, help us to find answer for this one

52.

Which of the following jQuery AJAX function is used to set default values for future AJAX requests?

Answer

Correct Answer: jQuery.ajaxSetup()

Note: This Question is unanswered, help us to find answer for this one

53.

Which of the following is true for asynchronous requests and response?

Answer

Correct Answer: Never count on the ORDER or SEQUENCE of requests and responses in asynchronous applications.
If you’re making TWO separate requests, use TWO separate request objects.

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

54.

Which of the following javascript functions can be used to convert JSON string into object?

Answer

Correct Answer: JSON.parse()

Note: This Question is unanswered, help us to find answer for this one

55.

Which of the following benefits can AJAX provide to Web Applications?

Answer

Correct Answer: The browser can request multiple things from the server at the same time.
Browser requests return a lot faster.
Only the parts of the page that actually change are updated.

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

56.

Which of the following is the correct way to assign events to HTML elements using JavaScript?

Answer

Correct Answer: document.getElementById("Btn").onclick = functionName;

Note: This Question is unanswered, help us to find answer for this one

57.

Which of the following request object method can be assigned a callback function which will be called every time the server updates the browser on the request its processing?

Answer

Correct Answer: request.onreadystatechange

Note: This Question is unanswered, help us to find answer for this one

58.

How to use Basic Auth with jQuery and AJAX?aja

Answer

Correct Answer: Both of the above

Note: This Question is unanswered, help us to find answer for this one

59.

Which of the following may be a disadvantage of using AJAX?

Answer

Correct Answer: All of the above

Note: This Question is unanswered, help us to find answer for this one

60.

Which of the following is not supported in AJAX?

Answer

Correct Answer: Flash

Note: This Question is unanswered, help us to find answer for this one

61.

How to make a cross-domain Ajax call?

Answer

Correct Answer: By using both JSONP and CORS

Note: This Question is unanswered, help us to find answer for this one

62.

Which of the following is true about jQuery.get() method?

Answer

Correct Answer: Load data from the server using an HTTP GET request

Note: This Question is unanswered, help us to find answer for this one

63.

Which one of these technologies is NOT used in AJAX?

Answer

Correct Answer: Flash

Note: This Question is unanswered, help us to find answer for this one

64.

Your ajax requests are giving you cross site scripting issues, choose the best method below to get around this

Answer

Correct Answer: Run a proxy script on your own server that fetches the content from the external site and pipes it back to the browser

Note: This Question is unanswered, help us to find answer for this one

65.

How do you know that an AJAX request has completed?

Answer

Correct Answer: XHR.readyState is 4 and the XHR.status is 200

Note: This Question is unanswered, help us to find answer for this one

66.

After all referenced files are loaded and parsed, the browser triggers the _____ event?

Answer

Correct Answer: window.onload

Note: This Question is unanswered, help us to find answer for this one

67.

For the following code fragment object.property(); choose the option that is correct

Answer

Correct Answer: When you get the property from the object and call it in one go, the object will be the context for the method

Note: This Question is unanswered, help us to find answer for this one

68.

What is the correct way to implement GET request using AJAX?

Answer

Correct Answer: xhttp.open(“GET”, “demo_get.asp”, true); xhttp.send();

Note: This Question is unanswered, help us to find answer for this one

69.

Which of the following callback hooks is not provided by jQuery AJAX?

Answer

Correct Answer: finish

Note: This Question is unanswered, help us to find answer for this one

70.

Which of the following are valid for addEventListener() method?

Answer

Correct Answer: All of the above

Note: This Question is unanswered, help us to find answer for this one

71.

This __ event tells the browser to call the checkUsername() function when the user leaves the username field on the form.

Answer

Correct Answer: onblur

Note: This Question is unanswered, help us to find answer for this one

72.

.................... stores a function (or the name of a function) to be called automatically each time the readyState property changes.

Answer

Correct Answer: onreadystatechange

Note: This Question is unanswered, help us to find answer for this one

74.

If an AJAX request made using jQuery fails,

Answer

Correct Answer: the programmer should arrange for it to be reported using the jQuery .fail() method

Note: This Question is unanswered, help us to find answer for this one

75.

How does Crockford's json2.js libary support Graceful Degradation?

Answer

Correct Answer: Crockford's JSON library will only define JSON.stringify and JSON.parse if they're not already defined, leaving any browser native implementation intact.

Note: This Question is unanswered, help us to find answer for this one

76.

Choose the most correct statement to describe Graceful Degradation.

Answer

Correct Answer: A design that allows web pages to be available in a basic functional format for limited-capability web browsers

Note: This Question is unanswered, help us to find answer for this one

77.

Which of the following are HTTP request headers?

Answer

Correct Answer: Accept-Charset
Authorization
Referrer

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

78.

Which of the following is not a callback hooks provided by $.ajax()?

Answer

Correct Answer: failure

Note: This Question is unanswered, help us to find answer for this one

79.

What is the difference between XMLHttpRequest and ActiveXObject? variable = new XMLHttpRequest(); variable = new ActiveXObject("Microsoft.XMLHTTP");

Answer

Correct Answer: ActiveXObject is for old browser such as IE5, IE6, XMLHttpRequest is for modern browser

Note: This Question is unanswered, help us to find answer for this one

80.

How many status of the XMLHttpRequest are there?

Answer

Correct Answer: Five : from 0 to 4

Note: This Question is unanswered, help us to find answer for this one

81.

Which of the following JavaScript DOM traversal method works with an XML Document object?

Answer

Correct Answer: getElementsByTagName

Note: This Question is unanswered, help us to find answer for this one

82.

Which of the following JavaScript DOM traversal methods work with an XML Document object?

Answer

Correct Answer: getElementsByTagName

Note: This Question is unanswered, help us to find answer for this one

83.

To get a list of all elements with class="intro" which of the following can be used?

Answer

Correct Answer: document.querySelectorAll("p.intro");

Note: This Question is unanswered, help us to find answer for this one

84.

__ function returns a JavaScript object that represents an XHTML element

Answer

Correct Answer: getElementById()

Note: This Question is unanswered, help us to find answer for this one

85.

To prevent DOM based XSS attacks when JSON is returned in response, which of the following is not correct?

Answer

Correct Answer: Use the eval() function to parse JSON.

Note: This Question is unanswered, help us to find answer for this one

86.

Which of the answer is correct to send following data with request?

var requestData = "username=" + escape(document.getElementById("username").value) + "&password=" + escape(document.getElementById("password1").value) + "&firstname=" + escape(document.getElementById("firstname").value) + "&lastname=" + escape(document.getElementById("lastname").value) + "&email=" + escape(document.getElementById("favorite").value);

Answer

Correct Answer: abcRequest.open("POST", url, true); abcRequest.send(requestData);

Note: This Question is unanswered, help us to find answer for this one

87.

LiveWire JavaScript is also called server-side _____.

Answer

Correct Answer: JavaScript

Note: This Question is unanswered, help us to find answer for this one

88.

Which of the following is not a valid XMLHttpRequest Property?

Answer

Correct Answer: requestText

Note: This Question is unanswered, help us to find answer for this one

89.

Which of the following readyState Object Status is not correct?

Answer

Correct Answer: 0 = initialized

Note: This Question is unanswered, help us to find answer for this one

90.

Which of the following methods are available for XMLHttpRequest?

Answer

Correct Answer: getResponseHeader(headerName)
open(method, URL)
open(method, URL, async, username, password)

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

91.

The jQuery AJAX methods .get(), .post(), and .ajax() all require which parameter to be supplied?

Answer

Correct Answer: url

Note: This Question is unanswered, help us to find answer for this one

92.

How to perform a synchronous AJAX request in jQuery?

Answer

Correct Answer: In AJAX request, set async: false

Note: This Question is unanswered, help us to find answer for this one

93.

True or False: By default, all AJAX requests are sent asynchronously.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

94.

If something goes wrong at the server __ property of request object tell us about it.

Answer

Correct Answer: status

Note: This Question is unanswered, help us to find answer for this one

95.

Can an AJAX response set a cookie?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

96.

Which of the following JavaScript object performs asynchronous interaction with the server?

Answer

Correct Answer: XMLHttpRequest

Note: This Question is unanswered, help us to find answer for this one

97.

Which of the following XMLHttpRequest properties are correct?

Answer

Correct Answer: readyState
responseText
statusText

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

98.

Which of the following is not a valid data type that AJAX expects to get from server?

Answer

Correct Answer: sql

Note: This Question is unanswered, help us to find answer for this one

99.

A callback function is a function passed as a parameter to another function.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

100.

Which of the following is true about callback function?

Answer

Correct Answer: A callback function is a function that is executed when something else finishes.
In Ajax, it’s the function that’s called when the server responds to a request object. The browser “calls back” that function at a certain time.

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

101.

True or False: If $.ajax() is called with the global option set to false, the $.ajaxStart() method will not fire.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

102.

AJAX has become very commonly used because

Answer

Correct Answer: it allows page content to be updated without requiring a full page reload

Note: This Question is unanswered, help us to find answer for this one

103.

Which option should be set in jQuery AJAX call to send a DOMDocument?

Answer

Correct Answer: set processData to false

Note: This Question is unanswered, help us to find answer for this one

104.

Which of the following are XMLHttpRequest object methods?

Answer

Correct Answer: send()
open()

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

105.

Do AJAX requests retain session information?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

106.

Which of the following is a feature of AJAX?

Answer

Correct Answer: All of the above

Note: This Question is unanswered, help us to find answer for this one

107.

What will be XMLHttpRequest object 'status' when page was not found?

Answer

Correct Answer: 404

Note: This Question is unanswered, help us to find answer for this one

108.

Which is true about jQuery.post() method?

Answer

Correct Answer: Load data from the server using an HTTP POST request

Note: This Question is unanswered, help us to find answer for this one

109.

Which of the following function is used to return specific header information from the server response?

Answer

Correct Answer: getResponseHeader()

Note: This Question is unanswered, help us to find answer for this one

110.

Full form of AJAX is

Answer

Correct Answer: Asynchronous JavaScript and XML

Note: This Question is unanswered, help us to find answer for this one

111.

Complete the following sentence. Using AJAX we can make our web page ___.

Answer

Correct Answer: interactive and faster

Note: This Question is unanswered, help us to find answer for this one

112.

Which of the following is true about onreadystatechange?

Answer

Correct Answer: onreadystatechange is a function to be called automatically each time the readyState property changes

Note: This Question is unanswered, help us to find answer for this one

113.

In Javascript, which of the following events can we set?

Answer

Correct Answer: onabort
ondblclick
onresize

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

114.

Which of the following objects can be accessed from JavaScript code?

Answer

Correct Answer: document
history
window
XMLHttpRequest 

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

115.

What is the correct syntax to include a script named myScript.js into a page?

Answer

Correct Answer: <script src="myScript.js">

Note: This Question is unanswered, help us to find answer for this one

116.

Is JavaScript the same as Java?

Answer

Correct Answer: no

Note: This Question is unanswered, help us to find answer for this one

117.

If the code is written using the Core Foundation and Foundation macros, the simplest way to create strings files is:

Answer

Correct Answer: By using the genstrings command-line tool.

Note: This Question is unanswered, help us to find answer for this one

118.

What is the common way to make a request with XMLHttpRequest?

Answer

Correct Answer: myReq.send(null);

Note: This Question is unanswered, help us to find answer for this one

119.

What language does AJAX use on the client side?

Answer

Correct Answer: JavaScript

Note: This Question is unanswered, help us to find answer for this one

120.

Which of the following is not a JavaScript operator?

Answer

Correct Answer: All of the above are Javascript operators

Note: This Question is unanswered, help us to find answer for this one

121.

document.write ("Hello");  will pop a dialog box with "Hello" in it.

Answer

Correct Answer: false

Note: This Question is unanswered, help us to find answer for this one

122.

In the following list, which states are valid?
XMLHttpRequest.readyState

Answer

Correct Answer: All of the above.

Note: This Question is unanswered, help us to find answer for this one

123.

The server returns data to the client during an AJAX postback. Which of the following is correct about the returned data?

Answer

Correct Answer: It contains the data of the whole page

Note: This Question is unanswered, help us to find answer for this one

124.

What is the correct syntax to create an array in JavaScript?

Answer

Correct Answer: var array = [];

Note: This Question is unanswered, help us to find answer for this one

125.

Which language does AJAX use on the server side?

Answer

Correct Answer: Any language supported by the server

Note: This Question is unanswered, help us to find answer for this one

126.

What should be called before 'send ()' to prepare an XMLHttpRequest object?

Answer

Correct Answer: open ()

Note: This Question is unanswered, help us to find answer for this one

127.

Can a client AJAX application be used to fetch and execute some JavaScript code?

Answer

Correct Answer: yes

Note: This Question is unanswered, help us to find answer for this one

128.

Can an AJAX application communicate with other applications on the client computer?

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

129.

Is it possible to make some system calls on the client with AJAX?

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

130.

Is it possible to access the browser cookies from a javascript application?

Answer

Correct Answer: yes

Note: This Question is unanswered, help us to find answer for this one

131.

Is the loading of an AJAX enabled web page any different from the loading of a normal page?

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

132.

Does JavaScript 1.5 have exception handling?

Answer

Correct Answer: no

Note: This Question is unanswered, help us to find answer for this one

133.

What is the third (async) parameter of the XMLHttpRequest open method?

Answer

Correct Answer: If true, the send method returns immediately
If true, the send method returns immediately

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

134.

When may asynchronous requests be used?

Answer

Correct Answer: All of the above

Note: This Question is unanswered, help us to find answer for this one

135.

Which of the following browsers provide XMLHttpRequest property?

Answer

Correct Answer: Internet Explorer 7

Note: This Question is unanswered, help us to find answer for this one

136.

Is it possible to create and manipulate an image on the client with AJAX?

Answer

Correct Answer: yes

Note: This Question is unanswered, help us to find answer for this one

137.

Can AJAX be used to move files on the client-side?

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

138.

Which of the following are drawbacks of AJAX?

Answer

Correct Answer: The browser back button cannot be used in most cases

Note: This Question is unanswered, help us to find answer for this one

139.

Which of the following status codes denotes a server error?

Answer

Correct Answer: 501

Note: This Question is unanswered, help us to find answer for this one

140.

Is it always possible to make requests to multiple websites with different domain names from an AJAX client script?

Answer

Correct Answer: no

Note: This Question is unanswered, help us to find answer for this one

141.

It might be needed to set the request content-type to XML explicitly. How can you do so for an XMLHttpRequest Object?

Answer

Correct Answer: myReq.setRequestHeader ("Content-Type", "text/xml");

Note: This Question is unanswered, help us to find answer for this one

142.

Which of the following is a block comment in JavaScript?

Answer

Correct Answer: /* */

Note: This Question is unanswered, help us to find answer for this one

143.

Can AJAX be used with offline pages?

Answer

Correct Answer: yes

Note: This Question is unanswered, help us to find answer for this one

144.

Which of the following is/are true regarding AJAX?

Answer

Correct Answer: Which of the following is/are true regarding AJAX?

Note: This Question is unanswered, help us to find answer for this one

145.

What is the correct way to execute the function "calc()" when an XMLHttpRequest is loaded?

Answer

Correct Answer: myRequest.onreadystatechange = calc;

Note: This Question is unanswered, help us to find answer for this one

146.

When doing an AJAX request, will the page be scrolled back to top as with normal requests?

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

147.

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

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

148.

Which attribute of the SCRIPT tag can be used to hold the JavaScript version?

Answer

Correct Answer: LANGUAGE

Note: This Question is unanswered, help us to find answer for this one

149.

Which of the following cannot be resolved by using AJAX?

Answer

Correct Answer: None of the above

Note: This Question is unanswered, help us to find answer for this one

150.

Which of the following is not a valid variable name in JavaScript?

Answer

Correct Answer: 2myVar

Note: This Question is unanswered, help us to find answer for this one

151.

Which of the following is/are not addressed by AJAX?

Answer

Correct Answer: Offline browsing

Note: This Question is unanswered, help us to find answer for this one

152.

When a user views a page with JavaScript in it, which machine executes the script?

Answer

Correct Answer: The client machine running the Web Browser

Note: This Question is unanswered, help us to find answer for this one

153.

Which of the following request types should be used with AJAX?

Answer

Correct Answer: HTTP GET request for retrieving data (which will not change for that URL)

Note: This Question is unanswered, help us to find answer for this one

154.

What is true regarding XMLHttpRequest.abort()?

Answer

Correct Answer: It can only be used with async requests

Note: This Question is unanswered, help us to find answer for this one

155.

Can WebDav methods like PROPFIND be used with XMLHttpRequest.open()?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

156.

The X in AJAX refers to XML, but is it possible to make a request for plain text data by using AJAX?

Answer

Correct Answer: yes

Note: This Question is unanswered, help us to find answer for this one

157.

Is it possible to make a page "reload-safe" when using AJAX?

Answer

Correct Answer: yes, if each AJAX request modifies the server side context, which would render a page similar to the actual JS modified page, if reloaded.

Note: This Question is unanswered, help us to find answer for this one

158.

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>

Answer

Correct Answer: var myDiv = document.getElementById ("statusCode"); myDiv.innerHTML = req.status;

Note: This Question is unanswered, help us to find answer for this one

159.

Can an HTML form be sent with AJAX?

Answer

Correct Answer: yes

Note: This Question is unanswered, help us to find answer for this one

160.

What is NOSCRIPT tag for?

Answer

Correct Answer: To enclose text to be displayed if the browser doesn't support JS

Note: This Question is unanswered, help us to find answer for this one

161.

which of the following list is/are true regarding AJAX?

Answer

Correct Answer: It can only be implemented with the XMLHttpRequest object

Note: This Question is unanswered, help us to find answer for this one

162.

How can you create an XMLHttpRequest under Internet Explorer 6?

Answer

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

Note: This Question is unanswered, help us to find answer for this one

163.

Can AJAX be used with PHP?

Answer

Correct Answer: yes

Note: This Question is unanswered, help us to find answer for this one

164.

Which of the following navigator properties is the same in both Netscape and IE?

Answer

Correct Answer: navigator.appCodeName

Note: This Question is unanswered, help us to find answer for this one

165.

In the following list, which ones are used to fetch the result data of an XMLHttpRequest?

Answer

Correct Answer: responseBody

Note: This Question is unanswered, help us to find answer for this one

166.

Javascript uses static bindings.

Answer

Correct Answer: false

Note: This Question is unanswered, help us to find answer for this one

167.

Which of the following describes the term 'Asynchronous' correctly?

Answer

Correct Answer: Ability to handle processes independently from other processes

Note: This Question is unanswered, help us to find answer for this one

168.

Can you start multiple threads with JavaScript?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

169.

Can AJAX be used with HTTPS (SSL)?

Answer

Correct Answer: yes

Note: This Question is unanswered, help us to find answer for this one

170.

What is the standardized name of JavaScript?

Answer

Correct Answer: ECMAScript

Note: This Question is unanswered, help us to find answer for this one

171.

The format of an HTTP request is given below:

<request-line>
<headers>
<blank line>
[<request-body>]

Which of the following is not passed in the request-line?

Answer

Correct Answer: Browser name

Note: This Question is unanswered, help us to find answer for this one

172. What is the 1st method that is fired during the page load?

Answer

Correct Answer: Init()

Note: This Question is unanswered, help us to find answer for this one

173. How many types of triggers are present in update panel?

Answer

Correct Answer: 2

Note: This Question is unanswered, help us to find answer for this one

174. In non-IE browsers, what attribute should you check your XMLHttpRequest object for in order to see if it supports CORS?

Answer

Correct Answer: withCredentials

Note: This Question is unanswered, help us to find answer for this one

175. What is the value of the response property of XMLHttpRequest object if readyState property equal to 3?

Answer

Correct Answer: null

Note: This Question is unanswered, help us to find answer for this one

176. Sending asynchronous requests is a huge improvement for web developers. Many of the tasks performed on the server are very time consuming. Before AJAX, this operation could cause the application to hang or stop. so, what is the best way to be done by web developers when sending asynchronous requests?

Answer

Correct Answer: execute other scripts while waiting for server response

Note: This Question is unanswered, help us to find answer for this one

177. Which property of the popstate event contains a copy of the history entry's state object?

Answer

Correct Answer: state

Note: This Question is unanswered, help us to find answer for this one

178. When receiving an image from the server, the responseType attribute of your XMLHttpRequest object must be set to:

Answer

Correct Answer: "arraybuffer" or "blob"

Note: This Question is unanswered, help us to find answer for this one

179. What HTML attribute would you use to indicate to a screenreader that an element of the page may update (for example, by using Ajax) while out of the user's focus?

Answer

Correct Answer: aria-live

Note: This Question is unanswered, help us to find answer for this one

180. How does JSONP work?

Answer

Correct Answer: It makes server response text act like an injected <script> element

Note: This Question is unanswered, help us to find answer for this one

181. What XMLHttpRequest method is used to override MIME type returned by the server?

Answer

Correct Answer: overrideMimeType()

Note: This Question is unanswered, help us to find answer for this one

182. How do you detect errors in Ajax REQUESTS?

Answer

Correct Answer: the onerror event

Note: This Question is unanswered, help us to find answer for this one

183. You've created an XMLHttpRequest object, xhr, and properly called open as well as send on the object. When you check xhr.status and it's 0 and your responseText is null. What's the most likely explanation of what happened?

Answer

Correct Answer: Your request was canceled either due to a failed connection or a user action.

Note: This Question is unanswered, help us to find answer for this one

184. What value of the XMLHttpRequest object's readystate attribute indicates that the response data (i.e. not the headers) is currently being sent back from the server?

Answer

Correct Answer: 3

Note: This Question is unanswered, help us to find answer for this one

185. What HTTP response header is expected in reply to a CORS request?

Answer

Correct Answer: Access-Control-Allow-Origin

Note: This Question is unanswered, help us to find answer for this one

186. You're issuing a request to "/resource" using XMLHttpRequest (xhr) where the server returns a 301 or 302 status code, what happens?

Answer

Correct Answer: The XHR object will automatically and transparently follow the redirects to the new location for the resource, unless it's on a different domain.

Note: This Question is unanswered, help us to find answer for this one

187. Ajax is frequently expanded as "asynchronous JavaScript and XML," which is misleading. Which of these words is not central to Ajax's functionality?

Answer

Correct Answer: asynchronous and XML

Note: This Question is unanswered, help us to find answer for this one

188. What arguments MUST be supplied to an XMLHttpRequest object's .open() method, and in what order?

Answer

Correct Answer: HTTP method as string, URL as string

Note: This Question is unanswered, help us to find answer for this one

189. What happens if an Ajax call completes (and calls its callback function) when other JavaScript is currently running?

Answer

Correct Answer: The Ajax callback function will be queued until the currently-running code completes

Note: This Question is unanswered, help us to find answer for this one

190. Which of these is NOT an advantage of using Ajax over server-side processing?

Answer

Correct Answer: Cross-browser compatibility

Note: This Question is unanswered, help us to find answer for this one

191. After a request completes, which property of the XMLHttpRequest object can be used to retrieve a DOM representation of a remote XML document?

Answer

Correct Answer: responseXML

Note: This Question is unanswered, help us to find answer for this one

192. Your cross-origin Ajax request is causing your console to throw the error "Resource interpreted as Script but transferred with MIME type application/json. Uncaught SyntaxError: Unexpected token :" What might be happening?

Answer

Correct Answer: The server is returning an unencapsulated JSON object which is being executed as JSONP

Note: This Question is unanswered, help us to find answer for this one

193. According to the W3C specification, which HTTP methods should throw a security exception when used with XMLHttpRequest?

Answer

Correct Answer: CONNECT, TRACE, or TRACK

Note: This Question is unanswered, help us to find answer for this one

194. What is the technical limitation to implementing user login entirely on the client side using Ajax?

Answer

Correct Answer: Client-side code is inherently insecure

Note: This Question is unanswered, help us to find answer for this one

195. Which readystate value indicates the response has been fully received from the asynchronous request?

Answer

Correct Answer: 4 (readystate complete)

Note: This Question is unanswered, help us to find answer for this one

196. How would you configure a *synchronous* GET request to "/resource" after instantiating a new XMLHttpRequest object: var xhr = new XMLHttpRequest();?

Answer

Correct Answer: xhr.open("GET", "/resource", false);

Note: This Question is unanswered, help us to find answer for this one

197. What is the proper way to execute a callback function while making a "synchronous" request?

Answer

Correct Answer: Callback functions are used with "asynchronous" requests only

Note: This Question is unanswered, help us to find answer for this one

198. How does Google recommend you make an Ajax-dependent page accessible to their web crawler?

Answer

Correct Answer: Use Ajax to progressively enhance server-side processing, rather than to replace it

Note: This Question is unanswered, help us to find answer for this one

199. What is the syntax for the event listener that monitors whether the XMLHttpRequest object's readyState attribute has changed?

Answer

Correct Answer: onreadystatechange

Note: This Question is unanswered, help us to find answer for this one

200. How can you load JavaScript from a different file into your web application?

Answer

Correct Answer: All of these

Note: This Question is unanswered, help us to find answer for this one

201. What is XSS?

Answer

Correct Answer: Malicious client-side code injection

Note: This Question is unanswered, help us to find answer for this one

202. What is the CORS-enabled Ajax request object constructor in IE8-9?

Answer

Correct Answer: new XDomainRequest();

Note: This Question is unanswered, help us to find answer for this one

203. What does CORS stand for?

Answer

Correct Answer: Cross-origin resource sharing

Note: This Question is unanswered, help us to find answer for this one

204. What is the name of the object which provides CORS support in Internet Explorer 8 and Internet Explorer 9?

Answer

Correct Answer: XDomainRequest

Note: This Question is unanswered, help us to find answer for this one

205. What's wrong with the following code? function check_for_request_done() { if (xhr.readyState == 4) { clearInterval(timer); do_something_with_result(xhr); } } var xhr = new XMLHttpRequest(); xhr.open("GET", "/resource", true); xhr.send(); var timer = setInterval(check_for_request_done, 100);

Answer

Correct Answer: This code is polling a timer rather using the onreadystatechange event to check the state of the async request.

Note: This Question is unanswered, help us to find answer for this one

206. If the server is expecting JSON-formatted information in the request, what code will turn the JavaScript object dataToSend into data you can send to the server (consider modern browsers only, including IE8 and above)?

Answer

Correct Answer: JSON.stringify(dataToSend);

Note: This Question is unanswered, help us to find answer for this one

207. How will the response be parsed if responseType is set to "document" and the request has been made asynchronously?

Answer

Correct Answer: as text/html

Note: This Question is unanswered, help us to find answer for this one

208. AJAX applications are browser- and platform-dependent!

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

209. Can you perform file uploads using AJAX requests alone?

Answer

Correct Answer: Yes, but only when using newer browsers and HTML5 features.

Note: This Question is unanswered, help us to find answer for this one

210. Can you make an XMLHttpRequest asynchronous call to a page on a different top level domain from the current page's top level domain?

Answer

Correct Answer: In newer browsers cross-domain requests can be configured but only when servers use special headers to explicitly allow some cross domain requests.

Note: This Question is unanswered, help us to find answer for this one

211. True or false? Ajax can be used to open a connection from the server to the browser without the browser making an explicit request.

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

212. What does JSON do?

Answer

Correct Answer: A data serialization and interchange format using a subset of JavaScript syntax

Note: This Question is unanswered, help us to find answer for this one

213. Can an XMLHttpRequest object be used to receive binary data?

Answer

Correct Answer: Yes, in newer browsers using the responseType property and in older browsers by overriding the mime type of the response.

Note: This Question is unanswered, help us to find answer for this one

214. Most JavaScript libraries that provide AJAX support include this header in AJAX requests by default.

Answer

Correct Answer: X-Requested-With: XMLHttpRequest

Note: This Question is unanswered, help us to find answer for this one

215. How do you manually abort an Ajax request after a certain amount of time?

Answer

Correct Answer: Using setTimeout(), clearTimeout() and .abort()

Note: This Question is unanswered, help us to find answer for this one

216. Ajax can be used to open a connection from the server to the browser without the browser making an explicit request.

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

217. True or false? A GET request submitted through Ajax can never cause the server to delete data.

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

218. 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?

Answer

Correct Answer: JSON.parse(returnedData);

Note: This Question is unanswered, help us to find answer for this one

219. The onreadystatechange change event is used to invoke behavior when

Answer

Correct Answer: the status of the asynchronous request changes.

Note: This Question is unanswered, help us to find answer for this one

220. What is the value of the "status" attribute of the completed XMLHttpRequest object if the Ajax request has pulled the response data from the browser cache? Consider only non-IE browsers.

Answer

Correct Answer: 200

Note: This Question is unanswered, help us to find answer for this one

221. Which method on the XMLHttpRequest object is used to send custom HTTP headers with a request?

Answer

Correct Answer: setRequestHeader

Note: This Question is unanswered, help us to find answer for this one

222. The primary benefit of using AJAX techniques in a web application is:

Answer

Correct Answer: It allows web applications to send asynchronous data requests to a server without a user initiated page load.

Note: This Question is unanswered, help us to find answer for this one

223. What are the advantages of using JavaScript libraries (like jQuery) to implement Ajax?

Answer

Correct Answer: Better cross-browser compatibility and faster speed of development

Note: This Question is unanswered, help us to find answer for this one

224. In standard JavaScript, what makes asynchronous execution of Ajax calls possible?

Answer

Correct Answer: Events and callbacks

Note: This Question is unanswered, help us to find answer for this one

225. What does the acronym "blob" stand for when referring to data types?

Answer

Correct Answer: binary large object

Note: This Question is unanswered, help us to find answer for this one

226. Which HTML5 feature can improve the experience of a user using the "back" and "forward" buttons when using AJAX techniques?

Answer

Correct Answer: The history API with pushState, replaceState and history events.

Note: This Question is unanswered, help us to find answer for this one

227. What is the preferred method for maintaining back/forward button and crawler functionality in Ajax-driven web applications?

Answer

Correct Answer: history.pushState()

Note: This Question is unanswered, help us to find answer for this one

228. For the "same origin policy" to always allow an Ajax request, what attributes must be the same between the requesting context and the server?

Answer

Correct Answer: Domain name, protocol, and port

Note: This Question is unanswered, help us to find answer for this one

229. What is the purpose of Ajax long-polling?

Answer

Correct Answer: To keep a server connection open for two-way communication

Note: This Question is unanswered, help us to find answer for this one

230. What is the difference between the XMLHttpRequest object's .status and .statusText attributes?

Answer

Correct Answer: .status returns a numeric-only code instead of the full HTTP response, which can be found in .statusText

Note: This Question is unanswered, help us to find answer for this one

231. Is it possible to add custom HTTP header to ajax request?

Answer

Correct Answer: Yes, it is possible. setRequestHeader() method of XMLHttpRequest object can be used to add a custom HTTP header

Note: This Question is unanswered, help us to find answer for this one

232. Which of the HTTP actions is an Ajax XML HTTP request capable of sending to a server?

Answer

Correct Answer: GET, POST, PUT, and DELETE

Note: This Question is unanswered, help us to find answer for this one

233. Which protocol is used to transfer data in an AJAX request?

Answer

Correct Answer: Hypertext Transfer Protocol, HTTP

Note: This Question is unanswered, help us to find answer for this one