Ajax Multiple QB Ewr

Download as pdf or txt
Download as pdf or txt
You are on page 1of 64

lOMoARcPSD|42519590

AJAX Multiple QB - ewr

Electrical Engineering (North Lakhimpur College (Autonomous))

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by Chippy Vijayan ([email protected])
lOMoARcPSD|42519590

AJAX Multiple-Choice Questions (MCQs)


Ajax is a set of web development techniques that uses various web technologies
(XML, HTML, CSS, and JavaScript) on the client-side to create asynchronous web
applications. With Ajax, web applications can send and retrieve data from a server
asynchronously without interfering with the display and behavior of the existing
page.

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.

List of Ajax MCQs


1. Ajax is used for creating _____.

A. Web applications
B. Desktop applications
C. System applications
D. Both A. and B.

Answer: A) Web applications

Explanation:

Ajax is used for creating better, faster, and more interactive web applications with the
help of XML, HTML, CSS, and JavaScript.

2. Ajax stands for ______.

A. Asynchronous JavaScript and XML


B. Asynchronous JSON and XML
C. Asynchronous Java and XML
D. Asynchronous JavaScript and XMLHttpRequest

Answer: A) Asynchronous JavaScript and XML

Explanation:

AJAX stands for Asynchronous JavaScript and XML.

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

3. Which are the two major features of AJAX?

A. Make requests to the server without reloading the page


B. Receive and work with data from the server
C. Make requests to the server with reloading the page
D. Only receive the data from the server

Answer: A & B

Explanation:

The two major features of AJAX are:

• Make requests to the server without reloading the page


• Receive and work with data from the server

4. What server support Ajax?

A. WWW
B. SMTP
C. HTTP
D. All of the above

Answer: C) HTTP

Explanation:

HTTP server support Ajax.

5. Which of the following feature makes the Ajax unique?

A. It can work with all the databases


B. It is a server-side application can also be used to create servers
C. It can use Python & C++ for programming
D. It makes data requests asynchronously

Answer: D) It makes data requests asynchronously

Explanation:

Ajax makes data requests asynchronously – it's a feature that makes the Ajax unique.

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

6. Ajax sends data to a web server _____.

A. in the background
B. before loading the page
C. with reloading the page
D. All of the above

Answer: A) in the background

Explanation:

Ajax sends data to a web server in the background.

7. Ajax updates a web page ____ reloading the page.

A. with
B. without

Answer: B) without

Explanation:

Ajax updates a web page without reloading the page

8. How many types of triggers are present in update panel?

A. one
B. two
C. three
D. four

Answer: B) two

Explanation:

There are two types of triggers are present in update panel.

9. Which are the triggers present in update panel?

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

A. PostTrigger and AsyncPostTrigger


B. PostBackTrigger and SyncPostBackTrigger
C. SyncPostBackTrigger and AsyncPostBackTrigger
D. PostBackTrigger and AsyncPostBackTrigger

Answer: D) PostBackTrigger and AsyncPostBackTrigger

Explanation:

There are two types of triggers present in update panel, which are:

• PostBackTrigger
• AsyncPostBackTrigger

10. Why PostBackTrigger is used in update panel?

A. Specifies a control and event that will cause a full-page update


B. Specifies a control and event that will cause a partial page update
C. Specifies a control and event that will cause a full web application update
D. Specifies a control and event that will cause a full web application refresh

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.

11. Why AsyncPostBackTrigger is used in update panel?

A. Specifies a control and event that will cause a full-page update


B. Specifies a control and event that will cause a partial page update
C. Specifies a control and event that will cause a full web application update
D. Specifies a control and event that will cause a full web application refresh

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.

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

12. Which formats are supported by Ajax to send and receive information?

A. JSON, XML, HTML, SQL, MySQL, and Text Files


B. JSON, XML, HTML, and Text Files
C. JSON, XML, HTML, NoSQL, and Oracle
D. JAVA, JSON, XML, HTML, Oracle, and Text Files

Answer: B) JSON, XML, HTML, and Text Files

Explanation:

Ajax can send and receive information in various formats, including JSON, XML,
HTML, and text files.

13. Ajax technologies include ______.

A. HTML/XHTML and CSS


