jQuery - Online Quiz



Following quiz provides Multiple Choice Questions (MCQs) related to jQuery Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Q 1 - Which of the following is a valid type of function javascript supports?

A - named function

B - anonymous function

C - Both of the above.

D - None of the above.

Answer : C

Explaination

A function in JavaScript can be either named or anonymous.

Q 2 - Which built-in method combines the text of two strings and returns a new string?

A - append()

B - concat()

C - attach()

D - None of the above.

Answer : B

Explaination

concat() method returns the character at the specified index.

Q 3 - Which of the following jQuery selector selects element with the given element id some-id?

A - $('some-id')

B - $('#some-id')

C - $('.some-id')

D - None of the above.

Answer : B

Explaination

$('#some-id') selects the single element in the document that has an ID of some-id.

Q 4 - Which of the following jQuery method returns true if the specified class is present on at least one of the set of matched elements?

A - hasCSSClass( class )

B - hasStyleClass( class )

C - hasClass( class )

D - None of the above.

Answer : C

Explaination

The hasClass( class ) method returns true if the specified class is present on at least one of the set of matched elements.

Q 5 - Which of the following jQuery method adds more elements, matched by the given selector, to the set of matched elements?

A - add( selector )

B - addElement( selector )

C - append(selector)

D - None of the above.

Answer : A

Explaination

The add( selector ) method adds more elements, matched by the given selector, to the set of matched elements.

Q 6 - Which of the following jQuery method gets a set of elements containing the closest parent element that matches the specified selector, the starting element included?

A - getNearest( selector )

B - getClosest( [selector])

C - closest(selector)

D - None of the above.

Answer : C

Explaination

The closest( selector ) method gets a set of elements containing the closest parent element that matches the specified selector, the starting element included.

Q 7 - Which of the following jQuery method gets the inner height (excluding the border) of an element?

A - getCSSHeight( )

B - innerHeight( )

C - getInnerHeight( )

D - None of the above.

Answer : B

Explaination

The innerHeight( ) method gets the inner height (excludes the border and includes the padding) for the first matched element.

Q 8 - Which of the following jQuery method prevents the browser from executing the default action?

A - preventDefault( )

B - stopImmediatePropagation( )

C - stopPropagation( )

D - None of the above.

Answer : A

Explaination

The preventDefault() method of Event object prevents the browser from executing the default action.

Answer : B

Explaination

The load( url, [data], [callback] ) method load HTML from a remote file and inject it into the DOM.

Q 10 - Which of the following jQuery method setups global settings for AJAX requests?

A - jQuery.ajax( options )

B - jQuery.ajaxSetup( options )

C - serialize( )

D - serializeArray( )

Answer : B

Explaination

The jQuery.ajaxSetup( options ) method setups global settings for AJAX requests.

jquery_questions_answers.htm
Advertisements