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 2 - Which of the following type of variable takes precedence over other if names are same?

A - global variable

B - local variable

C - Both of the above.

D - None of the above.

Answer : B

Explaination

A local variable takes precedence over a global variable with the same name.

Q 3 - Which built-in method returns the characters in a string beginning at the specified location?

A - substr()

B - getSubstring()

C - slice()

D - None of the above.

Answer : A

Explaination

substr() method returns the characters in a string beginning at the specified location through the specified number of characters.

Q 4 - Which of the following jQuery method sets attributes of an element?

A - attr(name, value)

B - setAttr(name, value)

C - setAttributes(name, value)

D - None of the above.

Answer : A

Explaination

The attr(name, value) method can be used to set the named attribute onto all elements in the wrapped set using the passed value.

Q 5 - Which of the following jQuery method sets the text of an element?

A - text( val )

B - setText( val )

C - setContent( val )

D - None of the above.

Answer : A

Explaination

The text( val ) sets the text contents of all 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 checks if event.preventDefault() was ever called on this event object?

A - isDefaultPrevented( )

B - isPropagationStopped( )

C - isImmediatePropagationStopped( )

D - None of the above.

Answer : A

Explaination

The isDefaultPrevented() method of Event object returns whether event.preventDefault() was ever called on this event object.

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 when all AJAX requests have ended?

A - ajaxStart( callback )

B - ajaxComplete( callback )

C - ajaxSend( callback )

D - ajaxStop(callback)

Answer : D

Explaination

The ajaxStop( callback ) method can be used to attach a function to be executed when all AJAX requests have ended.


jquery_questions_answers.htm

Advertisements