B. DOM
C. XML or JSON
D. XMLHttpRequest
E. JavaScript
F. All of the above

Answer: F) All of the above

Explanation:

Ajax technologies include the following technologies:

• HTML/XHTML and CSS


• DOM
• XML or JSON
• XMLHttpRequest
• JavaScript

14. Which technologies give Ajax its name?

A. Net and XML


B. ASP and XML

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

C. Asynchronous JavaScript, CSS, ASP, and XML


D. Asynchronous JavaScript and XML

Answer: D) Asynchronous JavaScript and XML

Explanation:

The combination of Asynchronous JavaScript and XML give Ajax its name.

15. Which company made Ajax popular?

A. Oracle
B. Google
C. Microsoft
D. Facebook

Answer: B) Google

Explanation:

AJAX was made popular in 2005 by Google, with Google Suggest.

16. Ajax is about updating ______, without reloading the full-page.

A. parts of a web page


B. parts of a database records
C. parts of a HTML tags dynamically
D. parts of a CSS classes dynamically

Answer: A) parts of a web page

Explanation:

Ajax is about updating parts of a web page, without reloading the full-page.

17. What are the advantages of Ajax?

A. Bandwidth utilization
B. More interactive

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

C. Speeder retrieval of data


D. All of the above

Answer: D) All of the above

Explanation:

The advantages of Ajax are:

• Bandwidth utilization
• More interactive
• Speeder retrieval of data

18. What is update panel in Ajax?

A. a server control used to update the specified portion of a web page


B. server control used to update the full-page after reloading the page
C. a dashboard used to update the specified portion of a web page
D. None of the above

Answer: C) a dashboard used to update the specified portion of a web page

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.

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

20. What is the correct syntax to create an XMLHttpRequest object?

A. XMLHttpRequest() variable
B. XMLHttpRequest() variable;
C. variable = new XMLHttpRequest()
D. variable = new XMLHttpRequest();

Answer: D) variable = new XMLHttpRequest();

Explanation:

The correct syntax to create an XMLHttpRequest object is:

variable = new XMLHttpRequest();

21. Which method cancels the current request?

A. cancel()
B. abort()
C. stop()
D. pause()

Answer: B) abort()

Explanation:

The abort() method is used to cancel the current request.

22. Which method returns the header information?

A. getAllResponseHeaders()
B. getResponseHeaders()
C. getHeaderInformation()
D. getAllHeaderInformations()

Answer: A) getAllResponseHeaders()

Explanation:

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

The getAllResponseHeaders() method is used to get the header information.

23. Which method returns the specific header information?

A. getResponseHeader()
B. getSpecifcHeader()
C. getHeaderOnly()
D. getHeaderInfo()

Answer: A) getResponseHeader()

Explanation:

The getResponseHeader() method is used to get the specific header information.

24. Which method adds a label/value pair to the header to be sent?

A. getRequestHeader()
B. setAllRequestHeader()
C. setRequestHeader()
D. getAllRequestHeader()

Answer: C) setRequestHeader()

Explanation:

The setRequestHeader() method is used to add a label/value pair to the header to


be sent.

25. Which property holds the status of the XMLHttpRequest?

A. readyState
B. holdState
C. pauseState
D. stopState

Answer: A) readyState

Explanation:

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

The readyState property is used to holds the status of the XMLHttpRequest.

26. Which property returns the response data as a string?

A. getText
B. getResponseText
C. responseText
D. responseAllText

Answer: C) responseText

Explanation:

The responseText property returns the response data as a string.

27. Which property returns the response data as XML data?

A. getXML
B. getResponseXML
C. responseXML
D. responseAllXML

Answer: C) responseXML

Explanation:

The responseXML property returns the response data as XML data.

28. Which property returns the status-number of a request?

A. statusText
B. statusXML
C. status-number
D. status

Answer: D) status

Explanation:

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

The status property returns the status-number of a request.

29. Which property returns the status-text?

A. statusText
B. statusXML
C. status-number
D. status

Answer: A) statusText

Explanation:

The statusText property returns the status-text.

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)

Answer: C) setRequestHeader(header, value)

Explanation:

The correct syntax to add HTTP headers to the request is,

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

setRequestHeader(header, value)

