Thursday, 9 March 2017

AJAX interview questions Part-1

1. Ques: What is AJAX?
Answer
AJAX is an Asynchronous JavaScript and XML.AJAX is a new technique for creating better, faster, and more interactive web applications.With AJAX, a JavaScript script can communicate directly with the server, with the XMLHttpRequest object. With this object, a JavaScript can exchange data with a web server, without reloading the page.

AJAX uses asynchronous data transfer (HTTP requests) between the browser and the web server, allowing web pages to request small bits of information from the server instead of entire pages.
The AJAX technique makes Internet applications smaller, faster and more user-friendly.


2. Ques: What are the advantages of Ajax?
Answer:
Following are the advantages of Ajax:
  • AJAX technique makes Internet applications smaller, faster and more user-friendly.
  • Reduce the traffic travels between the client and the server.
  • Bandwidth utilization – It saves memory when the data is fetched from the same page.
  • Response time is faster so increases performance and speed.
  • You can use JSON (JavaScript Object Notation) which is alternative to XML.
  • You can use Firefox browser with an add-on called as Firebug to debug all Ajax calls.
  • Speeder retrieval of data

3. Ques: What are the disadvantages of Ajax?
Answer:
Following are the disadvantages of Ajax:
  • AJAX is dependent on JavaScript. If there is some JavaScript problem with the browser or in the OS, Ajax will not support
  • Ajax can be problematic in Search engines as it uses JavaScript for most of its parts.
  • Source code written in AJAX is easily human readable. There will be some security issues in Ajax.
  • Debugging is difficult
  • Increases size of the requests
  • Slow and unreliable network connection.
  • Problem with browser back button when using AJAX enabled pages.

3. Ques: What is Script Manager?
Answer:
Script Manager helps manage the client side script of AJAX. Script Manager acts as a mediator as AJAX depends on JavaScript. Every page that uses AJAX has a Script Manager to enable AJAX libraries. These Libraries in turn helps to implement the core Functionality of Ajax: Partial rendering. The Script Manager controls client script for ASP.NET AJAX pages. It also registers the script for the AJAX Library.


4. Ques: How many types of AJAX controls?
Answer:
  • ScriptManager
  • ScriptManagerProxy
  • Timer
  • UpdatePanel
  • UpdateProgress

ScriptManager :The ScriptManager control manages client script for AJAX-enabled ASP.NET Web pages. By default, the ScriptManager control registers the script for the Microsoft Ajax Library with the page. This enables client script to use the type system extensions and to support features such as partial-page rendering and Web-service calls.


5. Ques: What are the differences between the ScriptManager And ScriptManager Proxy ?
Answer:
ScriptManager
Script Manager is server control that makes script resources available to the browser, including the Microsoft AJAX Library and the functionality that enables partial-page rendering.

ScriptManager Proxy 
Script manager proxy is a server control that enable nested components to add script and service references if the page already contains a script manager control.

6. Ques: What is an UpdatePanel Control?
Answer:
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.
ex:
<asp:ScriptManager runat=”server”>
</ asp:ScriptManager>
<asp:UpdatePanel runat=”server”>
<ContentTemplate>
<asp:Button runat=”server”></asp:Button>
</ContentTemplate>
</asp:UpdatePanel>


7. Ques: What is XMLHttpRequest  in Ajax? What are the main task of xmlhttprequest ?
Answer:
The XMLHttpRequest Object. The XMLHttpRequest object can be used to request data from a web server. he XMLHttpRequest object is used to exchange data with a server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page.
Main task of xmlhttprequest
  • Update a web page without reloading the page
  • It send the request data from a server after the page has loaded
  • Receive data from a server after the page has loaded
  • Send data to a server in the background

8. Ques: What is readystate property holds the status of the XMLHttpRequest. 
Answer:
The readystate property holds the status of the XMLHttpRequest.
The onreadystatechange property defines a function to be executed when the readyState changes.

0: request not initialized
1: server connection established
2: request received
3: processing request
4: request finished and response is ready


9. Ques: What is JSON?
Answer:
JSON is a simple data exchange format. JSON means JavaScript Object Notation; it is language and platform independent.


10. Ques: What is use of JSON?
Answer:
When writing application based on JavaScript it uses JSON, which includes browser extension and websites
  • JSON is used for transmitting and serializing structured data over network connection
  • JSON is mainly used to transfer data between server and web application
  • Web service and API’s use JSON format to provide public data
  • JSON can be used with modern programming language

No comments:

Post a Comment

Thank you for comment