jQuery MCQ Questions and Answers
Q. What is jQuery used for?
A. Simplifying HTML document traversal and manipulationB. Sending data to a server using AJAX
C. Both A and B
D. Neither A nor B
Q. How do you select elements using jQuery?
A. By using the $() functionB. By using the jQuery() function
C. By using the select() method
D. By using the find() method
Q. What is the purpose of the .css() method in jQuery?
A. To get the value of a CSS propertyB. To set the value of a CSS property
C. Both A and B
D. Neither A nor B
Q. How do you add an event handler to an element using jQuery?
A. By using the .on() methodB. By using the .bind() method
C. By using the .click() method
D. By using the .event() method
Q. What is the purpose of the .each() method in jQuery?
A. To iterate over a jQuery objectB. To iterate over an array
C. To iterate over a set of elements
D. All of the above
Q. How do you create a jQuery plugin?
A. By extending the jQuery objectB. By using the .plugin() method
C. By creating a new function that takes a jQuery object as an argument
D. By using the $().plugin() syntax
Q. What is the purpose of the .ajax() method in jQuery?
A. To perform an AJAX requestB. To handle server responses
C. To send data to a server
D. All of the above
Q. How do you check if an element exists using jQuery?
A. By using the .exists() methodB. By using the .is() method
C. By using the .length property
D. By using the .visible() method
Q. What is the purpose of the .fadeIn() and .fadeOut() methods in jQuery?
A. To fade in and out an element with a smooth transitionB. To toggle the visibility of an element
C. To change the opacity of an element
D. To slide an element up and down