32. How to convert the below statement to the synchronous request?

xhttp.open("GET", "info.php", true);

A. Convert the third parameter to "false"


B. Convert the third parameter to "sync"
C. Convert the first parameter to "sync_GET"
D. All of the above

Answer: A) Convert the third parameter to "false"

Explanation:

To execute a synchronous request, you need to change the third parameter of


the open() method to false.

33. Which are the two properties to hold the status of XMLHttpRequest?

A. status and statusText


B. statusNum and statusText
C. statusId and statusText
D. None of the above

Answer: A) status and statusText

Explanation:

The status and statusText properties are used to hold the status of
the XMLHttpRequest object.

34. If the value of status property is 404, what does it mean?

A. OK
B. Forbidden
C. Method Not Allowed
D. Page not found

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

Answer: D) Page not found

Explanation:

Value 404 represents "Page not found".

35. The ______ function is called every time the readyState changes.

A. getreadystatechange
B. onreadystatechange
C. onsetreadystatechange
D. toreadystatechange

Answer: B) onreadystatechange

Explanation:

The onreadystatechange function is called every time the readyState changes.

Query MCQ (Multiple Choice Questions)


1) Who developed jQuery, and in which year it was first released?

a. John Richard in 2001


b. Mark Bensman in 2004
c. John Resig in 2006
d. None of the above

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

Show Answer Workspace

2) jQuery is a -

a. JavaScript method
b. JavaScript library
c. JSON library
d. PHP method

Show Answer Workspace

3) Which of the following sign is used as a shortcut for jQuery?

a. the % sign
b. the & sign
c. the $ sign
d. the @ sign

Show Answer Workspace

4) $(this) in jQuery is used when -

46.7M
755
Hello Java Program for Beginners

a. an HTML element references the entire document


b. an HTML element references its own action
c. an HTML element references the action of its parent element
d. All of the above

Show Answer Workspace

5) Which of the following jQuery method is used to hide the selected elements?

a. The hidden() method


b. The hide() method

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

c. The visible(false) method


d. The display(none) method

Show Answer Workspace

6) Which jQuery method is used to set one or more style properties to the selected
element?

a. The html() method


b. The style() method
c. The css() method
d. All of the above

Show Answer Workspace

7) Which of the following jQuery method can be used to deal with the name conflicts?

a. The conflict() method


b. The nameConflict() method
c. The noConflict() method
d. None of the above

Show Answer Workspace

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");

Show Answer Workspace

9) Which of the following jQuery method is used to attach a handler to an event?

a. unbind() method
b. attach() method

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

c. bind() method
d. None of the above

Show Answer Workspace

10) The jQuery method used to perform an asynchronous HTTP request -

a. jQuery ajaxSetup() method


b. jQuery ajaxSync() method
c. jQuery ajax() method
d. None of the above

Show Answer Workspace

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

Show Answer Workspace

12) What does the syntax $("p.para") will select?

a. The first paragraph element with class = "para"


b. The first paragraph element with id = "para"
c. The first paragraph element with name = "para"
d. All paragraph elements with class = "para"

Show Answer Workspace

13) Which of the jQuery function prevents the code from running before the loading of
the document finishes?

a. $(document).load()
b. $(document).unload()

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

c. $(document).ready()
d. $(document).trim()

Show Answer Workspace

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

Show Answer Workspace

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

Show Answer Workspace

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

Show Answer Workspace

17) Which of the following jQuery method is used to set the value of an element?

a. val() method
b. setValue() method

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

c. content() method
d. None of the above

Hide Answer Workspace

Answer: (a) val() method

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 -

a. setWidth( val ) method


b. width( val ) method
c. setCSSWidth( val ) method
d. None of the above

Show Answer Workspace

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

Show Answer Workspace

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

Show Answer Workspace

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

21) The jQuery method used for parsing the JSON text is -

a. parseJSON() method
b. parseHTML() method
c. noConflict() method
d. each() method

Show Answer Workspace

22) What does the syntax $("div#myDiv .para") will select?

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

Show Answer Workspace

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

Show Answer Workspace

24) 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

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

d. None of the above

Show Answer Workspace

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

Show Answer Workspace

26) 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 Workspace

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

Show Answer Workspace

