Wednesday, May 9, 2018

Upwork AJAX Test

1. Which of the following is/are true regarding AJAX?
Answers:
• 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

2. Which of the following browsers provide XMLHttpRequest property?
Answers:
• Internet Explorer 5
• Internet Explorer 6
• Internet Explorer 7
• Firefox 2.0
• Safari 3.0
3. What is true regarding XMLHttpRequest.abort()?
Answers:
• 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 (aborted)
• None of the above
4. What is the third (async) parameter of the XMLHttpRequest open method?
Answers:
• 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
5. What is the correct way to have the function checkState called after 10 seconds?
Answers:
• window.setTimeout(checkState, 10);
• window.setTimeout(checkState, 10000);
• window.setTimeout(checkState(), 10);
• None of the above
6. document.write ("Hello");  will pop a dialog box with "Hello" in it.
Answers:
• true
• false
7. 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?
Answers:
• Type of request
• Resource to access
• Version of HTTP
• Browser name
• None of the above
8. Is it possible to make a page "reload-safe" when using AJAX?
Answers:
• 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.
9. How can you create an XMLHttpRequest under Internet Explorer 6?
Answers:
• var oReq = new XMLHttpRequest ();
• var oReq = new ActiveXObject ("MSXML2.XMLHTTP.3.0");
• var oReq = new IEHttpRequest ("XML");
• None of the above
10. The X in AJAX refers to XML, but is it possible to make a request for plain text data by using AJAX?
Answers:
• yes
• no
11. In the following list, which ones are used to fetch the result data of an XMLHttpRequest?
Answers:
• responseData
• responseBody
• responseString
• responseText
• responseXML
12. Is it possible to create and manipulate an image on the client with AJAX?
Answers:
• yes
• no
13. Is it always possible to make requests to multiple websites with different domain names from an AJAX client script?
Answers:
• yes
• no
14. Is it possible to make some system calls on the client with AJAX?
Answers:
• Yes
• No
15. Is the loading of an AJAX enabled web page any different from the loading of a normal page?
Answers:
• No
• Yes
16. 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>
Answers:
• 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.statusCode);
• var myDiv = document.getElementById ("statusCode"); myDiv.status = req.status;
• None of the above
17. Which HTTP server does AJAX require?
Answers:
• Apache
• Sun application server
• lighttpd
• Microsoft web server
• Any HTTP server will work
18. Which of the following is a block comment in JavaScript?
Answers:
• <!-- -->
• /* */
• //
• #
• --[[ ]]
19. It might be needed to set the request content-type to XML explicitly. How can you do so for an XMLHttpRequest Object?
Answers:
• myReq.setContentType ("text/xml");
• myReq.contentType = "text/xml";
• myReq.overrideContentType ("xml");
• myReq.contentType = "xml";
• myReq.setRequestHeader ("Content-Type", "text/xml");
20. Does JavaScript 1.5 have exception handling?
Answers:
• yes
• no
21. Which of the following cannot be resolved by using AJAX?
Answers:
• Partial page processing
• Unresponsiveness of web pages
• Server side communication initiation
• Server crashes (failover)
• None of the above
22. Can AJAX be used with HTTPS (SSL)?
Answers:
• yes
• no
23. Which of the following list is/are true regarding AJAX?
Answers:
• 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 (async)
• It requires a special AJAX enabled web server
• It cannot be used under Internet Explorer
24. Can WebDav methods like PROPFIND be used with XMLHttpRequest.open()?
Answers:
• Yes
• No
25. Which of the following request types should be used with AJAX?
Answers:
• 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
26. When may asynchronous requests be used?
Answers:
• 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
27. Can AJAX be used with offline pages?
Answers:
• yes
• no
28. Is it possible to access the browser cookies from a javascript application?
Answers:
• yes
• no
29. Can a client AJAX application be used to fetch and execute some JavaScript code?
Answers:
• yes
• no
30. Which of the following is not a JavaScript operator?
Answers:
• new
• delete
• this
• typeof
• All of the above are Javascript operators
31. The server returns data to the client during an AJAX postback. Which of the following is correct about the returned data?
Answers:
• 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
32. When doing an AJAX request, will the page be scrolled back to top as with normal requests?
Answers:
• Yes
• No
33. What language does AJAX use on the client side?
Answers:
• JavaScript
• AppleScript
• PHP
• Ruby
• Java
34. Can AJAX be used with PHP?
Answers:
• yes
• no
35. Javascript uses static bindings.
Answers:
• true
• false
36. Which of the following is not a valid variable name in JavaScript?
Answers:
• _my_var
• 2myVar
• MY_VAR
• __MyVar2__
• All are valid
37. Is JavaScript the same as Java?
Answers:
• yes
• no
38. What is NOSCRIPT tag for?
Answers:
• 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
39. In the following list, which states are valid?

XMLHttpRequest.readyState
Answers:
• 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.
40. What is the standardized name of JavaScript?
Answers:
• Java
• NetscapeScript
• ECMAScript
• XMLScript
• WebScript
41. Which language does AJAX use on the server side?
Answers:
• JavaScript
• PHP
• Java
• Ruby
• Any language supported by the server
42. Which of the following is/are not addressed by AJAX?
Answers:
• Partial page update
• Offline browsing
• Server side scripting
• All of the above
43. Which of the following are drawbacks of AJAX?
Answers:
• 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
44. What is the correct way to execute the function "calc()" when an XMLHttpRequest is loaded?
Answers:
• myRequest.onreadystatechange = calc;
• myRequest.onload = calc;
• myRequest.execute = calc;
• myRequest.addCallback (calc, "loaded");
• None of the above
45. Can an HTML form be sent with AJAX?
Answers:
• yes
• no
46. What is the correct syntax to create an array in JavaScript?
Answers:
• var array = Array.new;
• var array = [];
• var array = new Array;
• var array = new Array ();
• None of the above
47. Can you call responseBody or responseText to get a partial result when the readyState of an XMLHttpRequest is 3(receiving)?
Answers:
• Yes
• No
48. Can an AJAX application communicate with other applications on the client computer?
Answers:
• Yes
• No
49. Which of the following describes the term 'Asynchronous' correctly?
Answers:
• 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
50. What is the correct syntax to include a script named myScript.js into a page?
Answers:
• <script href="myScript.js">
• <script name="myScript.js">
• <script src="myScript.js">
• <script root="myScript.js">