Q 1. The jQuery method used for parsing the JSON text is –
A. parseHTML() method
B. parseJSON() method
C. noConflict() method
D. each() method
Show Answer
Answer:-B. parseJSON() methodExplanation
The jQuery parseJSON() method takes a JSON string and returns a JavaScript object. The specified JSON string must follow the strict JSON format. Passing an incorrect string will cause a JS exception.Q 2. What does the syntax $(“div#myDiv .para”) will select?
A. It will select all elements with id = “myDiv” within the div element with class = “para”
B. It will select all elements with class = “para” within the div element with id = “myDiv”
C. All div elements with class = “para” or with id = “myDiv”
D. None of the above
Show Answer
Answer:-B. It will select all elements with class = “para” within the div element with id = “myDiv”Explanation
The jQuery syntax $(“div#myDiv .para”) will select all elements with class = “para” within the div element with id = “myDiv”.Q 3. Which of the following jQuery method is used to reduce the set of matched elements to a single element?
A. isEqual() method
B. val() method
C. delegate() method
D. eq() method
Show Answer
Answer:-D. eq() methodExplanation
The eq() method in jQuery returns an element with the given index. This method reduces the set of elements to the one with a specific index. The index can either be positive or negative.Q 4. The toggle() method in jQuery is used to –
A. toggle between the hide() and show() methods
B. toggle between the fadeIn() and fadeOut() methods
C. toggle between the slideUp() and slideDown() methods
D. None of the above
Show Answer
Answer:-A. toggle between the hide() and show() methodsExplanation
The jQuery toggle() is a special type of method which is used to toggle between the hide() and show() method. It shows the hidden elements and hides the shown element.Q 5. Which of the following method is used to toggle between the fadeIn() method and fadeOut() method?
A. toggle() method
B. animate() method
C. slideToggle() method
D. fadeToggle() method
Show Answer
Answer:-D. fadeToggle() methodExplanation
jQuery fadeToggle() method is used to toggle between the fadeIn() and fadeOut() methods. If the elements are faded in, it will make them faded out, and if they are faded out, it will make them faded in.Q 6. The :even and :odd filters in jQuery are used to –
A. determine if the number is odd or even
B. determine if the index position of an element is odd or even
C. both (a) & (b)
D. None of the above
Show Answer
Answer:-B. determine if the index position of an element is odd or evenExplanation
The :even selector in jQuery is used to select the elements with even index numbers (such as 2, 4, 6, etc.). The index starts at 0. The :odd selector in jQuery is used to select the elements with an odd index number (such as 1, 3, 5, etc.).Q 7. If the names of variables are the same, then which of the following type of variable takes precedence?
A. local variable
B. global variable
C. both (a) & (b)
D. None of the above
Show Answer
Answer:-A. local variableExplanation
In the function’s body, the precedence of the local variable is more than the global variable with the same name. If the name of the function’s local variable is the same as the name of the global variable, then the local variable hides the global variable.Q 8. Which of the following is the correct code in jQuery to make all div elements 150px high?
A. $(“div”).height = 150 ;
B. $(“div”).height = “150” ;
C. $(“div”).height(150);
D. None of the above
Show Answer
Answer:-C. $(“div”).height(150);Explanation
The jQuery height() method is used to set the height of every matched element or return the current computed height for the first element. When it is used to set the height, then it will set the height of every matched element, and when it is used to return the height, the height() method will return the height of the first matched element.Q 9. Which of the following is the basic requirement to start with jQuery?
A. To use jQuery, we have to refer to its hosted library, or we can download the latest jQuery version from its official website.
B. To use jQuery, we don’t require anything as it is already built in the browser we are using.
C. To use jQuery, first, we have to buy the jQuery library from its official website.
D. All of the above
Show Answer
Answer:-A. To use jQuery, we have to refer to its hosted library, or we can download the latest jQuery version from its official website.Explanation
To start with jQuery, we need to refer to its library, or we can download the latest version of jQuery from jQuery.com.Q 10. CDN stands for –
A. Content development network
B. Communication development network
C. Content delivery network / Content distribution network
D. None of the above
Show Answer
Answer:-C. Content delivery network / Content distribution networkExplanation
CDN stands for Content Delivery Network or Content Distribution Network. It is a large distributed system of servers deployed in multiple data centers across the internet. It provides the files from servers at a higher bandwidth that leads to faster loading time.Q 11. The jQuery method used to find all previous sibling elements of the current element is –
A. nextAll() method
B. siblings() method
C. prevAll() method
D. None of the above
Show Answer
Answer:-C. prevAll() methodExplanation
The prevAll() method is jQuery’s inbuilt function that returns all previous siblings of the selected element. This method traverses backward along with the previous siblings of DOM elements. Whereas the siblings() method returns all next and previous siblings of the specified selector.Q 12. The jQuery method used to return the direct parent element of the selected element is –
A. parents() method
B. parent() method
C. offset Parent() method
D. None of the above
Show Answer
Answer:-B. parent() methodExplanation
The parent() method in jQuery finds the direct parent of the given selector. It is an inbuilt function in jQuery. This method only traverses a single level up in the DOM tree and returns the direct parent of the selected element.Q 13. The jQuery method used to load data using HTTP get is –
A. get(URL, data, callback, dataType) method
B. post(URL, data, callback, dataType) method
C. ajax() method
D. ajaxSend() method
Show Answer
Answer:-A. get(URL, data, callback, dataType) methodExplanation
The get() method is an inbuilt function in jQuery. It loads data from the server using the HTTP GET request. It is used for making a simple GET request. It returns XMLHttp Request object.Q 14. Can we use multiple document.ready() function on the same page?
A. Yes
B. No
C. Can’t say
D. Not possible
Show Answer
Answer:-A. YesExplanation
We can use any number of document.ready() function on the same page. For example: $(document).ready(function() { $(“h1”).css(“background-color”, “red”); }); $(document).ready(function() { $(“p”).css(“background-color”, “pink”); });Q 15. The code $(“p”).css(“background-color”,”yellow”) is equivalent to –
A. jq(“p”).css(“background-color”,”yellow”)
B. document(“p”).css(“background-color”,”yellow”)
C. jQuery(“p”).css(“background-color”,”yellow”)
D. None of the above
Show Answer
Answer:-C. jQuery(“p”).css(“background-color”,”yellow”)Explanation
Instead of using the $ (dollar sign), we can use jQuery as a function name. For example: jQuery(document).ready(function() { jQuery(“p”).css(“background-color”, “yellow”); });Q 16. Which of the following jQuery method is used to add/remove one or more classes from the selected elements?
A. toggleClass() method
B. fadeToggle() method
C. toggle() method
D. slideToggle() method
Show Answer
Answer:-A. toggleClass() methodExplanation
The jQuery toggleCLass() method is used to add or remove one or more classes from the selected elements. This method toggles between adding and removing one or more class name. It checks each element for the specified class names. If the class name is already set, it removes, and if the class name is missing, it adds.Q 17. What does the syntax $(“p”) will select?
A. All paragraph elements
B. Only first paragraph element
C. Only last paragraph element
D. None of the above
Show Answer
Answer:-A. All paragraph elementsExplanation
In jQuery, the syntax $(“p”) will select all paragraph elements.Q 18. What does the syntax $(“p span”) will select?
A. Only last span element inside the paragraph element
B. Only first span element inside the paragraph element
C. All span elements inside the paragraph element
D. None of the above
Show Answer
Answer:-C. All span elements inside the paragraph elementExplanation
In jQuery, the syntax $(“p span”) will select all span elements inside a paragraph element.Q 19. The selector $(“:disabled”) will select –
A. The elements with the text “:disabled”
B. The elements that do not include the text “:disabled”
C. The hidden elements
D. All disabled input elements
Show Answer
Answer:-D. All disabled input elementsExplanation
The :disabled selector is used to select all disabled form elements. It is a pseudo-class selector that can also be used to style the disabled UI elements. This selector can only be used for the HTML elements that support the disabled attribute.Q 20. Which of the following selector in jQuery is used to select the elements with lesser index value than the value of its index parameter?
A. jQuery :gt() selector
B. jQuery :lt() selector
C. jQuery :lang() selector
D. jQuery :nth-child selector
Show Answer
Answer:-B. jQuery :lt() selectorExplanation
The :lt() selector selects the elements that have lesser index value than the value specified in the index parameter of the :lt() selector. The index starts at 0.Q 21. Which of the following method in jQuery is used to make copies of the set of matched elements?
A. jQuery clone() method
B. jQuery delegate() method
C. jQuery detach() method
D. jQuery serialize() method
Show Answer
Answer:-A. jQuery clone() methodExplanation
The jQuery clone() method is used to make copies of the set of matched elements. It also makes copies of their child nodes, texts and attributes. The clone() method is a convenient way to duplicate elements on a page.Q 22. The jQuery method which is used to remove the tabs, space and the line breaks from the beginning and end of the specified string is –
A. jQuery empty() method
B. jQuery serialize() method
C. jQuery remove() method
D. jQuery trim() method
Show Answer
Answer:-D. jQuery trim() methodExplanation
The trim() method in jQuery is used to remove the space, tabs, and all line breaks from the starting and end of the specified string. This method does not remove these characters if these whitespace characters are in the middle of the string.Q 23. Which of the following jQuery method returns the direct children of the selected element?
A. jQuery children() method
B. jQuery next() method
C. jQuery ancestors() method
D. None of the above
Show Answer
Answer:-A. jQuery children() methodExplanation
The children() method in jQuery returns the direct children of the given selector. It is an inbuilt method in jQuery.Q 24. Which of the following jQuery method returns all siblings of the selected element?
A. jQuery ancestors() method
B. jQuery parents() method
C. jQuery siblings() method
D. None of the above
Show Answer
Answer:-C. jQuery siblings() methodExplanation
As its name implies, the siblings() method returns all siblings of the selected element. It is an inbuilt method in jQuery.Q 25. The jQuery selector used to select the elements containing the specified string is –
A. jQuery :nth-child selector
B. jQuery :lang() selector
C. jQuery :contains selector
D. None of the above
Show Answer
Answer:-C. jQuery :contains selectorExplanation
The :contains() selector in jQuery selects the elements that contain the specified string. The matching string can be directly appeared in the selected element or in the descendants of that element.Q 26. The jQuery selector used to select the elements with the specified language code is –
A. jQuery :lang() selector
B. jQuery :contains selector
C. jQuery :nth-child selector
D. None of the above
Show Answer
Answer:-A. jQuery :lang() selectorExplanation
The :lang() selector is used to select the elements with the specified language code. It selects the elements whose language value is equal to the supplied language code. We can use the lang attribute in HTML to determine the language value of the elements.Q 27. Which of the following jQuery method is used to replace all selected elements with new HTML elements?
A. jQuery replaceWith() method
B. jQuery load() method
C. jQuery replaceAll() method
D. jQuery delegate() method
Show Answer
Answer:-C. jQuery replaceAll() methodExplanation
The replaceAll() method in jQuery replaces all selected elements with new HTML elements. This method replaces the elements and their contents with other HTML elements. It returns the selected elements with new content.Q 28. The jQuery method used to trigger a specified event handler for the selected element is –
A. jQuery next() method
B. jQuery toggle() method
C. jQuery eq() method
D. jQuery trigger() method
Show Answer
Answer:-D. jQuery trigger() methodExplanation
The trigger() method is used to trigger the specified event handler for every matched element. This method can also be used to trigger the default behavior for the selected elements.Q 29. Which of the following method is used to remove the specified attribute from the selected element?
A. jQuery remove() method
B. jQuery removeAttr() method
C. jQuery empty() method
D. jQuery error() method
Show Answer
Answer:-B. jQuery removeAttr() methodExplanation
The removeAttr() method is used to remove attributes from the element. This method is used to remove the specified attribute from the selected element.Q 30. Which of the following jQuery method is used to merge the content of two or more objects into the first object?
A. jQuery eq() method
B. jQuery extend() method
C. jQuery data() method
D. jQuery param() method
Leave a Reply