28) Which of the following is the correct code in jQuery to make all div elements 150px
high?

a. $("div").height(150);

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

b. $("div").height = "150" ;
c. $("div").height = 150 ;
d. None of the above

Show Answer Workspace

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

Show Answer Workspace

30) CDN stands for -

a. Content development network


b. Content delivery network / Content distribution network
c. Communication development network
d. None of the above

Show Answer Workspace

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

Show Answer Workspace

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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

Show Answer Workspace

33) 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 Workspace

34) Can we use multiple document.ready() function on the same page?

a. Yes
b. No
c. Can't say
d. Not possible

Show Answer Workspace

35) The code $("p").css("background-color","yellow") is equivalent to -

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

Show Answer Workspace

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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

Show Answer Workspace

37) 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 Workspace

38) What does the syntax $("p span") will select?

a. All span elements inside the paragraph element


b. Only first span element inside the paragraph element
c. Only last span element inside the paragraph element
d. None of the above

Show Answer Workspace

39) 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 Workspace

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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?

a. jQuery :lt() selector


b. jQuery :gt() selector
c. jQuery :lang() selector
d. jQuery :nth-child selector

Show Answer Workspace

41) Which of the following method in jQuery is used to make copies of the set of matched
elements?

a. jQuery detach() method


b. jQuery delegate() method
c. jQuery clone() method
d. jQuery serialize() method

Show Answer Workspace

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 -

a. jQuery empty() method


b. jQuery trim() method
c. jQuery remove() method
d. jQuery serialize() method

Show Answer Workspace

43) Which of the following jQuery method returns the direct children of the selected
element?

a. jQuery ancestors() method


b. jQuery next() method
c. jQuery children() method
d. None of the above

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

Show Answer Workspace

44) Which of the following jQuery method returns all siblings of the selected element?

a. jQuery ancestors() method


b. jQuery siblings() method
c. jQuery parents() method
d. None of the above

Show Answer Workspace

45) The jQuery selector used to select the elements containing the specified string is -

a. jQuery :contains selector


b. jQuery :lang() selector
c. jQuery :nth-child selector
d. None of the above

Show Answer Workspace

46) The jQuery selector used to select the elements with the specified language code is -

a. jQuery :contains selector


b. jQuery :lang() selector
c. jQuery :nth-child selector
d. None of the above

Show Answer Workspace

47) Which of the following jQuery method is used to replace all selected elements with
new HTML elements?

a. jQuery replaceWith() method


b. jQuery replaceAll() method
c. jQuery load() method
d. jQuery delegate() method

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

Show Answer Workspace

48) The jQuery method used to trigger a specified event handler for the selected element
is -

a. jQuery trigger() method


b. jQuery toggle() method
c. jQuery eq() method
d. jQuery next() method

Show Answer Workspace

49) Which of the following method is used to remove the specified attribute from the
selected element?

a. jQuery remove() method


b. jQuery empty() method
c. jQuery removeAttr() method
d. jQuery error() method

Show Answer Workspace

50) Which of the following jQuery method is used to merge the content of two or more
objects into the first object?

a. jQuery extend() method


b. jQuery eq() method
c. jQuery data() method
d. jQuery param() method

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

jQuery Multiple-Choice Questions (MCQs)


jQuery is a JavaScript library designed to simplify HTML DOM tree traversal and
manipulation, as well as event handling, CSS animation, and Ajax. It is free, open-
source software using the permissive MIT License.

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.

List of jQuery MCQs


1. jQuery is a ______.

A. JavaScript Library
B. JSON Library
C. Java Library
D. JSON and CSS Library

Answer: A) JavaScript Library

Explanation:

jQuery is a JavaScript Library.

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

Answer: D) All of the above

Explanation:

To work with jQuery, you should have the basic knowledge of HTML, CSS, and
JavaScript.

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

3. Who developed jQuery?

A. John Richard
B. John Resig
C. John Carter
D. John Alexander

Answer: B) John Resig

Explanation:

John Resig developed jQuery.

4. In which year jQuery was initial released?

A. 2004
B. 2005
C. 2006
D. 2007

Answer: C) 2006

Explanation:

jQuery was initial released on August 26, 2006.

5. Is jQuery case-sensitive?

