Upwork Test Answers: Get all the correct answers of most recent and possible Upwork Tests A to Z (Updated on Jan, 2016)
Cover Letter Templates: These cover letter samples are not only for Upwork job, but also you will have some idea about your real life job
Freelance Profile Overviews: Different Profile samples and overviews of experts, advanced and intermediate level freelancers
For Newbie of Upwork: Upwork Help - How to apply for a job in Upwork with 10 most important articles about Upwork

A to Z View - All Upwork Test Answers

AJAX - Interview Questions and Answers

In this post, you will find all the possible and most recent Job Interview questions and answers of Blackberry for Mobile Devices category which you might be asked by your employer. These interview questions and answers will help you to get the job.

These Interview Questions and answers are not only for Upwork job, you will have some idea about the related job interview for your permanent or real life job.  This is just some sample answers, don't just copy and paste them, read them carefully and make your own answer.

1. Are there any security issues with AJAX?
• A JavaScript can not access the local file system without the user's permission. 
• An AJAX interaction can only be made with the servers-side component from which the page was loaded. 
• A proxy pattern could be used for AJAX interactions with external services. 
• The application model should not be exposed as some user might be able to reverse engineer the application. 
• HTTPS can be used to secure the connection when confidential information is being exchanged.

2. Are there security issues with AJAX?
• JavaScript is in plain view to the user with by selecting view source of the page. JavaScript cannot access the local file system without the user's permission. 
• An AJAX interaction can only be achieved with the servers-side component from which the page is loaded. 
• A proxy pattern can be used for AJAX interactions with external services. 
• We should take care that the application model is not exposed in such a way that our server-side components are at risk if a user to reverse engineer your application. 
• Like any other web application we should use HTTPS to secure the connection when sensitive information is being exchanged. 

3. Are there Usability Issues with AJAX?
Usability Issues:

a. User Exceptions
b. Response time
c. Design Issues 
d. Accessibility

4. Define JSON.
JSON stands for JavaScript Object Notation. It is a human readable format for data transfer over network. It is used mainly in AJAX where it is used instead of xml. It is light in weight, thus making the transfer faster.

5. Describe how to create AJAX objects.
Ajax Objects can be created by the following syntax:

Var ajax= New ajaxObject('page path'). Here page path is the URL you want the Object to call. The URL must be of the same domain as the webpage.

6. Describe how to handle concurrent AJAX requests.
This is done by using JavaScipt closures. Functions can be written to handle such requests. Parameters can be passed to an appropriate function selected by closures.

JavaScipt closures can be used for handling concurrent requests. A function can be written to handle such requests. Once processing of code is over, URL and the call back function to call can be passed as parameters. These parameters are passed to the AJAXInteraction(url, callback) object. Closures insure that the proper callback function associated with a specific AJAX interaction is called. 

7. Describe the AccordionExtender control.
• The AccordionExtender control is almost same as the CollapsiblePanelExtender control. 
• It enables the grouping of multiple collapsible panels in a single control. 
• It also manages the collapsed and expanded state of every panel and one panel will expand at a time. 
• Using AccordionExtender control we can't expand two or more panels at a time.

However, we can click the header templates of particular panel to display the hidden contents.

• By default, one panel is always expanded in theAccordionExtender.

8. Describe the formats and protocols used by AJAX
• The client web page is creates the XmlHttpRequest, and thus the connection from the web page to an application on the server. 
• Part of that connection determines how the response can be produced to the client code - via the use of a ''callback'' routine. 
• The callback routine is called multiple times which come with a status code which indicates the reason for the invocation. 
• When a request can be successfully completed by the server application, a response should also be produced.

9. Describe the formats and protocols used by AJAX.
The protocol used for making a request to the server is XmlHttpRequest. This object is created by client browser. The data transfer takes place in plain text xml or JSON format. This object allows to parses the xml format and the JSON format is loaded as plain text and parsed by JavaScript. It is recognized by all the browsers

