Ajax Questions with Answers

9 practice questions on Ajax (PHP) with answers and step-by-step solutions. Try 9 samples below, then practise all 9 free in the AptiNest app.

Sample questions

Question 1Medium

What makes Ajax unique?

  1. It works as a stand-alone Web-development tool.
  2. It works the same with all Web browsers.
  3. It uses C++ as its programming language.
  4. It makes data requests asynchronously.

Answer: D. It makes data requests asynchronously.

Explanation

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.

Step-by-step solution

  1. Ajax sends requests to servers without full page reloads.
  2. This allows partial updates using small data exchanges.
  3. Asynchronous communication is key to its functionality.
  4. Data requests happen in the background while users interact.
  5. This makes data requests asynchronous, not synchronous.
  6. Final answer: It makes data requests asynchronously.

Why the other options are wrong

  • A. Ajax is not a stand-alone development tool; it is a technique using browser and server features.
  • B. Ajax behaviour can differ between browsers, so it does not work identically in all of them.
  • C. Ajax is not written in C++; it uses JavaScript in the browser.

Tip: Remember, Ajax's main feature is asynchronous data requests.

Question 2Medium

What does the XMLHttpRequest object accomplish in Ajax?

  1. It's the programming language used to develop Ajax applications
  2. It provides a means of exchanging structured data between the Web server and client.
  3. It provides the ability to asynchronously exchange data between Web browsers and a Web server.
  4. It provides the ability to mark up and style the display of Web-page text.

Answer: C. It provides the ability to asynchronously exchange data between Web browsers and a Web server.

Explanation

XMLHttpRequest defines an API that provides scripted client functionality for transferring data between a client and a server.

Step-by-step solution

  1. XMLHttpRequest allows sending requests from the browser to the server without reloading the page.
  2. It enables asynchronous communication between the web browser and the server.
  3. This means data can be exchanged in the background while the user interacts with the page.
  4. The object handles the request and response cycle behind the scenes.
  5. Thus, it provides the ability to asynchronously exchange data between Web browsers and a Web server.

Why the other options are wrong

  • A. XMLHttpRequest is not a programming language; it is an object that browser scripts use.
  • B. Exchanging structured data is possible, but it is not the asynchronous feature the question asks for.
  • D. Marking up and styling page text is the job of HTML and CSS, not XMLHttpRequest.

Tip: Remember: XMLHttpRequest enables async communication for dynamic web content.

Question 3Medium

Ajax stands for?

  1. Asynchronous Javascript and XML
  2. Abstract JSON and XML
  3. Another Java Abstraction for X-Windows
  4. Another Java and XML Library

Answer: A. Asynchronous Javascript and XML

Explanation

AJAX = Asynchronous JavaScript and XML.AJAX is a technique for creating fast and dynamic web pages.

Step-by-step solution

  1. Ajax stands for Asynchronous JavaScript and XML.
  2. This is the standard definition of Ajax in web development.
  3. The correct answer matches this definition exactly.
  4. Option A states 'Asynchronous Javascript and XML'.
  5. Final answer: A (Asynchronous Javascript and XML).

Why the other options are wrong

  • B. Abstract JSON and XML is not the meaning; Ajax stands for Asynchronous JavaScript and XML.
  • C. Another Java Abstraction for X-Windows is not what Ajax stands for.
  • D. Another Java and XML Library is not the meaning of the Ajax acronym.

Tip: Remember the acronym AJAX stands for Asynchronous JavaScript and XML.

Question 4Medium

Regarding the XMLHttpRequest Object, does the order in which one calls the 'open' method and assign a function to the 'onreadystatechange' event handler matter?

  1. YES
  2. NO

Answer: B. NO

Explanation

No their order doesn't matter. XMLHttpRequest defines an API that provides scripted client functionality for transferring data between a client and a server. open() function Sets the request method, request URL, and synchronous flag.

Step-by-step solution

  1. open() sets the request method, URL and sync flag, but does not send the request.
  2. The onreadystatechange handler is called later, when the state changes after send().
  3. So assigning the handler before or after open() makes no difference; the answer is option B, NO.

Why the other options are wrong

  • A. The order does not matter, because the handler is only used after send() is called.

Tip: Set the handler before send(); its order relative to open() does not matter.

Question 5Medium

Which one of these technologies is NOT used in AJAX?

  1. CSS
  2. DOM
  3. DHTML
  4. FLASH

