jQuery - Online Quiz


Advertisements

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 type of variable is visible only within a function where it is defined?

A - global variable

B - local variable

C - Both of the above.

D - None of the above.

Answer : B

Explaination

Local Variables: A local variable will be visible only within a function where it is defined. Function parameters are always local to that function.

Answer : C

Explaination

A callback is a plain JavaScript function passed to some method as an argument or option. Some callbacks are just events, called to give the user a chance to react when a certain state is triggered.

Q 4 - Which of the following jQuery method adds the specified class if it is not present, remove the specified class if it is present?

A - toggleStyleClass( class )

B - toggleClass( class )

C - toggleCSSClass( class )

D - None of the above.

Answer : B

Explaination

The toggleClass(class) method adds the specified class if it is not present, removes the specified class if it is present.

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 sets the style property of an element?

A - setClass( name, value )

B - setStyle( name, value)

C - css( name, value )

D - None of the above.

Answer : C

Explaination

The css( name, value ) method sets a style property on the first matched element.

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

A - getCSSWidth( )

B - innerWidth( )

C - getInnerWidth( )

D - None of the above.

Answer : B

Explaination

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

Q 9 - Which of the following jQuery method binds a handler to one or more events (like click) for an element?

A - bind( type, [data], fn )

B - load(type, [data], fn )

C - attach(type, [data], fn )

D - None of the above.

Answer : A

Explaination

The bind( type, [data], fn ) function binds a handler to one or more events (like click) for each matched element. Can also bind custom events.

Q 10 - Which of the following jQuery method can be used to attach a function to be executed whenever AJAX request completed successfully?

A - ajaxStart( callback )

B - ajaxSuccess( callback )

C - ajaxSend( callback )

D - ajaxStop(callback)

Answer : B

Explaination

The ajaxSuccess( callback ) method can be used to attach a function to be executed whenever AJAX request completed successfully.

jquery_questions_answers.htm
Advertisements