Ajax Test Answers 2019


Share Ajax Test Answers

Posted on June 7, 2019


57 Test Questions:

1. Can AJAX be used with PHP?

• yes
• no

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

• Yes
• No

3. Consider the following function: function foo () { return 5; }
What will the following code do? var myVar = foo;

• Assign the integer 5 to the variable myVar
• Assign the pointer to function foo to myVar
• Do nothing
• Throw an exception
• None of the above

< h2 >4. Which of the following status codes denotes a server error?

• 100
• 200
• 300
• 501
• 500

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

• Yes
• No

6. Javascript uses static bindings.

• true
• false

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

• Yes
• No

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

• Yes
• No

9. Which HTTP server does AJAX require?

• Apache
• Sun application server
• lighttpd
• Microsoft web server
• Any HTTP server will work

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

• JavaScript
• AppleScript
• PHP
• Ruby
• Java

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

• myReq.setContentType («text/xml»);
• myReq.contentType = «text/xml»;
• myReq.overrideContentType («xml»);
• myReq.contentType = «xml»;
• myReq.setRequestHeader («Content-Type», «text/xml»);

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

• yes
• no

13. Does JavaScript 1.5 have exception handling?

• yes
• no

14. document.write («Hello»); will pop a dialog box with «Hello» in it.

• true
• false

< h2 >15. How can you create an XMLHttpRequest under Internet Explorer 6?

• var oReq = new XMLHttpRequest ();
• var oReq = new ActiveXObject («MSXML2.XMLHTTP.3.0»);
• var oReq = new IEHttpRequest («XML»);
• None of the above

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

• 0, The request is not initialized
• 1, The request has been set up
• 2, The request has been sent
• 3, The request is in process
• 4, The request is complete
• All of the above.

17. Is JavaScript the same as Java?

• yes
• no

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

• yes
• no

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

• yes
• no

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

• yes
• no

21. Is it possible to make a page «reload-safe» when using AJAX?

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

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

• Yes
• No

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

• No
• Yes

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

• yes
• no

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

• Type of request
• Resource to access
• Version of HTTP
• Browser name
• None of the above

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

• It only contains the data of the page elements that need to be changed
• It contains both the data of the whole page and the data that needs to be changed in separate blocks
• It contains the data of the whole page
• It may contain anything — раньше был этот
• None of the above

27. What is NOSCRIPT tag for?

• To prevent the page scripts from executing
• To shield a part of a page from being modified by JS (like aDiv.innerHTML = ‘something’ has no effect)
• To enclose text to be displayed if the browser doesn’t support JS
• NOSCRIPT tag doesn’t exist
• None of the above

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

• myReq.request();
• myReq.get();
• myReq.post(null);
• myReq.send(null);
• myReq.sendRequest(null);

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

• <script href=»myScript.js»>
• <script name=»myScript.js»>
• <script src=»myScript.js»>
• <script root=»myScript.js»>

< h2 >30. What is the correct way to execute the function «calc()» when an XMLHttpRequest is loaded?

• myRequest.onreadystatechange = calc;
• myRequest.onload = calc;
• myRequest.execute = calc;
• myRequest.addCallback (calc, «loaded»);
• None of the above

31. What is the third (asynс) parameter of the XMLHttpRequest open method?

• If true, the request doesn’t return anything.
• If true, the javascript engine is blocked while making the request
• If true, the send method returns immediately
• If true, the request object is destroyed when ‘send’ is executed
• If true, callbacks are executed

32. What should be called before ‘send ()’ to prepare an XMLHttpRequest object?

• prepare ()
• open ()
• init ()
• build ()
• None of the above

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

• The client machine running the Web Browser
• The server serving the JavaScript
• A central JavaScript server like root DNS
• None of the above

34. Which of the following are drawbacks of AJAX?

• The browser back button cannot be used in most cases
• It makes the server and client page representation synchronization more difficult
• It loads the server too much
• It’s not supported by older browsers
• It augments the used bandwidth significantly

35. Which of the following browsers provide XMLHttpRequest property?

• Internet Explorer 5
• Internet Explorer 6
• Internet Explorer 7
• Firefox 2.0
• Safari 3.0

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

• Partial page update
• Offline browsing
• Server side scripting
• All of the above

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

• Yes
• No

38. When may asynchronous requests be used?

• To submit data to the server
• To retrieve data from the server
• To load additional code from the server
• To download an image
• All of the above

39. Which language does AJAX use on the server side?

• JavaScript
• PHP
• Java
• Ruby
• Any language supported by the server

40. Which of the following cannot be resolved by using AJAX?

• Partial page processing
• Unresponsiveness of web pages
• Server side communication initiation
• Server crashes (failover)
• None of the above

41. Which of the following describes the term ‘Asynchronous’ correctly?

• Ability to handle processes independently from other processes
• Processes are dependent upon other processes
• Processes are not fully dependent on other processes
• None of the above

42. Which of the following is a block comment in JavaScript?

• <!— —>
• /* */
• //
• #
• —[[ ]]

43. Which of the following is not a JavaScript operator?

• new
• delete
• this
• typeof
• All of the above are Javascript operators

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

• _my_var
• 2myVar
• MY_VAR
• __MyVar2__
• All are valid

< h2 >45. 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>

• var myDiv = document.getElementById («statusCode»); myDiv.innerHTML = req.statusCode;
• var myDiv = document.getElementById («statusCode»); myDiv.innerHTML = req.status;
• var myDiv = document.getElementById («statusCode»); myDiv.setStatus (req.statusCod• ;
• var myDiv = document.getElementById («statusCode»); myDiv.status = req.status;
• None of the above

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

• responseData
• responseBody
• responseString
• responseText
• responseXML

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

• var array = Array.new;
• var array = [];
• var array = new Array;
• var array = new Array ();
• None of the above

48. What is true regarding XMLHttpRequest.abort()?

• It can only be used with async requests
• It will remove the onreadystatechange event handler
• It will send an abort message to the remote server
• It changes readyState to 4 (aborte•
• None of the above

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

• window.setTimeout(checkState, 10);
• window.setTimeout(checkState, 10000);
• window.setTimeout(checkState(), 10);
• None of the above

50. What is the standardized name of JavaScript?

• Java
• NetscapeScript
• ECMAScript
• XMLScript
• WebScript

51. Which of the following is/are true regarding AJAX?

• It’s an engine developed by Microsoft to load web pages faster
• It’s merely a concept with many implementation methods (XMLHttpRequest, iFrames…)
• It’s a server side scripting language used to serve partial parts of a webpage
• It’s a good way to reduce network traffic, if used correctly
• None of the above

52. Which of the following list is/are true regarding AJAX?

• It can only be implemented with the XMLHttpRequest object
• It can be used to update parts of a webpage without reloading it
• It can be used to make requests to the server without blocking the user (asyn•
• It requires a special AJAX enabled web server
• It cannot be used under Internet Explorer

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

• HTTP GET request for retrieving data (which will not change for that URL)
• HTTP POST request for retrieving data (which will not change for that URL)
• HTTP GET should be used when the state is updated on the server
• HTTP POST should be used when the state is updated on the server

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

• yes
• no

55. Can AJAX be used with offline pages?

• yes
• no

56. Can an HTML form be sent with AJAX?

• yes
• no

57. Can you start multiple threads with JavaScript?

• Yes
• No