Ajax Multiple QB Ewr
Ajax Multiple QB Ewr
Ajax Multiple QB Ewr
Ajax MCQs: This section contains Ajax Multiple-Choice Questions with Answers.
These Ajax MCQs are written for beginners as well as advanced, practice these MCQs
to enhance and test the knowledge of Ajax.
A. Web applications
B. Desktop applications
C. System applications
D. Both A. and B.
Explanation:
Ajax is used for creating better, faster, and more interactive web applications with the
help of XML, HTML, CSS, and JavaScript.
Explanation:
Answer: A & B
Explanation:
A. WWW
B. SMTP
C. HTTP
D. All of the above
Answer: C) HTTP
Explanation:
Explanation:
Ajax makes data requests asynchronously – it's a feature that makes the Ajax unique.
A. in the background
B. before loading the page
C. with reloading the page
D. All of the above
Explanation:
A. with
B. without
Answer: B) without
Explanation:
A. one
B. two
C. three
D. four
Answer: B) two
Explanation:
Explanation:
There are two types of triggers present in update panel, which are:
• PostBackTrigger
• AsyncPostBackTrigger
Answer: A) Specifies a control and event that will cause a full-page update
Explanation:
The PostBackTrigger trigger is used for specifying a control and event that will
cause a full-page update.
Answer: B) Specifies a control and event that will cause a partial page update
Explanation:
The AsyncPostBackTrigger trigger is used for specifying a control and event that
will cause a partial page update.
12. Which formats are supported by Ajax to send and receive information?
Explanation:
Ajax can send and receive information in various formats, including JSON, XML,
HTML, and text files.
Explanation:
Explanation:
The combination of Asynchronous JavaScript and XML give Ajax its name.
A. Oracle
B. Google
C. Microsoft
D. Facebook
Answer: B) Google
Explanation:
Explanation:
Ajax is about updating parts of a web page, without reloading the full-page.
A. Bandwidth utilization
B. More interactive
Explanation:
• Bandwidth utilization
• More interactive
• Speeder retrieval of data
Explanation:
In the Ajax – Update panel is a server control used to update the specified portion of
a web page.
19. Which object can be used to exchange data with a server behind the scenes?
A. XMLHttpRequest
B. HttpsRequest
C. JSONHttpRequest
D. All of the above
Answer: A) XMLHttpRequest
Explanation:
The XMLHttpRequest object can be used to exchange data with a server behind the
scenes.
A. XMLHttpRequest() variable
B. XMLHttpRequest() variable;
C. variable = new XMLHttpRequest()
D. variable = new XMLHttpRequest();
Explanation:
A. cancel()
B. abort()
C. stop()
D. pause()
Answer: B) abort()
Explanation:
A. getAllResponseHeaders()
B. getResponseHeaders()
C. getHeaderInformation()
D. getAllHeaderInformations()
Answer: A) getAllResponseHeaders()
Explanation:
A. getResponseHeader()
B. getSpecifcHeader()
C. getHeaderOnly()
D. getHeaderInfo()
Answer: A) getResponseHeader()
Explanation:
A. getRequestHeader()
B. setAllRequestHeader()
C. setRequestHeader()
D. getAllRequestHeader()
Answer: C) setRequestHeader()
Explanation:
A. readyState
B. holdState
C. pauseState
D. stopState
Answer: A) readyState
Explanation:
A. getText
B. getResponseText
C. responseText
D. responseAllText
Answer: C) responseText
Explanation:
A. getXML
B. getResponseXML
C. responseXML
D. responseAllXML
Answer: C) responseXML
Explanation:
A. statusText
B. statusXML
C. status-number
D. status
Answer: D) status
Explanation:
A. statusText
B. statusXML
C. status-number
D. status
Answer: A) statusText
Explanation:
30. "GET is simpler and faster than POST." – Is this statement true?
A. Yes
B. No
Answer: A) Yes
Explanation:
Yes, the statement "GET is simpler and faster than POST." is true.
31. Which is the correct syntax to add HTTP headers to the request?
A. setRequestHeader(value, header)
B. setAllRequestHeader(value, header)
C. setRequestHeader(header, value)
D. setAllRequestHeader(header, value)
Explanation:
setRequestHeader(header, value)
Explanation:
33. Which are the two properties to hold the status of XMLHttpRequest?
Explanation:
The status and statusText properties are used to hold the status of
the XMLHttpRequest object.
A. OK
B. Forbidden
C. Method Not Allowed
D. Page not found
Explanation:
35. The ______ function is called every time the readyState changes.
A. getreadystatechange
B. onreadystatechange
C. onsetreadystatechange
D. toreadystatechange
Answer: B) onreadystatechange
Explanation:
2) jQuery is a -
a. JavaScript method
b. JavaScript library
c. JSON library
d. PHP method
a. the % sign
b. the & sign
c. the $ sign
d. the @ sign
46.7M
755
Hello Java Program for Beginners
5) Which of the following jQuery method is used to hide the selected elements?
6) Which jQuery method is used to set one or more style properties to the selected
element?
7) Which of the following jQuery method can be used to deal with the name conflicts?
8) The correct syntax to set the background color of all h1 elements to yellow in jQuery -
a. $("h1").style("background-color","yellow");
b. $("h1").html("background-color","yellow");
c. $("h1").css("background-color","yellow");
d. $("h1").layout("background-color","yellow");
a. unbind() method
b. attach() method
c. bind() method
d. None of the above
11) Which of the following jQuery method is used to stop jQuery for few milliseconds?
a. stop() method
b. delay() method
c. slowdown() method
d. pause() method
13) Which of the jQuery function prevents the code from running before the loading of
the document finishes?
a. $(document).load()
b. $(document).unload()
c. $(document).ready()
d. $(document).trim()
14) The jQuery used to find all next sibling elements after the current element is -
a. find() method
b. nextAll() method
c. siblings() method
d. None of the above
15) The correct syntax for selecting the first paragraph element with id p1 is -
a. $("p.p1:first")
b. $("p#p1:first")
c. $("p1#p:first")
d. None of the above
16) Which of the following jQuery method is used to check whether or not the selected
elements have the specified class name?
a. hasClass() method
b. addClass() method
c. find() method
d. toggleClass() method
17) Which of the following jQuery method is used to set the value of an element?
a. val() method
b. setValue() method
c. content() method
d. None of the above
Explanation: There are two usages of the jQuery val() method. It can be used to set
the value of every matched element. It can also be used to get the current value of the
first element in the set of matched elements.
18) The jQuery method used to set the width property of an element is -
19) The jQuery method used to get all ancestors of the matched set of elements is -
a. parents() method
b. parent() method
c. offsetParent() method
d. None of the above
20) The jQuery method used to remove the set of matched elements is -
a. delete() method
b. empty() method
c. remove() method
d. None of the above
21) The jQuery method used for parsing the JSON text is -
a. parseJSON() method
b. parseHTML() method
c. noConflict() method
d. each() method
a. It will select all elements with class = "para" within the div element with id =
"myDiv"
b. It will select all elements with id = "myDiv" within the div element with class =
"para"
c. All div elements with class = "para" or with id = "myDiv"
d. None of the above
23) 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. eq() method
d. delegate() method
25) Which of the following method is used to toggle between the fadeIn() method and
fadeOut() method?
a. toggle() method
b. fadeToggle() method
c. slideToggle() method
d. animate() method
27) 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
28) 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
29) Which of the following is the basic requirement to start with jQuery?
a. To use jQuery, first, we have to buy the jQuery library 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, we have to refer to its hosted library, or we can download the
latest jQuery version from its official website.
d. All of the above
31) The jQuery method used to find all previous sibling elements of the current element
is -
a. nextAll() method
b. prevAll() method
c. siblings() method
d. None of the above
32) The jQuery method used to return the direct parent element of the selected element
is -
a. parents() method
b. parent() method
c. offsetParent() method
d. None of the above
33) The jQuery method used to load data using HTTP get is -
a. Yes
b. No
c. Can't say
d. Not possible
a. jQuery("p").css("background-color","yellow")
b. document("p").css("background-color","yellow")
c. jq("p").css("background-color","yellow")
d. None of the above
36) 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
40) Which of the following selector in jQuery is used to select the elements with lesser
index value than the value of its index parameter?
41) Which of the following method in jQuery is used to make copies of the set of matched
elements?
42) 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 -
43) Which of the following jQuery method returns the direct children of the selected
element?
44) Which of the following jQuery method returns all siblings of the selected element?
45) The jQuery selector used to select the elements containing the specified string is -
46) The jQuery selector used to select the elements with the specified language code is -
47) Which of the following jQuery method is used to replace all selected elements with
new HTML elements?
48) The jQuery method used to trigger a specified event handler for the selected element
is -
49) Which of the following method is used to remove the specified attribute from the
selected element?
50) Which of the following jQuery method is used to merge the content of two or more
objects into the first object?
jQuery MCQs: This section contains jQuery Multiple-Choice Questions with Answers.
These jQuery MCQs are written for beginners as well as advanced, practice these
MCQs to enhance and test the knowledge of jQuery.
A. JavaScript Library
B. JSON Library
C. Java Library
D. JSON and CSS Library
Explanation:
2. To work with jQuery, you should have the basic knowledge of these topics?
A. HTML
B. CSS
C. JavaScript
D. All of the above
Explanation:
To work with jQuery, you should have the basic knowledge of HTML, CSS, and
JavaScript.
A. John Richard
B. John Resig
C. John Carter
D. John Alexander
Explanation:
A. 2004
B. 2005
C. 2006
D. 2007
Answer: C) 2006
Explanation:
5. Is jQuery case-sensitive?
A. Yes
B. No
Answer: A) Yes
Explanation:
A. HTML/DOM manipulation
B. CSS manipulation
C. HTML event methods
D. Effects and animations
E. AJAX
F. Utilities
G. All of the above
Explanation:
A. $
B. .
C. &
D. #
Answer: A) $
Explanation:
A. $(this).hideelement()
B. $(this).hide('true')
C. $(this).hide(0)
D. $(this).hide()
Answer: D) $(this).hide()
Explanation:
A. $("div").hide()
B. $(div).hide()
C. $(".div").hide()
D. $("#div").hide()
Answer: A) $("div").hide()
Explanation:
10. Which is the correct jQuery statement to hide all elements having class
name "new"?
A. $("new").hide()
B. $(new).hide()
C. $(".new").hide()
D. $("#new").hide()
Answer: C) $(".new").hide()
Explanation:
The $(".new").hide() statement can be used to hide all elements having class
name "new".
11. Which is the correct jQuery statement to hide all elements having id name
"new"?
A. $("new").hide()
B. $(new).hide()
C. $(".new").hide()
D. $("#new").hide()
Answer: D) $("#new").hide()
Explanation:
The $("#new").hide() statement can be used to hide all elements having id name
"new".
Answer: A) jQuery selectors are used to select and manipulate HTML element(s)
Explanation:
13. Which is the correct jQuery selector statement to select all <div> elements?
A. $(".div")
B. $("#div")
C. $("div")
D. $("<div>")
Answer: C) $("div")
Explanation:
The statement $("div") is the correct syntax to select all <div> elements.
A. $class
B. .class
C. #class
D. None
Answer: C) .class
Explanation:
The dot sign (.) i.e., .class is used for the class selector.
A. $id
B. .id
C. #id
D. None
Answer: C) #id
Explanation:
The hash sign (#) i.e., #id is used for the id selector.
Explanation:
The #id selectors are used to select all elements having the id.
A. $("all")
B. $("*.*")
C. $("*")
D. $("***")
Answer: C) $("*")
Explanation:
18. Which is the correct jQuery selector to select current HTML element?
A. $(this)
B. $(cur)
C. $(.this)
D. $(#this)
Answer: A) $(this)
Explanation:
19. Which is the correct jQuery selector to select all <div> elements with class
name "new"?
A. $(".new")
B. $("div.new")
C. $(".div.new")
D. $(".div#new")
Answer: B) $("div.new")
Explanation:
The $("div.new") selector is used to select all <div> elements with class name
"new".
20. Which is the correct jQuery selector to select the first HTML element?
A. $("element_name.first")
B. $("element_name#first")
C. $("element_name::first")
D. $("element_name:first")
Answer: D) $("element_name:first")
Explanation:
21. Which is the correct jQuery selector to select the first <div> of the HTML
document?
A. $("div.first")
B. $("div#first")
C. $("div::first")
D. $("div:first")
Answer: D) $("div:first")
Explanation:
The $("div:first") selector is used to select the first <div> of the HTML
document.
22. Which is the correct jQuery selector to select the first list item of <ul>
element?
A. $("ul li:first")
B. $("ul:first")
C. $("li:first")
D. $("ul.li:first")
Explanation:
The $("ul li:first") selector is used to select the first list item of <ul> element.
23. Which is the correct jQuery selector to select the first list item of every <ul>
element?
A. $("ul li:first-child")
B. $("ul li:first.*")
C. $("li:first-child")
D. $("ul:first-child")
Explanation:
The $("ul li:first-child") selector is used to select the first list item of
every <ul> element.
24. Which is the correct jQuery selector to select all elements having "href"
attribute?
A. $("a.[href]")
B. $("a:[href]")
C. $("[href].*")
D. $("[href]")
Answer: D) $("[href]")
Explanation:
The $("[href]") selector is used to select all elements having href attribute.
25. Which is the correct jQuery selector to select all <button> elements and
<input> elements with type="input"?
A. $(".button")
B. $(":button")
C. $("button","input type="button")
D. $(":button,:input")
Answer: B) $(":button")
Explanation:
26. Which is the correct jQuery selector to select all even table rows?
A. $("tr::even")
B. $("tr.even")
C. $("tr:even")
D. $("tr:#even")
Answer: C) $("tr:even")
Explanation:
27. Which is the correct jQuery selector to select all odd table rows?
A. $("tr::odd")
B. $("tr.odd")
C. $("tr:odd")
D. $("tr:#odd")
Answer: C) $("tr:odd")
Explanation:
A. click()
B. Click()
C. dblclick()
D. DblClick()
Answer: A) click()
Explanation:
The jQuery method click() is used to attach an event handler function to an HTML
element on mouse click.
A. click()
B. Click()
C. dblclick()
D. DblClick()
Answer: C) dblclick()
Explanation:
A. mouseover()
B. mousevisit()
C. mouse-enter()
D. mouseenter()
Answer: D) mouseenter()
Explanation:
A. mouseLeave()
B. mouseleave()
C. mouse-leave()
D. mouseexit()
Answer: B) mouseleave()
Explanation:
A. mousedown()
B. mouseover()
C. mousepress()
D. mousekey()
Answer: A) mousedown()
Explanation:
A. mouseup()
B. mouseover()
C. mouseabove()
D. mousekey()
Answer: A) mouseup()
Explanation:
A. mousemove()
B. mouseover()
C. hover()
D. mousehover()
Answer: C) hover()
Explanation:
The jQuery method hover() is used to attach an event handler function to an HTML
element when the mouse moves over the HTML elements.
A. focused()
B. focuses()
C. focuselement()
D. focus()
Answer: D) focus()
Explanation:
The jQuery method focus() is used to attach an event handler function to an HTML
element when the form field gets focus.
A. blur()
B. leave()
C. focusleave()
D. leavefocus()
Answer: A) blur()
Explanation:
The jQuery method blur() is used to attach an event handler function to an HTML
element when the form field loses focus.
37. Which method is used to attach one or more event handlers for the selected
elements?
A. at()
B. atelements()
C. on()
D. focuson()
Answer: C) on()
Explanation:
The jQuery method on() is used to attach one or more event handlers for the
selected elements.
Explanation:
The toggle() method is used to hide the shown elements and to show the hidden
elements.
A. fade()
B. fadeIn()
C. fadeOut()
D. fadeToggle()
Answer: B) fadeIn()
Explanation:
A. $(selector).fadeIn();
B. $(selector).fadeIn(callback, speed);
C. $(selector).fadeIn(callback);
D. $(selector).fadeIn(speed,callback);
Answer: D) $(selector).fadeIn(speed,callback);
Explanation:
$(selector).fadeIn(speed,callback);
A. fadeout()
B. fadeIn()
C. fadeOut()
D. fadeToggle()
Answer: C) fadeOut()
Explanation:
A. $(selector).fadeOut();
B. $(selector).fadeOut(callback, speed);
C. $(selector).fadeOut(callback);
D. $(selector).fadeOut(speed,callback);
Answer: D) $(selector).fadeOut(speed,callback);
Explanation:
$(selector).fadeOut(speed,callback);
43. Which jQuery method toggles between the fadeIn() and fadeOut()
methods?
A. toggle()
B. Toggle()
C. fadeToggle()
D. fadetoggle()
Answer: C) fadeToggle()
Explanation:
A. $(selector).fadeToggle();
B. $(selector).fadeToggle(callback, speed);
C. $(selector).fadeToggle(callback);
D. $(selector).fadeToggle(speed,callback);
Answer: D) $(selector).fadeToggle(speed,callback);
Explanation:
$(selector).fadeToggle(speed,callback);
45. Which jQuery method allows fading to a given opacity (value between 0
and 1)?
A. fade()
B. fadeOpacity()
C. fadeTo()
D. fadeto()
Answer: C) fadeTo()
Explanation:
The jQuery fadeTo() method allows fading to a given opacity (value between 0 and
1).
46. Which is the correct jQuery statement to fade out a <p> element?
A. $("p").fadeOut();
B. $("#p").fadeOut();
C. $(".p").fadeOut();
D. $("p").fadeout();
Answer: A) $("p").fadeOut();
Explanation:
$("p").fadeOut();
47. Which is the correct jQuery statement to fade out a <p> element with
duration effect "slow"?
A. $("p").fadeOut("slow");
B. $("#p").fadeOut("slow");
C. $(".p").fadeOut("slow");
D. $("p").fadeout();
Answer: A) $("p").fadeOut("slow");
Explanation:
The jQuery statement to fade out a <p> elements with duration effect "slow" is:
$("p").fadeOut("slow");
A. slideBottom()
B. slideDown()
C. slidedown()
D. slide()
Answer: B) slideDown()
Explanation:
A. slideUp()
B. slideBottom()
C. slidebottom()
D. slide()
Answer: A) slideUp()
Explanation:
50. Which jQuery method toggles between the slideDown() and slideUp()
methods?
A. slide ()
B. slideSwitch()
C. slidetoggle()
D. slideToggle()
Answer: D) slideToggle()
Explanation:
A. animation()
B. slidAnimate()
C. animate()
D. SlideAnimate()
Answer: C) animate()
Explanation:
A. $(selector).animate({params},speed,callback);
B. $(#selector).animate({params},speed,callback);
C. $(selector).animate(speed,callback);
D. $(selector).animate({speed,callback,params});
Answer: A) $(selector).animate({params},speed,callback);
Explanation:
$(selector).animate({params},speed,callback);
Explanation:
The params parameter of jQuery animate() method is used to define the CSS
property to be animated.
54. In the syntax of animate() method, what is/are the valid value(s) of speed
parameter?
A. slow
B. fast
C. milliseconds
D. All of the above
Explanation:
The following are the correct value of the speed parameter are:
• slow
• fast
• milliseconds
A. animate(false)
B. animate('false')
C. animate("false")
D. stop()
Answer: D) stop()
Explanation:
A. $(selector).stop(stopAll,goToEnd);
B. $(selector).stop(speed,callback);
C. $(selector).stop(stopAll,goToEnd,callback);
D. $(selector).stop(stopAll,speed);
Answer: A) $(selector).stop(stopAll,goToEnd);
Explanation:
$(selector).stop(stopAll,goToEnd);
Explanation:
58. Which jQuery DOM method is used to set or return the text content of
selected elements?
A. content()
B. text()
C. html()
D. val()
Answer: B) text()
Explanation:
The jQuery DOM method text() is used to set or return the text content of selected
elements.
59. Which jQuery DOM method is used to set or return the content of selected
elements (including HTML markup)?
A. content()
B. text()
C. html()
D. val()
Answer: C) html()
Explanation:
The jQuery DOM method html() is used to set or return the content of selected
elements (including HTML markup).
60. Which jQuery DOM method is used to set or return the value of form fields?
A. content()
B. text()
C. html()
D. val()
Answer: D) val()
Explanation:
The jQuery DOM method val() is used to set or return the value of form fields.
61. Which is the correct jQuery statement to get the text content of an HTML
element having id "notification"?
A. $("notification").text()
B. $("#notification").text()
C. $(".notification").text()
D. $("#notification").val()
Answer: B) $("#notification").text()
Explanation:
62. Which jQuery DOM method is used to get the attribute value?
A. attr()
B. attribute()
C. attrib()
D. val()
Answer: A) attr()
Explanation:
The jQuery DOM method attr() is used to get the attribute value.
63. Which is the correct jQuery statement to get the value "href" attribute
having id "top"?
A. $("top").attr("href")
B. $(".top").attr("href")
C. $("$top").attr("href")
D. $("#top").attr("href")
Answer: D) $("#top").attr("href")
Explanation:
64. Which jQuery DOM method is used to insert content at the end of the
selected elements?
A. insert()
B. add()
C. append()
D. appendValue()
Answer: C) append()
Explanation:
The jQuery DOM method append() is used to insert content at the end of the
selected elements.
65. Which jQuery DOM method is used to insert content at the beginning of the
selected elements?
A. insert()
B. before()
C. append()
D. prepend()
Answer: D) prepend()
Explanation:
The jQuery DOM method prepend() is used to insert content at the beginning of
the selected elements.
66. Which jQuery DOM method is used to insert content after the selected
elements?
A. after()
B. postpend()
C. addafter()
D. prepend()
Answer: A) after()
Explanation:
The jQuery DOM method after() is used to insert content after the selected
elements.
67. Which jQuery DOM method is used to insert content before the selected
elements?
A. before()
B. addbefore()
C. addprepend()
D. prepend()
Answer: A) before()
Explanation:
The jQuery DOM method before() is used to insert content before the selected
elements.
68. Which is the correct syntax to insert content at the end of the <p>
elements?
A. $("#p").append("Text to be added");
B. $("p").before("Text to be added");
C. $("p").append("Text to be added");
D. $("p").prepend("Text to be added");
Explanation:
The correct syntax to insert content at the end of the <p> elements is:
$("p").append("Text to be added");
69. Which is the correct syntax to insert content at the beginning of the <p>
elements?
A. $("#p").before("Text to be added");
B. $("p").addafter("Text to be added");
C. $("p").after("Text to be added");
D. $("p").prepend("Text to be added");
Explanation:
The correct syntax to insert content at the beginning of the <p> elements is:
$("p").prepend("Text to be added");
70. Which is the correct syntax to insert content after the <div> elements?
A. $("div").after("Text to be added");
B. $("div").postpend("Text to be added");
C. $("div").addafter("Text to be added");
D. $("#div").after("Text to be added");
Explanation:
The correct syntax to insert content after the <div> elements is:
$("div").after("Text to be added");
71. Which is the correct syntax to insert content before the <div> elements?
A. $("div").before("Text to be added");
B. $("div").pretpend("Text to be added");
C. $("div").addbefore("Text to be added");
D. $("#div").before("Text to be added");
Explanation:
The correct syntax to insert content before the <div> elements is:
$("div").before("Text to be added");
A. remove() removes the selected element and its child elements while empty()
removes the child elements of the selected element
B. remove() removes the child elements of the selected element while empty()
removes the selected elements and its child elements
C. remove() removes the child elements while empty() removes the content of
the selected element
D. remove() removes the child elements while empty() removes the content of
the selected element and its child elements
Answer: A) remove() removes the selected element and its child elements while
empty() removes the child elements of the selected element
Explanation:
The difference between remove() and empty() methods is: remove() removes the
selected element and its child elements while empty() removes the child elements of
the selected element.
73. Write a jQuery statement to remove all child elements only from the
element having id "notif"?
A. $("notif").empty();
B. $("#notif").empty();
C. $(".notif").empty();
D. $("<notif>").empty();
Answer: B) $("#notif").empty();
Explanation:
The jQuery statement to remove all child elements only from the element having id
"notif" is:
$("#notif").empty();
74. Write a jQuery statement to remove all <p> elements with class="prog"?
A. $(".prog").remove();
B. $("p").empty(".prog");
C. $("p").remove(".prog");
D. $("p.prog").remove();
Answer: C) $("p").remove(".prog");
Explanation:
The jQuery statement to removes all <p> elements with class="prog" is:
$("p").remove(".prog");
75. Write a jQuery statement to remove all <pre> elements with class="prog"
and class="old"?
A. $(".prog#old").remove();
B. $("pre").empty(".prog",".old");
C. $("pre").remove(".prog, .old");
D. $("pre.prog.old").remove();
Explanation:
$("pre").remove(".prog, .old");
76. Which method is used to add CSS class to the selected elements?
A. add()
B. addClass()
C. addClasses()
D. AddClasses()
Answer: B) addClass()
Explanation:
The jQuery method addClass() is used to add CSS class to the selected elements.
77. Can we add more than one CSS classes to the selected elements using the
addClass() method?
A. Yes
B. No
Answer: A) Yes
Explanation:
Yes, we can add more than one CSS classes to the selected elements using
the addClass() method.
78. Which method is used to remove CSS class to the selected elements?
A. removeCSS()
B. removeClass()
C. removeClasseses()
D. RemoveClass()
Answer: B) removeClass()
Explanation:
The jQuery method removeClass() is used to remove CSS class to the selected
elements.
79. Which method is used to set or get the CSS style attribute?
A. cssAttribute()
B. attribute()
C. attr()
D. css()
Answer: D) css()
Explanation:
The jQuery method css() is used to get or set the CSS style attribute.
80. Which is the correct syntax to get the value of a CSS style
attribute/property using the css() method?
A. css("propertyname");
B. css(propertyname);
C. css(".propertyname");
D. css("#propertyname");
Answer: A) css("propertyname");
Explanation:
The correct syntax to get the value of a CSS style attribute/property using
the css() method is: css("propertyname");
81. Which is the correct syntax to set the value of a CSS style attribute/property
using the css() method?
A. css("propertyname"="value");
B. css("propertyname","value");
C. css("propertyname":"value");
D. css("propertyname":="value");
Answer: B) css("propertyname","value");
Explanation:
The correct syntax to set the value of a CSS style attribute/property using
the css() method is:
css("propertyname","value");
82. Which is the correct jQuery statement to set background color and text
decoration to all <p> elements?
Explanation:
The correct jQuery statement to set background color and text decoration to
all <p> elements is:
83. Which jQuery method is used to get or set the width of an HTML element?
A. cssWidth()
B. Csswidth()
C. lenght()
D. width()
Answer: D) width()
Explanation:
The jQuery method width() is used to get or set the width of an HTML element.
84. Which jQuery method is used to get or set the height of an HTML element?
A. cssHeight()
B. CssHeight()
C. height()
D. getHeight()
Answer: C) height()
Explanation:
The jQuery method height() is used to get or set the height of an HTML element.
85. Which jQuery methods are used to get or set the width and height of an
HTML element including the paddings?
Explanation:
The jQuery methods innerWidth() and innerHeight() are used to get or set the
width and height of an HTML element including the paddings.
86. Which jQuery methods are used to get or set the width and height of an
HTML element including the paddings and borders?
Explanation:
The jQuery methods outerWidth() and outerHeight() are used to get or set the
width and height of an HTML element including the paddings and borders.
87. Which are the jQuery methods for traversing up the DOM tree?
A. parent()
B. parents()
C. parentsUntil()
D. All of the above
Explanation:
These are the jQuery methods for traversing up the DOM tree:
i. parent()
ii. parents()
iii. parentsUntil()
88. Which jQuery method is used to get the direct parent element of the
selected element?
A. parent()
B. parents()
C. parentsUntil()
D. All of the above
Answer: A) parent()
Explanation:
jQuery method parent() is used to get the direct parent element of the selected
element.
89. Which jQuery method is used to get the all ancestor elements of the
selected element, all the way up to the document's root element (<html>)?
A. parent()
B. parents()
C. parentsUntil()
D. All of the above
Answer: B) parents()
Explanation:
jQuery method parents() is used to get the all ancestor elements of the selected
element, all the way up to the document's root element (<html>).
90. Which jQuery method is used to get the all ancestor elements between two
given arguments?
A. parent()
B. parents()
C. parentsUntil()
D. All of the above
Answer: C) parentsUntil()
Explanation:
jQuery method parentsUntil() is used to get the all ancestor elements between
two given arguments.
91. There is a <pre> element, write a jQuery statement to get it's parent?
A. $("pre").parent();
B. $("pre").parents();
C. $("pre").parentsUntil();
D. None of the above
Answer: A) $("pre").parent();
Explanation:
The correct jQuery statement to get the direct parent of a <pre> tag is:
$("pre").parent();
92. Which are the jQuery methods for traversing down the DOM tree?
A. children()
B. find()
C. childrens()
D. Both A. and B.
Explanation:
These are the jQuery methods for traversing down the DOM tree:
i. children()
ii. find()
93. Which jQuery method is used to get all direct children of the selected
element?
A. children()
B. find()
C. childrens()
D. Both A. and B.
Answer: A) children()
Explanation:
jQuery method children() is used to get all direct children of the selected element.
94. Which jQuery method is used to get descendant elements of the selected
element, all the way down to the last descendant?
A. children()
B. find()
C. childrens()
D. Both A. and B.
Answer: B) find()
Explanation:
jQuery method find() is used to get descendant elements of the selected element,
all the way down to the last descendant.
$(document).ready(function(){
$("pre").siblings();
});
Explanation:
The above code will return all sibling elements of <pre> element.
96. Which is the correct jQuery statement to change the color of all <p>
elements which are sibling elements of <pre>?
A. $("#pre").siblings("p").css({"color": "red"});
B. $(".pre").siblings("p").css({"color": "red"});
C. $("pre").siblings(".p").css({"color": "red"});
D. $("pre").siblings("p").css({"color": "red"});
Explanation:
The correct jQuery statement to change the color of all <p> elements which are
sibling elements of <pre> is:
$("pre").siblings("p").css({"color": "red"});
97. Which jQuery method is used to get the next sibling element of the selected
element?
A. sibling()
B. nextSibling()
C. next()
D. siblings()
Answer: C) next()
Explanation:
jQuery method next() is used to get the next sibling element of the selected
element.
98. Which jQuery method is used to get the all next sibling element of the
selected element?
A. siblingAll()
B. nextSiblingAll()
C. nextAll()
D. siblingsAll()
Answer: C) nextAll()
Explanation:
jQuery method nextAll() is used to get the all next sibling element of the selected
element.
99. Let suppose there are multiple <h3> elements in an HTML document, which
is the correct jQuery statement to get the first <h3> element?
A. $("h3").first();
B. $("h3").parent();
C. $("h3").firstParent();
D. $("h3").top();
Answer: A) $("h3").first();
Explanation:
The correct jQuery statement to get the first <h3> element is:
$("h3").first();
100. Let suppose there are multiple <h3> elements in an HTML document,
which is the correct jQuery statement to get the last <h3> element?
A. $("h3").last();
B. $("h3").children();
C. $("h3").lastChild();
D. $("h3").down();
Answer: A) $("h3").last();
Explanation:
The correct jQuery statement to get the last <h3> element is:
$("h3").last();