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 everywhere in your JavaScript code?

A - global variable

B - local variable

C - Both of the above.

D - None of the above.

Answer : A

Explaination

Global Variables: A global variable has global scope which means it is visible everywhere in your JavaScript code.

Q 2 - Which built-in method returns the index within the calling String object of the first occurrence of the specified value?

A - getIndex()

B - location()

C - indexOf()

D - None of the above.

Answer : C

Explaination

indexOf() method returns the index within the calling String object of the first occurrence of the specified value, or -1 if not found.

Q 3 - Which built-in method sorts the elements of an array?

A - changeOrder(order)

B - order()

C - sort()

D - None of the above.

Answer : C

Explaination

sort() method sorts the elements of an array.

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

A - attr()

B - getAttr()

C - getAttributes()

D - None of the above.

Answer : A

Explaination

The attr() method can be used to fetch the value of an attribute from the first element in the matched set.

Q 5 - Which of the following jQuery method set the value of an element?

A - setContent( val )

B - val( val )

C - setValue( val )

D - None of the above.

Answer : B

Explaination

The val(val) method sets the value attribute of every matched element if it is called on <input> but if it is called on <select> with the passed <option> value then passed option would be selected, if it is called on check box or radio box then all the matching check box and radiobox would be checked.

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 height property of an element?

A - getCSSHeight( )

B - getHeight( )

C - height( )

D - None of the above.

Answer : C

Explaination

The height( ) method gets the CSS height of every matched element.

Q 8 - Which of the following jQuery method returns the outer width (including the border) of an element?

A - getCSSWidth( )

B - getWidth( )

C - outerWidth( [margin] )

D - None of the above.

Answer : C

Explaination

The outerWidth( [margin] ) method gets the outer width (includes the border and padding by default) for the first matched element.

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 : A

Explaination

The jQuery.get( url, [data], [callback], [type] ) method loads a remote page using an HTTP GET request.

jquery_questions_answers.htm
Advertisements