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 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 apply a style on an element?

A - addStyle(classes)

B - addClass( classes )

C - addCSSClass(classes)

D - None of the above.

Answer : B

Explaination

The addClass( classes ) method can be used to apply defined style sheets onto all the matched elements. You can specify multiple classes separated by space.

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 reverts the most recent 'destructive' operation, changing the set of matched elements to its previous state?

A - revert( )

B - end( )

C - undo( )

D - None of the above.

Answer : B

Explaination

The end( ) method reverts the most recent 'destructive' operation, changing the set of matched elements to its previous state.

Q 7 - Which of the following jQuery method gets the width property of an element?

A - getCSSWidth( )

B - getWidth( )

C - width( )

D - None of the above.

Answer : C

Explaination

The width( ) method gets the width 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 checks if event.stopPropagation() was ever called on this event object?

A - isDefaultPrevented( )

B - isPropagationStopped( )

C - isImmediatePropagationStopped( )

D - None of the above.

Answer : B

Explaination

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

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