Monday, 15 February 2021

Top 20 AJAX interview Questions

 

Ques. 1): Is AJAX a programming language?

Answer: No, it is not. AJAX is an innovative technique designed for the purpose of creating modern day rapidly performing web applications in order to make the world of internet faster and more conducive to users. Importantly, AJAX primarily makes use of asynchronous data transfer between the web server and the browser.

 

Ques. 2): So, what do you think are the eventual objectives of AJAX in the first place?

Answer: AJAX has many potential objectives. First and foremost, it is used to mitigate the intensity of core network load, not to mention building a highly interactive user interface. Also, a reduced web server hit is one of the major goals of using AJAX. Additionally, platform and architecture neutrality continues to be the rudimentary aspects of AJAX. Moreover, it is also used for the purpose of both synchronous and asynchronous communication.

 

Ques. 3): Is Ajax Just Another Name For Xmlhttprequest?

Answer: No. XMLHttpRequest is only part of the Ajax equation. XMLHttpRequest is the technical component that makes the asynchronous server communication possible; Ajax is our name for the overall approach described in the article, which relies not only on XMLHttpRequest, but on CSS, DOM, and other technologies.

 

Ques. 4): Why Does Html_ajax Hang on Some Server Installs?

Answer: If you run into an HTML_AJAX problem only on some servers, chances are your running into a problem with output compression. If the output compression is handled in the PHP config we detect that and do the right thing, but if its done from an apache extension we have no way of knowing its going to compress the body. Some times setting HTML_AJAX::sendContentLength to false fixes the problem, but in other cases you'll need to disabled the extension for the AJAX pages.

I've also seen problems caused by debugging extensions like XDebug, disabling the extension on the server page usually fixes that. Questions dealing with Using HTML_AJAX, and general JavaScript development

 

Ques. 5): Are Ajax Applications Easier To Develop Than Traditional Web Applications?

Answer: Not necessarily. Ajax applications inevitably involve running complex JavaScript code on the client. Making that complex code efficient and bug-free is not a task to be taken lightly, and better development tools and frameworks will be needed to help us meet that challenge.

 

Ques. 6): What is the difference between proxied and proxyless calls in AJAX?

Answer: Proxied calls are made through stub objects which can be called from PHP classes on the JavaScript side in AJAX.

Proxyless calls are made using utility JavaScript functions like HTML_AJAX.replace() and HTML_AJAX.append() in AJAX.

 

Ques. 7): What are the pre-requisites to execute AJAX applications on a server?

Answer: AJAX is a built-in functionality of .NET Framework 4.0 and AJAX application can be executed by just installing Microsoft Visual Studio 2010. To use extenders in your applications, you are required to install AJAX Control Toolkit and copy the AjaxControlToolkit.dll file to the Bin directory of your application.

 

Ques. 8): One of the demerits of AJAX is the redundant flow of requests. How can we hope to tackle simultaneous requests in AJAX?

Answer: To tackle concurrent requests, the respective Java script functions need to be written. Having written the functions, the call back function can be applied as a parameter in order to tackle simultaneous requests. The concerned parameters are then passed to what is known as the Ajax Interaction object to tackle the concurrency of incoming requests.

 

Ques: 9): What do you understand by the script manager?

Answer: Chiefly, the Script Manager acts as a perfunctory mediator. It is essentially important for the management of the client-side script of AJAX. It is important to note that any page that uses AJAX has a Script Manager in order to enable the application of AJAX libraries.

 

Ques: 10): What Browsers Does Html_ajax Work With?

Answer: We don't have a list right now, but most of the API is stable as of 0.3.0, all the examples that ship with HTML_AJAX have been verified to work with

1.    Firefox 1.0+

2.    Internet Explorer 5.5+ (5.0 should work but it hasn't been tested)

Most things work with

1.    Safari 2+

2.    Opera 8.5+ of 0.3.0. There should be no major changes at this point, though there will be lots of new additions.

 

Ques: 11): How many types of triggers are present in update panel?

Answer: There are two types of triggers used in update panel:

      PostBackTrigger – This works as full postback and it cannot work asynchronously

      AsyncPostBackTrigger – Partial post back asynchronously

 