A. Yes
B. No

Answer: A) Yes

Explanation:

Yes, jQuery is case-sensitive.

6. Which feature(s) jQuery contains?

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

A. HTML/DOM manipulation
B. CSS manipulation
C. HTML event methods
D. Effects and animations
E. AJAX
F. Utilities
G. All of the above

Answer: G) All of the above

Explanation:

All of the above features jQuery contains.

7. Which sign is used to define/access jQuery?

A. $
B. .
C. &
D. #

Answer: A) $

Explanation:

$ sign is used to define/access jQuery.

8. Which jQuery is used to hide the current element?

A. $(this).hideelement()
B. $(this).hide('true')
C. $(this).hide(0)
D. $(this).hide()

Answer: D) $(this).hide()

Explanation:

The $(this).hide() method is used to hide the current element.

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

9. Which is the correct jQuery statement to hide all <div> elements?

A. $("div").hide()
B. $(div).hide()
C. $(".div").hide()
D. $("#div").hide()

Answer: A) $("div").hide()

Explanation:

The $("div").hide() statement can be used to hide all <div> elements.

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:

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

The $("#new").hide() statement can be used to hide all elements having id name
"new".

12. What is the use of jQuery Selectors?

A. jQuery selectors are used to select and manipulate HTML element(s).


B. jQuery selectors are used to import the HTML elements from the other file.
C. jQuery selectors are used to select and manipulate JSON elements(s).
D. jQuery selectors are used to select and manipulate ReactJS classes.

Answer: A) jQuery selectors are used to select and manipulate HTML element(s)

Explanation:

jQuery selectors are used to select and manipulate HTML element(s).

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.

14. Which sign is used for class selector?

A. $class
B. .class
C. #class
D. None

Answer: C) .class

Explanation:

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

The dot sign (.) i.e., .class is used for the class selector.

15. Which sign is used for id 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.

16. Why #id selectors are used for?

A. To select all elements having the id


B. To select all elements without having the id
C. To select all elements having the id within a specified <div>
D. To select all elements having the id within a specified section.

Answer: C) To select all elements having the id within a specified <div>

Explanation:

The #id selectors are used to select all elements having the id.

17. Which is the correct jQuery selector to select all elements?

A. $("all")
B. $("*.*")
C. $("*")
D. $("***")

Answer: C) $("*")

Explanation:

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

The $("*") selector is used to select all elements.

18. Which is the correct jQuery selector to select current HTML element?

A. $(this)
B. $(cur)
C. $(.this)
D. $(#this)

Answer: A) $(this)

Explanation:

The $(this) selector is used to select current HTML elements.

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")

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

Explanation:

The $("element_name:first") selector is used to select the first HTML element.

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")

Answer: A) $("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")

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

D. $("ul:first-child")

Answer: A) $("ul li: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:

The $(":button") selector is used to select all <button> elements


and <input> elements with type="input".

26. Which is the correct jQuery selector to select all even table rows?

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

A. $("tr::even")
B. $("tr.even")
C. $("tr:even")
D. $("tr:#even")

Answer: C) $("tr:even")

Explanation:

The $("tr:even") selector is used to select all even table rows.

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:

The $("tr:odd") selector is used to select all odd table rows.

28. Which method is used to attach an event handler function to an HTML


element on mouse click?

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.

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

29. Which method is used to attach an event handler function to an HTML


element on mouse double click?

A. click()
B. Click()
C. dblclick()
D. DblClick()

Answer: C) dblclick()

Explanation:

The jQuery method dblclick() is used to attach an event handler function to an


HTML element on mouse double click.

30. Which method is used to attach an event handler function to an HTML


element when the mouse pointer enters the HTML element?

A. mouseover()
B. mousevisit()
C. mouse-enter()
D. mouseenter()

Answer: D) mouseenter()

Explanation:

The jQuery method mouseenter() is used to attach an event handler function to an


HTML element when the mouse pointer enters the HTML element.

31. Which method is used to attach an event handler function to an HTML


element when the mouse pointer leaves the HTML element?

A. mouseLeave()
B. mouseleave()
C. mouse-leave()
D. mouseexit()

Answer: B) mouseleave()

Explanation:

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

The jQuery method mouseleave() is used to attach an event handler function to an