10. Does AJAX work with Java?
Absolutely. Java is a great fit for AJAX! We can use Java Enterprise Edition servers to generate AJAX client pages and to serve incoming AJAX requests, manage server side state for AJAX clients, and connect AJAX clients toy our enterprise resources. The JavaServerFaces component model is a great fit for defining and using AJAX components.

11. Explain AJAX in detail.
AJAX stands for Asynchronous JavaScript and XML.

AJAX is a technique for creating fast and dynamic web pages. AJAX allows web pages to be updated asynchronously by exchanging small amounts of data with the server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page. 

12. Explain ASP.NET Ajax Framework.
ASP.NET Ajax framework is an open source javascript library to build AJAX enabled web applications. This library includes all the AJAX control toolkit controls which can be used from server side and client side as well.

13. Explain in brief abo XMLHttpRequest object.
XMLHttpRequest is an object used for data transfer with server and client's browser. This object allows the data transfer without reloading the page. The data transfer takes place in plain text xml or JSON format. This object allows to parses the xml format. It is recognized by all the browsers

xmlOBJ = new XMLHttpRequest ()

14. Explain limitations of Ajax.
Limitations of AJAX:

1)Browser Integration
The dynamically created page does not register itself with the browser history engine, so triggering the "Back" function of the users' browser might not bring the desired result.

2)Response-time Concerns
Network latency - or the interval between user request and server response - needs to be considered carefully during Ajax development.

3)Search Engine Optimization (SEO)
Websites that use Ajax to load data which should be indexed by search engines must be careful to provide equivalent Sitemaps data at a public, linked URL that the search engine can read, as search engines do not generally execute the JavaScript code required for Ajax functionality 4)Reliance on JavaScript Ajax relies on JavaScript, which is often implemented differently by different browsers or versions of a particular browser. Because of this, sites that use JavaScript may need to be tested in multiple browsers to check for compatibility issues.

15. How Ajax is different?
AJAX allows for asynchronous processing of events. This is different from the traditional sequential events that a users is used to, instead, a user can fire multiple events, each of which process executes independent of each other, enhancing the user experience. In traditional web applications, every time a user triggered an event, the request was sent to the server and the complete page was rendered again as a result of that. AJAX allows for partial page rendering which enable a user to trigger multiple events through different portions of the same web page.

