Friday, January 6, 2017

Upwork AJAX Test 2016


1. Which of the following is/are true regarding AJAX?
Answers:
  1. It’s an engine developed by Microsoft to load web pages faster
  2. It’s merely a concept with many implementation methods (XMLHttpRequest, iFrames…)
  3. It’s a server side scripting language used to serve partial parts of a webpage
  4. It’s a good way to reduce network traffic, if used correctly
  5. None of the above
2. Which of the following browsers provide XMLHttpRequest property?
Answers:
  1. Internet Explorer 5
  2. Internet Explorer 6
  3. Internet Explorer 7
  4. Firefox 2.0
  5. Safari 3.0
3. What is true regarding XMLHttpRequest.abort()?
Answers:
  1. It can only be used with async requests
  2. It will remove the onreadystatechange event handler
  3. It will send an abort message to the remote server
  4. It changes readyState to 4 (aborted)
  5. None of the above
4. What is the third (async) parameter of the XMLHttpRequest open method?
Answers:
  1. If true, the request doesn’t return anything.
  2. If true, the javascript engine is blocked while making the request
  3. If true, the send method returns immediately
  4. If true, the request object is destroyed when ‘send’ is executed
  5. If true, callbacks are executed
5. What is the correct way to have the function checkState called after 10 seconds?
Answers:
  1. window.setTimeout(checkState, 10);
  2. window.setTimeout(checkState, 10000);
  3. window.setTimeout(checkState(), 10);
  4. None of the above
6. document.write (“Hello”); will pop a dialog box with “Hello” in it.
Answers:
  1. true
  2. 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:
  1. Type of request
  2. Resource to access
  3. Version of HTTP
  4. Browser name
  5. None of the above
8. Is it possible to make a page “reload-safe” when using AJAX?
Answers:
  1. no
  2. 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:
  1. var oReq = new XMLHttpRequest ();
  2. var oReq = new ActiveXObject (“MSXML2.XMLHTTP.3.0”);
  3. var oReq = new IEHttpRequest (“XML”);
  4. 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:
  1. yes
  2. no
11. In the following list, which ones are used to fetch the result data of an XMLHttpRequest?
Answers:
  1. responseData
  2. responseBody
  3. responseString
  4. responseText
  5. responseXML
12. Is it possible to create and manipulate an image on the client with AJAX?
Answers:
  1. yes
  2. no
13. Is it always possible to make requests to multiple websites with different domain names from an AJAX client script?
Answers:
  1. yes
  2. no
14. Is it possible to make some system calls on the client with AJAX?
Answers:
  1. Yes
  2. No
15. Is the loading of an AJAX enabled web page any different from the loading of a normal page?
Answers:
  1. No
  2. 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:
  1. var myDiv = document.getElementById (“statusCode”); myDiv.innerHTML = req.statusCode;
  2. var myDiv = document.getElementById (“statusCode”); myDiv.innerHTML = req.status;
  3. var myDiv = document.getElementById (“statusCode”); myDiv.setStatus (req.statusCode);
  4. var myDiv = document.getElementById (“statusCode”); myDiv.status = req.status;
  5. None of the above
17. Which HTTP server does AJAX require?
Answers:
  1. Apache
  2. Sun application server
  3. lighttpd
  4. Microsoft web server
  5. Any HTTP server will work
18. Which of the following is a block comment in JavaScript?
Answers:
  1. <!– –>
  2. /* */
  3. //
  4. #
  5. –[[ ]]
19. It might be needed to set the request content-type to XML explicitly. How can you do so for an XMLHttpRequest Object?
Answers:
  1. myReq.setContentType (“text/xml”);
  2. myReq.contentType = “text/xml”;
  3. myReq.overrideContentType (“xml”);
  4. myReq.contentType = “xml”;
  5. myReq.setRequestHeader (“Content-Type”, “text/xml”);
20. Does JavaScript 1.5 have exception handling?
Answers:
  1. yes
  2. no
21. Which of the following cannot be resolved by using AJAX?
Answers:
  1. Partial page processing
  2. Unresponsiveness of web pages
  3. Server side communication initiation
  4. Server crashes (failover)
  5. None of the above
22. Can AJAX be used with HTTPS (SSL)?
Answers:
  1. yes
  2. no
23. Which of the following list is/are true regarding AJAX?
Answers:
  1. It can only be implemented with the XMLHttpRequest object
  2. It can be used to update parts of a webpage without reloading it
  3. It can be used to make requests to the server without blocking the user (async)
  4. It requires a special AJAX enabled web server
  5. It cannot be used under Internet Explorer
24. Can WebDav methods like PROPFIND be used with XMLHttpRequest.open()?
Answers:
  1. Yes
  2. No
25. Which of the following request types should be used with AJAX?
Answers:
  1. HTTP GET request for retrieving data (which will not change for that URL)
  2. HTTP POST request for retrieving data (which will not change for that URL)
  3. HTTP GET should be used when the state is updated on the server
  4. HTTP POST should be used when the state is updated on the server
26. When may asynchronous requests be used?
Answers:
  1. To submit data to the server
  2. To retrieve data from the server
  3. To load additional code from the server
  4. To download an image
  5. All of the above