HTML element when the mouse pointer leaves the HTML element.

32. Which method is used to attach an event handler function to an HTML


element when the left, middle or right mouse button is pressed down, while the
mouse is over the HTML element?

A. mousedown()
B. mouseover()
C. mousepress()
D. mousekey()

Answer: A) mousedown()

Explanation:

The jQuery method mousedown() is used to attach an event handler function to an


HTML element when the left, middle or right mouse button is pressed down, while
the mouse is over the HTML element.

33. Which method is used to attach an event handler function to an HTML


element when the left, middle or right mouse button is released, while the
mouse is over the HTML element?

A. mouseup()
B. mouseover()
C. mouseabove()
D. mousekey()

Answer: A) mouseup()

Explanation:

The jQuery method mouseup() is used to attach an event handler function to an


HTML element when the left, middle or right mouse button is released, while the
mouse is over the HTML element.

34. Which method is used to attach an event handler function to an HTML


element when the mouse moves over the HTML elements?

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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.

35. Which method is used to attach an event handler function to an HTML


element when the form field gets focus?

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.

36. Which method is used to attach an event handler function to an HTML


element when the form field loses 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.

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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.

38. What is the use of jQuery method toggle()?

A. To hide shown elements and to show hidden elements


B. To remove current element
C. To shift current element at the previous position
D. All of the above

Answer: A) To hide shown elements and to show hidden elements

Explanation:

The toggle() method is used to hide the shown elements and to show the hidden
elements.

39. Which jQuery method is used to fade in a hidden element?

A. fade()
B. fadeIn()
C. fadeOut()
D. fadeToggle()

Answer: B) fadeIn()

Explanation:

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

The jQuery fadeIn() method is used to fade in a hidden element.

40. What is the syntax of jQuery fadeIn() method?

A. $(selector).fadeIn();
B. $(selector).fadeIn(callback, speed);
C. $(selector).fadeIn(callback);
D. $(selector).fadeIn(speed,callback);

Answer: D) $(selector).fadeIn(speed,callback);

Explanation:

The syntax of jQuery method fadeIn() is:

$(selector).fadeIn(speed,callback);

41. Which jQuery method is used to fade out a visible element?

A. fadeout()
B. fadeIn()
C. fadeOut()
D. fadeToggle()

Answer: C) fadeOut()

Explanation:

The jQuery fadeOut() method is used to fade out a visible element.

42. What is the syntax of jQuery fadeOut() method?

A. $(selector).fadeOut();
B. $(selector).fadeOut(callback, speed);
C. $(selector).fadeOut(callback);
D. $(selector).fadeOut(speed,callback);

Answer: D) $(selector).fadeOut(speed,callback);

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

Explanation:

The syntax of jQuery method fadeOut() is:

$(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:

The jQuery fadeToggle() method toggles between


the fadeIn() and fadeOut() methods.

44. What is the syntax of jQuery fadeToggle() method?

A. $(selector).fadeToggle();
B. $(selector).fadeToggle(callback, speed);
C. $(selector).fadeToggle(callback);
D. $(selector).fadeToggle(speed,callback);

Answer: D) $(selector).fadeToggle(speed,callback);

Explanation:

The syntax of jQuery method fadeToggle() is:

$(selector).fadeToggle(speed,callback);

45. Which jQuery method allows fading to a given opacity (value between 0
and 1)?

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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:

The jQuery statement to fade out a p elements is:

$("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:

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

$("p").fadeOut("slow");

48. Which jQuery method is used to slide down an element?

A. slideBottom()
B. slideDown()
C. slidedown()
D. slide()

Answer: B) slideDown()

Explanation:

The jQuery slideDown() method is used to slide down an element.

49. Which jQuery method is used to slide up an element?

A. slideUp()
B. slideBottom()
C. slidebottom()
D. slide()

Answer: A) slideUp()

Explanation:

The jQuery slideUp() method is used to slide up an element.

50. Which jQuery method toggles between the slideDown() and slideUp()
methods?

A. slide ()
B. slideSwitch()
C. slidetoggle()
D. slideToggle()

Answer: D) slideToggle()

Explanation:

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

The jQuery slideToggle() method toggles between


the slideDown() and slideUp() methods.

51. Which jQuery method is used to create custom animations?

A. animation()
B. slidAnimate()
C. animate()
D. SlideAnimate()

Answer: C) animate()

Explanation:

The jQuery animate() method is used to create custom animations.

52. What is the correct syntax of animate() method?

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:

The correct syntax of animate() method is:

$(selector).animate({params},speed,callback);

53. In the syntax of animate() method, why params parameter is used?

A. It is used to define the speed of the animation


B. It is used to define the mouse events on the HTML element
C. It is used to define the CSS property to be animated
D. None of the above

Answer: C) It is used to define the CSS property to be animated

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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

Answer: D) All of the above

Explanation:

The following are the correct value of the speed parameter are:

• slow
• fast
• milliseconds

55. Which jQuery method is used to stop an animation before it is finished?

A. animate(false)
B. animate('false')
C. animate("false")
D. stop()

Answer: D) stop()

Explanation:

The jQuery method stop() is used to stop an animation before it is finished.

56. What is the correct syntax of stop() method?

A. $(selector).stop(stopAll,goToEnd);

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

B. $(selector).stop(speed,callback);
C. $(selector).stop(stopAll,goToEnd,callback);
D. $(selector).stop(stopAll,speed);

Answer: A) $(selector).stop(stopAll,goToEnd);

Explanation:

The correct syntax of stop() method is:

$(selector).stop(stopAll,goToEnd);

57. In jQuery DOM, what does DOM stand for?

A. Data Object Model


B. Document Object Manipulation
C. Document Object Model
D. Document On Model

Answer: D) Document Object Model

Explanation:

In jQuery DOM, DOM stands for Document Object Model.

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.

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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:

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

The jQuery statement $("#notification").text() will return the text content of


the HTML document having id "notification".

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:

The jQuery statement $("#top").attr("href") will return the the


value href attribute having id "top".

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()

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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?

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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");

Answer: C) $("p").append("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");

Answer: D) $("p").prepend("Text to be added");

Explanation:

The correct syntax to insert content at the beginning of the <p> elements is:

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

$("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");

Answer: A) $("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");

Answer: A) $("div").before("Text to be added");

Explanation:

The correct syntax to insert content before the <div> elements is:

$("div").before("Text to be added");

72. What is the difference between remove() and empty() methods?

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

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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:

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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();

Answer: C) $("pre").remove(".prog, .old");

Explanation:

The jQuery statement to remove all <pre> elements


with class="prog" and class="old" is:

$("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

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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);

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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?

A. $("p").css({"background-color": "#f1f1f1"; "text-decoration": "underline"});


B. $("#p").css({"background-color": "#f1f1f1"; "text-decoration": "underline"});
C. $("p").css({"background-color": "#f1f1f1", "text-decoration": "underline"});
D. $("#p").css({"background-color": "#f1f1f1", "text-decoration": "underline"});

Answer: C) $("p").css({"background-color": "#f1f1f1", "text-decoration": "underline"});

Explanation:

The correct jQuery statement to set background color and text decoration to
all <p> elements is:

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

$("p").css({"background-color": "#f1f1f1", "text-decoration":


"underline"});

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?

A. innerWidth() and innerHeight()


B. width() and height()
C. cssWidth() and cssHeight()
D. elementWidth() and elementHeight()

Answer: A) innerWidth() and innerHeight()

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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?

A. outerWidth() and outerHeight()


B. width() and height()
C. cssWidth() and cssHeight()
D. elementWidth() and elementHeight()

Answer: A) outerWidth() and outerHeight()

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

Answer: 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?

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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.

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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.

Answer: 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.

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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.

95. What will the following jQuery code do?

$(document).ready(function(){
$("pre").siblings();
});

A. It will return all parent elements of <pre> element


B. It will return all children elements of <pre> element
C. It will return all sibling elements of <pre> element
D. It will return all nonrelative elements of <pre> element

Answer: C) It will return all sibling elements of <pre> element

Explanation:

The above code will return all sibling elements of <pre> element.

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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"});

Answer: 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()

Downloaded by Chippy Vijayan ([email protected])


lOMoARcPSD|42519590

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();

Downloaded by Chippy Vijayan ([email protected])

You might also like