Ajax Interview Questions and Answers

by Rupa.R, on Sep 8, 2022 5:01:57 PM

Interview Questions (45)

Q1. What is meant by Ajax?

Ans: Ajax is abbreviated as Asynchronous Javascript and XML. It is new technique used to create better, faster and more interactive web systems or applications. Ajax uses asynchronous data transfer between the Browser and the web server.
This technique is used to make internet faster and user friendly. It is not a programming language.

Q2. What are Ajax applications?

Ans: Browser based applications and platform independent applications are used by Ajax.

Q3. What are the advantages of Ajax?

Ans: Following are the advantages of Ajax:
1. Bandwidth utilization
2.It saves memory when the data is fetched from the same page.
3. More interactive
4.Speeder retrieval of data

Q4. What is JSON in Ajax?

Ans: JSON is abbreviated as JavaScript Object Notation. JSON is a safe and reliable data interchange format in JavaScript, which is easy to understand for both users and machines.

Q5. What are the disadvantages of Ajax?

Ans: 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 (not impossible)
5. Increases size of the requests
6. Slow and unreliable network connection.
7. Problem with browser back button when using AJAX enabled pages.

Q6.  What are all the technologies used by Ajax?

Ans: AJAX uses following technologies:

  •  JavaScript
  • XMLHttpRequest
  • Document Object Model (DOM)
  • Extensible HTML (XHTML)
  • Cascading Style Sheets (CSS)

Q7. Is AJAX code cross browser compatible?

Ans: Not totally. Most browsers offer a native XMLHttpRequest JavaScript object, while another one (Internet Explorer) require you to get it as an ActiveX object

Q8. What are the security issues with AJAX?

Ans: 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.

Q9. How can you test the Ajax code?

Ans: JSUnit is the client side javascript code used as part of JUnit. JSUnit has been used for Ajax code.

Q10. What Is the Format of an AJAX Request?

Ans: An AJAX request can be in any format:
1. Text File
2. HTML
3. JSON object

Q11. Where Should I Start?

Ans: Assuming the framework you are using does not suffice your use cases and you would like to develop your own AJAX components or functionality I suggest you start with the article Asynchronous JavaScript Technology and XML (AJAX) With Java 2 Platform, Enterprise Edition. If you would like to see a very basic example that includes source code you can check out the tech tip Using AJAX with Java Technology. For a more complete list of AJAX resources the Blueprints AJAX Home page.Next, I would recommend spending some time investigating AJAX libraries and frameworks. If you choose to write your own AJAX clients-side script you are much better off not re-inventing the wheel.
AJAX in Action by Dave Crane and Eric Pascarello with Darren James is good resource. This book is helpful for the Java developer in that in contains an appendix for learning JavaScript for the Java developer.

Q12. Is an AJAX Request Synchronous or Asynchronous?

Ans: AJAX requests are asynchronous by nature, which means that they should run in the background independently of other events.

Q13. Does Ajax Work With Java?

Ans: Absolutely. Java is a great fit for AJAX! You 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 to your enterprise resources. The JavaServer Faces component model is a great fit for defining and using AJAX components.

Q14. How many types of triggers are present in update panel?

Ans: There are two types of triggers used in update panel:
1.PostBackTrigger : This works as full postback and it cannot work asynchronously
2. AsyncPostBackTrigger : Partial post back asynchronously

Q15. What are all the browsers support AJAX?

Ans: Following browsers support AJAX:

  •  Internet Explorer 5.0 and above
  • Opera 7.6 and above
  • Netscape 7.1 and above
  • Safari 1.2 and above

Q16. How can you find out that an AJAX request has been completed?

Ans: ReadyState property is used to check whether AJAX request has been completed. If the property is equal to four, then the request has been completed and data is available

Q17. Is It Possible To Set Session Variables From Javascript?

Ans: It's not possible to set any session variables directly from javascript as it is purely a client side technology. You can use AJAX though to asynchronously...

Q18. Who Is Using Ajax?

Ans: Google is making a huge investment in developing the Ajax approach. All of the major products Google has introduced over the last year like Orkut, Gmail, the latest beta version of Google Groups, Google Suggest, and Google Maps are Ajax applications. (For more on the technical nuts and bolts of these Ajax implementations, check out these excellent analyses of Gmail, Google Suggest, and Google Maps.) Others are following suit: many of the features that people love in Flickr depend on Ajax, and Amazon’s A9.com search engine applies similar techniques.
These projects demonstrate that Ajax is not only technically sound, but also practical for real-world applications. This isn’t another technology that only works in a laboratory. Ajax applications can be any size, from the very simple, single-function Google Suggest to the very complex and sophisticated Google Maps.
At Adaptive Path, we’ve been doing our own work with Ajax over the last several months, and we’re realizing we’ve only scratched the surface of the rich interaction and responsiveness that Ajax applications can provide. Ajax is an important development for Web applications, and its importance is growing. The biggest challenges in creating Ajax applications are not technical. The core Ajax technologies are mature, stable, and well understood. As there are so many developers out there who already know how to use these technologies, we expect to see many more organizations following Google’s lead in reaping the competitive advantage Ajax provides.
The challenges are for the designers of these applications to forget what we think we know about the limitations of the Web, and begin to imagine a wider, richer range of possibilities

Q19. Do Ajax Applications Always Deliver A Better Experience Than Traditional Web Applications?

Ans: Not necessarily. Ajax gives interaction designers more flexibility. However, the more power we have, the more caution we must use in exercising it. We must be careful to use Ajax to enhance the user experience of our applications, not degrade it.

Q20. Are Ajax Applications Easier To Develop Than Traditional Web Applications?

Ans: 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.

Q21.Cannot Parse Xml Generated By Jsp I Am Generating An Xml Using Jsp, When I Run The Jsp In Ie It Shows The Xml As Per Dom, But When I Try To Parse It Using Javascript , The Command Xmldoc.documentelement ?

Ans: This is working code, it might help you.
if (!isIE)
xmldoc = req.responseXML;
else
{

Q22.What are all the different data types that JSON supports?

Ans: JSON supports following data types:

  •  String
  • Number
  • Boolean
  • Array
  • Object
  • Null

Q23. Do I Really Need To Learn Javascript?

Ans: Basically yes if you plan to develop new AJAX functionality for your web application. On the other hand, JSF components and component libraries can abstract the details of JavaScript, DOM and CSS. These components can generate the necessary artifacts to make AJAX interactions possible. Visual tools such as Java Studio Creator may also use AJAX enabled JSF components to create applications, shielding the tool developer from many of the details of AJAX. If you plan to develop your own JSF components or wire the events of components together in a tool it is important that you have a basic understanding of JavaScript. There are client-side JavaScript libraries (discussed below) that you can call from your in page JavaScript that abstract browser differences. Object Hierarchy and Inheritance in JavaScript is a great resource for a Java developer to learn about JavaScript objects.

Q24.What Is The Difference Between Proxied And Proxyless Calls?

Ans: Proxied calls are made through stub objects that mimic your PHP classes on the JavaScript side. E.g., the helloworld class from the Hello World example.
Proxyless calls are made using utility javascript functions like HTML_AJAX.replace() and HTML_AJAX.append().

Q25. Did Adaptive Path Invent Ajax? Did Google? Did Adaptive Path Help Build Google's Ajax Applications?

Ans: Neither Adaptive Path nor Google invented Ajax. Google’s recent products are simply the highest-profile examples of Ajax applications. Adaptive Path was not involved in the development of Google’s Ajax applications, but we have been doing Ajax work for some of our other clients.

Q26. Won't My Server-side Framework Provide Me With Ajax?

Ans: 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.

Topics:Interview Questions with Answers

Comments

Subscribe