16. How do I create a thread to do AJAX polling?
• JavaScript does not provide threads. JavaScript functions are called after an event occurred on a page like the page is loaded, a mouse click, or a form element get focused. 
• You can make a timer by using the setTimeout which requires a function name and time in milliseconds as its arguments. 
• Calling the same function using loop which is given in the JavaScript example below.
function checkForMsg() {
// start AJAX interaction with handleCallback as the callback function
// callback for the request
function handleCallback() {
// do post processing
setTimeout("checkForMsg()", 20000);
Note that the checkForMessage will continue to loop infinitely. You may want to change the increment interval based on activity. You may also want to change the logic which will break the loop based on some AJAX response executing condition. 

17. How do I handle the back and forward buttons?

In order to store changes in the browsers web history (enabling back and forward buttons) Iframes can be used. Iframes allow am HTML document to be embedded in another HTML document. 

RSH (Really Simple History) framework can also be used. RSH framework explains the management of bookmarks and history for Ajax applications. 

18. How do I provide internationalized AJAX interactions?
To provide internationalized AJAX components you need to do the following:

• Set the charset of a page to an encoding which is provided by the target languages. The following meta declaration in your HTML/JSP page is used to set the content type:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
• In the page JavaScript ensure that the encoding of any parameters sent to the server is done. To achieve this JavaScript has the escape() function which will give Unicode escape strings containing localized text in hexadecimal format. 
• In the server side component set the character encoding using the HttpServletRequest.setCharacterEncoding() method. Before accessing the localized parameter with HttpServletRequest.getParameter() call. In the case of UTF this will be request.setCharactherEncoding("UTF-8");. 
• A server-side component returning AJAX responses requires to set the encoding of the response to the similar encoding used in the page. 
response.getWriter().write(" <response>Not valid </response>");

19. How do I submit a form or a part of a form without a page refresh?
• When creating a form ensure that in the "form" element "onSubmit" attribute calls the JavaScript function that returns false.
<form onSubmit="doSubmit();return false;" >
<input type="text" id="myinput" /><input type="submit" id="btnSubmit" value="Save"/>
o The other way is to associate a function with a form button in a similar way.
<form onSubmit="doSubmit();return false;" >
<input type="text" id="myinput" />
<input type="button" id="button1" onClick="doSubmit()" value="Save"/>
While you update the page it is recommended that you should wait to confirm that the AJAX update of the form data was successful before updating the data in your page. Otherwise, it is possible that the data is not updated properly and the user is not aware about it. It is suggested to display a loading message message when doing a partial update and after the successful AJAX interaction we can update the page.

20. How do you know that an AJAX request has completed?
readyState allows determining the request status. If the value is 4, it means that the request has been completed and response is then sent to the browser.

By determining the readyState property value of XMLHttpReqyest, One can know if the request is completed. If the readyState value = 4, the request has been completed and the data is available.

21. How does one call a JavaScript function from the AJAX code?
• Ajax is a form of JavaScript, which uses XML Http Request objects which pass action event parameters to a method named ''open''. 
• In AJAX we can't track the requests and responses in any order. 
• ''XMLHttpRequest.open'' is the function which uses action events as Parameters in URL. 
• While ''XMLHttp Request.send'' sends the Request object either synchronously or asynchronously which depend on whether the option for the synchronous version is true or false?

22. How is encoding handled in AJAX?
Ways to handle encoding in AJAX:

• Using encodeActionURL() method to refresh the complete page 
• Using encodeResourceURL() method to partially update a page.

23. How many validation controls are supported in ASP.NET AJAX 4.0?
The following validation controls are supported in ASP.NET AJAX 4.0:

• FilteredTextBoxExtender : This validation is used to apply filtering to a text box. 
• MaskedEditExtender and MaskedEditValidator : These validation controls are used to prevent a user to enter only a particular pattern of characters in the TextBox. 
• ValidatorCalloutExtender : This validation is used to display a balloon tooltip containing the error message by attaching the ASP.NET validators. 
• NoBot : It restricts the input forms automatically to be filled by spam/bot and used to ensure that the user is not a computer machine by the automated Public Turing test. 
• PasswordStrengthExtender : It is used to find the strength of the password entered in the text box by checking the different strength related parameters.

24. If there is an input in the text field what are all the functions which get executed?
We can execute following functions when there is an input in the text field.

• 1) Defines the url that we will sent to the server 
• 2) A parameter is inserted to the input field's content. 
• 3) A parameter is inserted to restrict the server from the cache. 
• 4) When a change is triggered statechange is invoked. 
• 5) An XMLHTTP object having a given URL gets invoked 
• 6) A request is sent to the server through HTTP.

25. Is is possible to implement Ajax in browsers that do not support the XmlHttpRequest object?
Yes by using ActiveXObject, it is possible to implement AJAX in browsers that do not support the XmlHttpRequest object.

26. Is the server or the client in control in AJAX?
AJAX techniques can be implemented by server only, client or, or even mix of both. It depends on what technology and architecture one chooses. When providing complete control to the server, the server ensures that the client pages are in sync with the server. Whereas, one could use javascript and apply AJAX at the client level through it. The most common approach is to use a mix of server side and client side control.

27. List out browsers that support AJAX.
All the available browsers can not support AJAX. Here is the list of major browsers which support AJAX.

1. Mozilla Firefox 1.0 and above
2. Netscape version 7.1 and above
3. Apple Safari 1.2 and above.
4. Microsoft Internet Exporer 5 and above
5. Konqueror
6. Opera 7.6 and above 

28. List out differences between AJAX and JavaScript.
JavaScript is a client-side script, used to control a web page at the client side once it has downloaded. The validations in case of JavaScript will be handled particularly on client's browser and no server side requests will be handled. AJAX allows JavaScript to communicate with the remote script and receive the response from the server, without the need to reload the entire page. JavaScript is the base on which Ajax works.

29. List the different states of XMLHttpRequest with their description.
The different states of the XMLHttpRequest object are as follows:

• 1) Uninitialized : It is the state in which the object has not been initialized. 
• 2) Open: It is the state when the object has been created but the send function is not invoked. 
• 3) Sent: It is the state when the send function is invoked but the status and headers are not available. 
• 4) Receiving: It is the state when the data is received by the process. 
• 5) Loaded: It is the state when the procedure is completed and the data is available.

30. What are Difference between Server-Side AJAX framework and Client-side AJAX framework?
• The server-side framework facilitates the developers to develop Ajax functionality, without gaining much knowledge of JavaScript. 
• This framework supports server controls and components as well as the drag and drop features. 
• This framework is usually preferred when you required to rapidly ajaxify an asp.net web page. The drawback is that a round trip will take place to the server to execute a client-side action. 
• The Client-Side Framework allows you to build web applications with rich user-interactivity as that of a desktop application. 
• It includes a set of JavaScript libraries, which is not dependent from ASP.NET. The functionalities of this library are enhanced in every release.

31. What are the benefits of AJAX over Java applet?
• Html based web applications are easily searchable & can be indexed. 
• Startup time to load a applets is more that loading a page with ajax. 
• Applets provides a different look and feel than a normal web based application

The following are the benefits of AJAX over Java applet:

• AJAX applications are loaded in seconds, where as Applets takes longer time. The reason is, Applet applications are tend to load large libraries. 
• AJAX provides standard look and feel for web applications, where as Applets provides GUI based look and feel. 
• AJAX features can increase from a conventional web application, where as Applets uses complete programming process right from the scratch. 
• Java version changes enable incompatibilities between Applet and java environments used by the browser, where as in AJAX incompatibilities are not the constraints.

32. What are the differences between AJAX and JavaScript?
The differences between AJAX and JavaScript are given as follows:

• AJAX sends request to the server and will not wait for the response. 
• It will allow other operations on the page before it get response of previous request; whereas, JavaScript make a request to the server, will waits for response and will not allow other operation on the page during that time. 
• In AJAX, the page will not get refreshed for downloading the whole page while JavaScript manages and controls a Web page after being downloaded. 
• By using AJAX we can minimize the overload on the server because the script needs to request once while JavaScript posts the request that updates the script each time.

33. What are the different frameworks available In AJAX?
The following is a list of notable Ajax frameworks, used for creating web applications with a dynamic link between the client and the server.

Some of the frameworks are JavaScript compilers, for generating JavaScript and Ajax that runs in the web browser client; 

Some are pure JavaScript libraries. Others are server-side frameworks that typically utilize JavaScript libraries.

1. JavaScript frameworks are browser-side frameworks very commonly used in Ajax development. There are hundreds of JavaScript frameworks available.E.g. jQuery

2. Java frameworks used for server-side Ajax operations: E.g. Apache Wicket

3. C++ : E.g. Wt - a C++ Web Toolkit

4. .NET : The following frameworks are available for the Windows .NET platform: e.g. ASP.NET AJAX (previously Microsoft Atlas)

5. PHP : A PHP framework is able to deal with database, search data, and build pages or parts of page and publish the page or return data to the XMLHttpRequest object. E.g. Quicknet is an Ajax framework that provides secure data transmission, uses PHP on the server side

6. Python : These frameworks use Python for client-side Ajax operations:

E.g. Pyjamas, a widget library with a Python to JavaScript compiler

7. Ruby : The Ruby on Rails framework implements a Domain- specific language named RJS, which can be used to write Ruby code that generates Javascript code.

34. What are the new features included in the Microsoft AJAX library?
The new features included in the Microsoft AJAX library are as follows:

• Imperative syntax: AJAX library provide simple imperative syntax which is required to create and manage controls. 
• Script loader: It is used to retrieve all scripts automatically which are required by one or more client component or control and executes them in the order in which they are received. 
• Client data access: It's used to access client data and display by client data control and client template. 
• Client datacontext: It's used to read and write the permission to data in a database. 
• The AdoNetDataContext class - Supports to easily communicate to an ADO.NET Data Services service.

35. What are the new features of ASP.NET AJAX 4.0?
These features are as follows:

• It enables the application to bind the live data. 
• It enables to render the client-side template. 
• It enables declarative instantiation of client components. 
• It provides observer pattern on JavaScript objects and arrays. 
• It provides the facility to invoke ADO.NET data services and data contexts. 
• It supports for the DataView control.

36. What are the security issues with AJAX?
The Ajax calls are sent in plain text format, this might lead to insecure database access. The data gets stored on the clients browser, thus making the data available to anyone. It also allows monitoring browsing sessions by inserting scripts.

AJAX function calls are sent in plain text to server. These calls may easily reveal database details, variable names etc 

User's browsing session can be monitored my maliciously inserting scripts

Ajax may encourage developers to use multiple server side pages thereby introducing multiple entry points for attackers

37. What is AJAX and what problem does it solve?
Ajax: It is a short for Asynchronous JavaScript and XML. It solves the problem of unnecessary data transfers and allows asynchronous processing and avoids unnecessary processing to be done by server.

Ajax is a set of client side technologies that allows asynchronous communication between client and web server. In synchronous communication, complete round trip happens with each request/response action event when small data of the page to be refreshed. Ajax has solved this problem of posting entire information every time through asynchronous communication. 

XmlHttpRequest is the basic fundamental behind Ajax. This allows browser to communicate with server without making post backs.

38. What is an UpdatePanel Control?
• An UpdatePanel control is a cover for server side controls which is to be partial postbacked on ajax enabled page. 
• All controls included in the UpdatePanel will be partial postbacked. Below is a small example of using an UpdatePanel.
<asp:ScriptManager runat=''server''>
</ asp:ScriptManager>
<asp:UpdatePanel runat=''server''>
<asp:Button runat=''server''></asp:Button>

• On clicking the button the page will be updated partially. There won't be a full postback by the web page. 
• In this way the content beyond the update panel won't be posted back to the server. 
• The contents in the updatepanel will be refreshed only.

39. What is synchronous request in AJAX?
Synchronous request means that the processing will stop once the request has been sent to the server till the reply comes back. The browser freezes and you are not allowed to perform any task or send any request. 

40. What is the difference between synchronous postback and asynchronous postback?
The difference between synchronous and asynchronous postback is as follows:

• Asynchronous postback renders only the part of the page which is needed; while, synchronous postback renders the entire page in a postback. 
• Asynchronous postback executes only one postback at a time, that is, if you have two buttons doing asynchronous postback, the actions are executed one by one; while, synchronous postback invoke all the actions at a time. 
• Asynchronous postback only changes the update panel that invoke the postback; while, synchronous postback changes the entire page.

41. What is the disadvantage of AJAX?
The disadvantages of AJAX are:

• Search engines would not be able to index an AJAX application. 
• The server information can not be accessed within AJAX. 
• AJAX is not well integrated with any browser. 
• ActiveX requests are enabled only in IE 5 and IE6 
• Data of all requests is URL-encoded, which increases the size of the request.

42. What is the role of Script Manager in Ajax?
The ScriptManager controls client script for ASP.NET AJAX pages. It also registers the script for the AJAX Library.

43. What is the role of ScriptManager in Ajax?
ScriptManager is a class and a control in Ajax.

The ScriptManager class in ASP.NET manages Ajax Script Libraries, partial page rendering functionality and client proxy class generation by creating an instance of the Ajax runtime on the browser, for web applications and services.

The ScriptManager control (that we may drag on a web form) is actually an instance of the ScriptManager class that we put on a web page. The ScriptManager manages all the ASP.NET Ajax controls on a web page.

44. When should AJAX NOT be used?
AJAX should not be used for critical data and transactions to avoid security breaches and to avoid situations where the page doesn't work as expected because javascript is not supported or is blocked.

If the page is expected to be shown in a search engine like Google. Since Web crawlers don't execute javascript code.

If the browser does not support JavaScript.

If security is a big concern in the application; Since Ajax allows end user to see half of what's being sent to the server.

45. When should I use a Java applet instead of AJAX?
Scenarios to use Java applet instead of AJAX:

• When there is a need for custom data streaming 
• Need for graphic manipulation 
• Threading related functionality 
• Complex and advanced GUI manipulations.

46. Which are limitations of AJAX?
• Back functionality can't work because the dynamic pages won't register themselves to the browsers cache. Hence the use Iframe will become required. 
• The page cannot be bookmarked if it is developed using Ajax. 
• If java script is not enabled, Ajax will stop working. 
• Because different components of the pages are loaded at different times, response time may be slow. 
• Because different components of the pages are loaded at different times it may create confusion for the user.

47. Which are the major ASP.NET Ajax Server Controls?
• Timer: This control is used to refresh the contents of a web page at already specified intervals of time. 
• Script Manager: This is the heart of an AJAX enabled web page. To develop the partial page rendering, it is necessary to set the EnablePartialRendering property of the ScriptManager control to true. 
• ScriptManagerProxy: A ScriptManagerProxy control passes references to a ScriptManager control in a master page to declare the Ajax behavior. 
• UpdateProgress: This control is required to display the progress when an update action in partial page rendering process is in progress. 
• UpdatePanel :- Update panel is required to create partial page updates in an Ajax enabled web page. All the controls which we need to involve in partial page update we need to include them inside an UpdatePanel control.

48. Which is the purpose for using the ScriptManager?
The purposes of ScriptManager in ASP.NET AJAX are explained as following.

• It enables the Client-script functionality of the Microsoft AJAX Library and it also supports a custom script that we can send to the browser. 
• It supports Partial-page rendering, which enable us to make partial page update without a postback. 
• The ASP.NET AJAX UpdatePanel, Timer and UpdateProgress controls work with ScriptManager control to support partial-page rendering. 
• It supports JavaScript proxy classes for Web services that provide client script which enable us to access Web services by exposing them as strongly typed objects. 
• It provides JavaScript classes to deal with ASP.NET authentication and profile application services.

49. Which request is better with AJAX, Get or Post?
AJAX requests should use an HTTP GET request while retrieving data where the data does not change for a given URL requested. An HTTP POST should be used when state is updated on the server. This is in line with HTTP idempotency recommendations and is highly recommended for a consistent web application architecture.

50. Why do we use the XMLHttpRequest object in AJAX?
• Javascript uses the XMLHttpRequest object to manipulate XML and other text data between client and server. 
• AJAX applications use the XMLHttpRequest object to avoid the postback of entire page when the browser is communicating with server. 
• The XMLHttpRequest object enables a client-side script to execute an HTTP request. 
• For this functionality MSXML ActiveX component is used in earlier version of Internet Explorer. While, XMLHttpRequest is used in Internet Explorer 7 and other browsers, such as Mozilla, Firefox.

51. Why is AJAX a comfortable fit with JAVA?
It is because java provides Java enterprise Edition servers for generation of AJAX client pages to serve ajax requests.