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 - Can you assign a anonymous function to a variable?

A - true

B - false

Answer : A

Explaination

Yes! An anonymous function can be assigned to a variable.

Q 2 - Which built-in method returns the length of the string?

A - length()

B - size()

C - index()

D - None of the above.

Answer : A

Explaination

length() method returns the length of the string.

Q 3 - Which of the following jQuery selector selects all elements available in a DOM?

A - $('*')

B - $('?')

C - $('#')

D - None of the above.

Answer : A

Explaination

$('*') selects all elements available in a DOM.

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 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 returns a jQuery collection with the positioned parent of the first matched element?

A - offsetParent( selector )

B - offset( selector)

C - parent( selector )

D - None of the above.

Answer : A

Explaination

The offsetParent( ) method returns a jQuery collection with the positioned parent of the first matched element.

Q 7 - Which of the following jQuery method gets a set of elements containing the unique previous siblings of each of the matched set of elements?

A - parents( selector )

B - prev( selector)

C - siblings( selector )

D - None of the above.

Answer : B

Explaination

The prev( [selector] ) method gets a set of elements containing the unique previous siblings of each of the matched set of elements.

Q 8 - Which of the following jQuery method gets the current offset of the first matched element, in pixels, relative to the document?

A - offset( )

B - offsetParent( )

C - position( )

D - None of the above.

Answer : A

Explaination

The offset( ) method gets the current offset of the first matched element, in pixels, relative to the document.

Q 9 - Which of the following jQuery method binds a function to be executed whenever the DOM is ready to be traversed and manipulated?

A - ready(fn)

B - load(fn)

C - reload(fn)

D - None of the above.

Answer : A

Explaination

The ready(fn) function binds a function to be executed whenever the DOM is ready to be traversed and manipulated.

Answer : C

Explaination

The jQuery.getScript( url, [callback] ) method loads and executes a JavaScript file using an HTTP GET request.

jquery_questions_answers.htm
Advertisements