Answer: D. FLASH

Explanation

Ajax doesn't use flash technology.
Technologies used by ajax:
JavaScript
Loosely typed scripting language
JavaScript function is called when an event in a page occurs
Glue for the whole AJAX operation
DOM
API for accessing and manipulating structured documents
Represents the structure of XML and HTML documents
CSS
Allows for a clear separation of the presentation style from the content and may be changed programmatically by JavaScript
XMLHttpRequest
JavaScript object that performs asynchrous interaction with the server

Step-by-step solution

  1. AJAX uses JavaScript for client-side scripting.
  2. AJAX uses DOM to manipulate web pages.
  3. AJAX uses CSS for styling and layout.
  4. FLASH is not used in AJAX technology.

Why the other options are wrong

  • A. CSS is used in AJAX pages for styling, so it is one of the technologies AJAX uses.
  • B. DOM is used by AJAX scripts to update page content, so it is one of the technologies used.
  • C. DHTML is dynamic HTML, which is used alongside AJAX for interactive pages.

Tip: Remember: AJAX stands for Asynchronous JavaScript and XML, so it doesn't use Flash.

Question 6Medium

Ajax comes in__.

  1. 2003
  2. 2005
  3. 2004
  4. 2006

Answer: B. 2005

Explanation

The name AJAX was coined in 2005 by Jesse James Garrett, and it became popular through web apps such as Google Maps and Gmail.

Step-by-step solution

  1. The question asks the year in which AJAX came.
  2. The name AJAX was coined in 2005.
  3. So B, 2005, is the answer.

Why the other options are wrong

  • A. The name AJAX did not exist in 2003.
  • C. The name AJAX came in 2005, not 2004.
  • D. The name AJAX came in 2005, not 2006.

Tip: AJAX was named in 2005.

Question 7Medium

What does the <noscript> tag do?

  1. Enclose text to be displayed by non-JavaScript browsers
  2. Prevents scripts on the page from executing.
  3. Describes certain low-budget movies.
  4. None of the above

Answer: A. Enclose text to be displayed by non-JavaScript browsers

Explanation

The <noscript> tag defines an alternate content for users that have disabled scripts in their browser or have a browser that doesn't support script.
The <noscript> element can be used in both <head> and <body>.

Step-by-step solution

  1. The noscript tag holds content that is shown when scripts are off or not supported.
  2. It does not stop scripts from running.
  3. So option A is the correct answer.

Why the other options are wrong

  • B. Noscript does not stop scripts; it shows fallback content.
  • C. The noscript tag has nothing to do with movies.
  • D. Option A is correct, so none of the above is wrong.

Tip: Noscript gives fallback content for browsers without script support.

Question 8Medium

Ajax is a programming language.

  1. True
  2. False

Answer: B. False

Explanation

AJAX is not a programming language, it is not a software or an SDK / framework. AJAX stands for Asynchronous JavaScript and XML, it combines the scripting power of JavaScript with XML to provide data for modifying an HTML web page so that HTML is the canvas on which AJAX operates.

Step-by-step solution

  1. Ajax is a technique, not a programming language.
  2. It stands for Asynchronous JavaScript and XML and lets a page update without a full reload.
  3. So the statement is False, which is option B.

Why the other options are wrong

  • A. True is wrong because Ajax is a technique that uses JavaScript; it is not a language.

Tip: Ajax is a technique for combining tools; JavaScript is the language that drives it.

Question 9Medium

AJAX made popular by

  1. Microsoft
  2. IBM
  3. Sun Micro system
  4. Google

Answer: D. Google

Explanation

ajax was made popular in 2005 by Google, with Google Suggest.

Step-by-step solution

  1. AJAX became famous due to its use in Google's search suggestions feature.
  2. Google implemented AJAX to make searches faster and more interactive.
  3. This made AJAX widely known and adopted by developers worldwide.
  4. Other companies later used AJAX, but Google popularized it first.
  5. Therefore, the correct answer is Google.

Why the other options are wrong

  • A. Microsoft is not the answer for popularising Ajax; the question points to Google here.
  • B. IBM is not the company this question credits with making Ajax popular.
  • C. Sun Microsystems is not the company this question credits with making Ajax popular.

Tip: Remember: Google popularized AJAX with its search suggestions feature.

Practise all 9 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all PHP topics · All topics