MCQ

jQuery MCQs – Multiple Choice Questions and Answers – Part 2

Multiple choice questions and answers (MCQs) on jQuery to prepare for exams, tests, and certifications. These questions are taken from a real written exam and some parts are taken from an interview. So you will find questions on basic techniques such as manipulating the DOM, web standards, CSS selector, DOM element, and more. This quiz will easily prepare anyone to pass their online test.
 

1. Which of the following is an overloaded function?

A jQuery()

B $()

C script()

D jQuery() and $()

D
The jQuery() and $() function is overloaded and you can invoke it in four different ways.

 

 

2. JQuery code to set the background color of all “<span>” in blue?

A $("span").style("background-color", "blue");

B $("span").css("background-color", "blue");

C jQuery("span").style("background-color", "blue");

D None of the above

B

 

 

3. Which of the following replaces $(document).ready(f)?

A jQuery(f)

B $(f)

C #(f)

D None of the above

B

 

 

4. $("span.foo"). What does it select?

A All span elements with id = “foo”

B all span elements with class = “foo”

C The first span element with id = “foo”

D The first span element with class = “foo”

B

 

 

5. Which jQuery method to set one or more style properties for selected elements?

A css()

B html()

A
The following example will set a background color and font size for ALL matching elements:

$("p").css({"background-color": "blue", "font-size": "100%"});

 

 

6. What are jQuery’s features?

A Useful collection of methods for manipulating selected items

B Efficient query method to find all document elements

C Syntax for referencing document elements

D All the answers are true

D
jQuery’s features:

  • Expressive syntax (CSS selectors) to reference document elements
  • An efficient query method to find the set of document elements corresponding to a CSS selector
  • A set of useful methods to manipulate the selected elements.
  • Powerful functional programming techniques to operate on sets of elements.
  • Sequencing to express sequences of operations.

 

 

7. Why do you use jQuery?
  • It is used to develop browser compatible web applications.
  • This improves the performance of an application.
  • It’s very fast and scalable.
  • It makes it easy for you to write the minimal lines of code for the user interface functions.
  • It provides multi-browser support.

 

 

9. The ______ method is used to make an asynchronous HTTP request?

A jQuery.ajaxAsync()

B jQuery.ajax()

C jQuery.async()

D None of the above

B
The ajax () method is used to execute an AJAX (Asynchronous HTTP) request.

Syntax:

$.ajax ({name: value, name: value, ...})

 

 

10. $("div#frame1 .bd1") What does it select?

A The first element with id = “bd1” in any div element with class = “frame1

B The first element with class = “bd1” in the first element div with id = “frame1”

C All elements with class = “bd1” in the first element div with id = “frame1”

D None of the above

C

 

mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *