JQuery Quiz - MCQ - Multiple Choice Questions

Welcome to the jQuery Quiz for beginners! Test your basic understanding of this powerful JavaScript library. As one of the most utilized libraries in web development, mastering jQuery fundamentals can supercharge your skills. This quiz is designed to challenge your knowledge and ensure you're familiar with JQuery core concepts and it's functions.

1. What does jQuery stand for?

A. Java Query
B. JavaScript Quotient
C. JavaScript Quick
D. JavaScript Query

2. Which symbol is used as a shortcut for jQuery?

A. %
B. ?
C. $
D. !

3. To check if an element is hidden in jQuery, which method can be used?

A. isVisible()
B. isDisplay()
C. isHidden()
D. is(':hidden')

4. Which jQuery method is used to set one or more style properties for selected elements?

A. style()
B. htmlStyle()
C. css()
D. setStyle()

5. How can we get the text inside an element using jQuery?

A. innerText()
B. html()
C. getValue()
D. text()

6. In jQuery, how can we get the value of an attribute?

A. attr()
B. getAttribute()
C. getAttr()
D. valAttr()

7. Which method in jQuery is used to insert content at the end of selected elements?

A. appendTo()
B. insertEnd()
C. endInsert()
D. addEnd()

8. What does the fadeIn() method in jQuery do?

A. Hides the selected elements by fading them to transparent.
B. Displays an element by fading it to opaque.
C. Makes the element blink.
D. None of the above.

9. How can you retrieve the content of a selected item in jQuery?

A. jQuery.content()
B. jQuery.val()
C. jQuery.get()
D. jQuery.retrieve()

10. How do you add a class to an element in jQuery?

A. addClass()
B. insertClass()
C. appendClass()
D. setClass()

11. Which of the following methods is used to remove specific form elements?

A. detach()
B. delete()
C. remove()
D. eliminate()

12. How can you test if an element exists in the DOM?

A. Using jQuery.exists()
B. Checking $(selector).length > 0
C. Using element.isPresent()
D. Checking $(selector) !== null

13. What is the difference between $(document).ready() and window.onload?

A. They are the same thing.
B. window.onload only works for HTML documents, not XML.
C. $(document).ready() is executed when the HTML DOM is loaded, while window.onload is executed when the page and all its resources are loaded.
D. window.onload is a jQuery event, while $(document).ready() is a native JavaScript event.

14. Which method is used to attach an event handler to an element, but only once?

A. .one()
B. .attach()
C. .bindOnce()
D. .singleEvent()

15. What does the .end() method do in jQuery?

A. Stops the chaining of methods.
B. Ends a running animation early.
C. Exits the jQuery script.
D. Reverts the most recent destructive action.

16. What does the .eq() method in jQuery do?

A. Compares two elements for equality.
B. Returns the element with the specified index from a set of matched elements.
C. Executes a function for every element in a set.
D. Checks if any of the selected elements have the specified class.

17. Which jQuery method is used to prevent the execution of the default function of the event?

A. .preventDefault()
B. .stopDefault()
C. .halt()
D. .blockEvent()

18. How do you bind multiple events to an element in jQuery?

A. Using multiple .on() methods.
B. Using .multiBind()
C. Passing multiple events to the .on() method separated by spaces.
D. Binding one event at a time.

19. Which of the following correctly retrieves the value of an input box using jQuery?

A. $('input').getValue()
B. $('input').val()
C. $('input').inputValue()
D. $('input:text').getText()

20. How can you hide all the paragraphs using jQuery?

A. $("p").hidden()
B. $("p").visibility("hidden")
C. $("p").hide()
D. document.querySelectorAll("p").style.display = "none"

21. Which jQuery method is used to switch between adding/removing one or more classes (toggles) from selected elements?

A. .switchClass()
B. .toggleClass()
C. .flipClass()
D. .alternateClass()

22. How can you check if a checkbox is checked using jQuery?

A. $("input[type='checkbox']").isChecked()
B. $("input[type='checkbox']").is(":checked")
C. $("input[type='checkbox']").checkStatus()
D. $("input[type='checkbox']").value("checked")

23. What does the .ajax() method in jQuery do?

A. It makes synchronous requests to the server.
B. It retrieves data from the server asynchronously.
C. It reloads the current page.
D. It creates a new XMLHttpRequest object.

24. How can you chain multiple methods in jQuery for a cleaner code?

A. Separate each method with a comma.
B. Write each method on a new line.
C. Use the then keyword between methods.
D. Separate each method with a dot.

25. Which of the following will select all img elements with an alt attribute containing the word "nature"?

A. $("img[alt*='nature']")
B. $("img[alt^='nature']")
C. $("img[alt='nature']")
D. $("img[alt$='nature']")

Comments

Spring Boot 3 Paid Course Published for Free
on my Java Guides YouTube Channel

Subscribe to my YouTube Channel (165K+ subscribers):
Java Guides Channel

Top 10 My Udemy Courses with Huge Discount:
Udemy Courses - Ramesh Fadatare