27. Can AJAX be used with offline pages?
Answers:
  1. yes
  2. no
28. Is it possible to access the browser cookies from a javascript application?
Answers:
  1. yes
  2. no
29. Can a client AJAX application be used to fetch and execute some JavaScript code?
Answers:
  1. yes
  2. no
30. Which of the following is not a JavaScript operator?
Answers:
  1. new
  2. delete
  3. this
  4. typeof
  5. 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:
  1. It only contains the data of the page elements that need to be changed
  2. It contains both the data of the whole page and the data that needs to be changed in separate blocks
  3. It contains the data of the whole page
  4. It may contain anything
  5. None of the above
32. When doing an AJAX request, will the page be scrolled back to top as with normal requests?
Answers:
  1. Yes
  2. No
33. What language does AJAX use on the client side?
Answers:
  1. JavaScript
  2. AppleScript
  3. PHP
  4. Ruby
  5. Java
34. Can AJAX be used with PHP?
Answers:
  1. yes
  2. no
35. Javascript uses static bindings.
Answers:
  1. true
  2. false
36. Which of the following is not a valid variable name in JavaScript?
Answers:
  1. _my_var
  2. 2myVar
  3. MY_VAR
  4. __MyVar2__
  5. All are valid
37. Is JavaScript the same as Java?
Answers:
  1. yes
  2. no
38. What is NOSCRIPT tag for?
Answers:
  1. To prevent the page scripts from executing
  2. To shield a part of a page from being modified by JS (like aDiv.innerHTML = ‘something’ has no effect)
  3. To enclose text to be displayed if the browser doesn’t support JS
  4. NOSCRIPT tag doesn’t exist
  5. None of the above
39. In the following list, which states are valid?
XMLHttpRequest.readyState
Answers:
  1. 0, The request is not initialized
  2. 1, The request has been set up
  3. 2, The request has been sent
  4. 3, The request is in process
  5. 4, The request is complete
  6. All of the above.
40. What is the standardized name of JavaScript?
Answers:
  1. Java
  2. NetscapeScript
  3. ECMAScript
  4. XMLScript
  5. WebScript
41. Which language does AJAX use on the server side?
Answers:
  1. JavaScript
  2. PHP
  3. Java
  4. Ruby
  5. Any language supported by the server
42. Which of the following is/are not addressed by AJAX?
Answers:
  1. Partial page update
  2. Offline browsing
  3. Server side scripting
  4. All of the above
43. Which of the following are drawbacks of AJAX?
Answers:
  1. The browser back button cannot be used in most cases
  2. It makes the server and client page representation synchronization more difficult
  3. It loads the server too much
  4. It’s not supported by older browsers
  5. It augments the used bandwidth significantly
44. What is the correct way to execute the function “calc()” when an XMLHttpRequest is loaded?
Answers:
  1. myRequest.onreadystatechange = calc;
  2. myRequest.onload = calc;
  3. myRequest.execute = calc;
  4. myRequest.addCallback (calc, “loaded”);
  5. None of the above
45. Can an HTML form be sent with AJAX?
Answers:
  1. yes
  2. no
46. What is the correct syntax to create an array in JavaScript?
Answers:
  1. var array = Array.new;
  2. var array = [];
  3. var array = new Array;
  4. var array = new Array ();
  5. 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:
  1. Yes
  2. No
48. Can an AJAX application communicate with other applications on the client computer?
Answers:
  1. Yes
  2. No
49. Which of the following describes the term ‘Asynchronous’ correctly?
Answers:
  1. Ability to handle processes independently from other processes
  2. Processes are dependent upon other processes
  3. Processes are not fully dependent on other processes
  4. None of the above
50. What is the correct syntax to include a script named myScript.js into a page?
Answers:
  1. <script href=”myScript.js”>
  2. <script name=”myScript.js”>
  3. <script src=”myScript.js”>
  4. <script root=”myScript.js”>
51. Consider the following function:
function foo ()
return 5;
}
What will the following code do?
var myVar = foo;
Answers:
  1. Assign the integer 5 to the variable myVar
  2. Assign the pointer to function foo to myVar
  3. Do nothing
  4. Throw an exception
  5. None of the above
52. What should be called before ‘send ()’ to prepare an XMLHttpRequest object?
Answers:
  1. prepare ()
  2. open ()
  3. init ()
  4. build ()
  5. None of the above
53. Can you start multiple threads with JavaScript?
Answers:
  1. Yes
  2. No
54. What is the common way to make a request with XMLHttpRequest?
Answers:
  1. myReq.request();
  2. myReq.get();
  3. myReq.post(null);
  4. myReq.send(null);
  5. myReq.sendRequest(null);
55. Can AJAX be used to move files on the client-side?
Answers:
  1. Yes
  2. No
56. Which of the following status codes denotes a server error?
Answers:
  1. 100
  2. 200
  3. 300
  4. 501
  5. 500
57. When a user views a page with JavaScript in it, which machine executes the script?
Answers:
  1. The client machine running the Web Browser
  2. The server serving the JavaScript
  3. A central JavaScript server like root DNS
  4. None of the above

No comments:

Post a Comment