Ques: 12): What are the disadvantages of Ajax?

Answer: Following are the disadvantages of Ajax:

1.    AJAX is dependent on Javascript. If there is some Javascript problem with the browser or in the OS, Ajax will not support

2.    Ajax can be problematic in Search engines as it uses Javascript for most of its parts.

3.    Source code written in AJAX is easily human readable. There will be some security issues in Ajax.

4.    Debugging is difficult

5.    Increases size of the requests

6.    Slow and unreliable network connection.

7.    Problem with browser back button when using AJAX enabled pages.

 

Ques. 13): What is the difference between RegisterClientScriptBlock, RegisterClientScriptInclude and RegisterClientScriptResource?

Answer: Following are the functions:

      RegisterClientScriptBlock – The script is specified as a string parameter.

      RegisterClientScriptInclude – By setting the source attribute to a URL that point to a script file.

      RegisterClientScriptResource – specifies Resource name in an assembly. The source attribute is automatically populated with a URL by a call to an HTTP handler that retrieves the named script from the assembly.

 

Ques. 14): What are the properties of XMLHttpRequest?

Answer: The important properties of the XMLHttpRequest object are given below.

    onReadyStateChange - It is called whenever readystate attribute changes.

    readyState - It represents the state of the request.

    responseText - It returns response as text.

    responseXML - It returns response as XML.

    status - It returns the status number of a request.

    statusText - It returns the details of status.

 

Ques. 15): What are the different ready states of a request in AJAX?

Answer: There are 5 ready states of a request in AJAX.

    0 means UNOPENED

    1 means OPENED

    2 means HEADERS_RECEIVED

    3 means LOADING

    4 means DONE

 

Ques. 16): Won't My Server-side Framework Provide Me With Ajax?

Answer: You may be benefiting from AJAX already. Many existing Java based frameworks already have some level of AJAX interactions and new frameworks and component libraries are being developed to provide better AJAX support. I won't list all the Java frameworks that use AJAX here, out of fear of missing someone, but you can find a good list at www.ajaxpatterns.org/Java_Ajax_Frameworks.

If you have not chosen a framework yet it is recommended you consider using JavaServer Faces or a JavaServer Faces based framework. JavaServer Faces components can be created and used to abstract many of the details of generating JavaScript, AJAX interactions, and DHTML processing and thus enable simple AJAX used by JSF application developer and as plug-ins in JSF compatible IDE's, such as Sun Java Studio Creator.

 

Ques. 17): Is Adaptive Path Selling Ajax Components Or Trademarking The Name? Where Can I Download It?

Answer: Ajax isn’t something you can download. It’s an approach — a way of thinking about the architecture of web applications using certain technologies. Neither the Ajax name nor the approach is proprietary to Adaptive Path.

 

Ques. 18): Some Of The Google Examples You Cite Don't Use Xml At All. Do I Have To Use Xml And/or Xslt In An Ajax Application?

Answer: No. XML is the most fully-developed means of getting data in and out of an Ajax client, but there’s no reason you couldn’t accomplish the same effects using a technology like JavaScript Object Notation or any similar means of structuring data for interchange.

 

Ques. 19): Are There Any Security Issues With Ajax?

Answer: 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 made with the servers-side component from which the page was loaded. A proxy pattern could be used for AJAX interactions with external services.

You need to be careful not to expose your application model in such as way that your server-side components are at risk if a nefarious user to reverse engineer your application. As with any other web application, consider using HTTPS to secure the connection when confidential information is being exchanged.

 

Ques. 20): When Should I Use A Java Applet Instead Of Ajax?

Answer:

    Applets provide features like custom data streaming, graphic manipulation, threading, and advanced GUIs which AJAX cannot.

    However, with the help of DHTML, the functionalities of AJAX can be extended further.

    AJAX requires that the browser be DHTML and AJAX capable.

    AJAX-based functionality does need to take browser differences into consideration due to which using a JavaScript library such as Dojo which abstracts browser differences is recommended.

    AJAX/DHTML works well for applications where the latest browsers are used.

 

2 comments: