jQuery - Mock Test



This section presents you various set of Mock Tests related to jQuery Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Questions and Answers

jQuery Mock Test IV

Q 1 - 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 2 - Which of the following jQuery method removes all child nodes from the set of matched elements?

A - empty( )

B - delete( )

C - remove( expr )

D - None of the above.

Answer : A

Explaination

The empty( ) method removes all child nodes from the set of matched elements.

Q 3 - Which of the following jQuery method removes set of matched elements?

A - empty( )

B - delete( )

C - remove( expr )

D - None of the above.

Answer : C

Explaination

The remove( expr ) method removes all matched elements from the DOM.

Q 4 - Which of the following jQuery method prevents the browser from executing the default action?

A - preventDefault( )

B - stopImmediatePropagation( )

C - stopPropagation( )

D - None of the above.

Answer : A

Explaination

The preventDefault() method of Event object prevents the browser from executing the default action.

Q 5 - 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 6 - Which of the following jQuery method stops the bubbling of an event to parent elements?

A - preventDefault( )

B - stopImmediatePropagation( )

C - stopPropagation( )

D - None of the above.

Answer : C

Explaination

The stopPropagation() method of Event object stops the bubbling of an event to parent elements, preventing any parent handlers from being notified of the event.

Q 7 - 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.

Q 8 - Which of the following jQuery method stops the rest of the event handlers from being executed?

A - preventDefault( )

B - stopImmediatePropagation( )

C - stopPropagation( )

D - None of the above.

Answer : B

Explaination

The stopImmediatePropagation() method of Event object stops the rest of the handlers from being executed.

Q 9 - Which of the following jQuery method checks if event.stopImmediatePropagation() was ever called on this event object?

A - isDefaultPrevented( )

B - isPropagationStopped( )

C - isImmediatePropagationStopped( )

D - None of the above.

Answer : C

Explaination

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

Q 10 - 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 11 - 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 : B

Explaination

The load( url, [data], [callback] ) method load HTML from a remote file and inject it into the DOM.

Q 13 - Which of the following jQuery method can be used to attach a function to be executed whenever an AJAX request completes?

A - ajaxStart( callback )

B - ajaxComplete( callback )

C - ajaxSend( callback )

D - ajaxStop(callback)

Answer : B

Explaination

The ajaxComplete( callback ) method can be used to register a callback to be executed whenever an AJAX request completes.

Q 14 - Which of the following jQuery method can be used to attach a function to be executed whenever an AJAX request begins and there is none already active?

A - ajaxStart( callback )

B - ajaxComplete( callback )

C - ajaxSend( callback )

D - ajaxStop(callback)

Answer : A

Explaination

The ajaxStart( callback ) method can be used to attach a function to be executed whenever an AJAX request begins and there is none already active.

Q 15 - Which of the following jQuery method can be used to attach a function to be executed whenever an AJAX request fails?

A - ajaxStart( callback )

B - ajaxComplete( callback )

C - ajaxSend( callback )

D - ajaxError(callback)

Answer : D

Explaination

The ajaxError( callback ) method can be used to attach a function to be executed whenever an AJAX request fails.

Q 16 - Which of the following jQuery method can be used to attach a function to be executed whenever an AJAX request is sent?

A - ajaxStart( callback )

B - ajaxComplete( callback )

C - ajaxSend( callback )

D - ajaxError(callback)

Answer : C

Explaination

The ajaxSend( callback ) method can be used to attach a function to be executed whenever an AJAX request is sent.

Q 17 - 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.

Q 18 - 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.

Q 19 - Which of the following jQuery method loads a remote page using an HTTP request?

A - jQuery.ajax( options )

B - jQuery.ajaxSetup( options )

C - serialize( )

D - serializeArray( )

Answer : A

Explaination

The jQuery.ajax( options ) method loads a remote page using an HTTP request.

Q 20 - Which of the following jQuery method setups global settings for AJAX requests?

A - jQuery.ajax( options )

B - jQuery.ajaxSetup( options )

C - serialize( )

D - serializeArray( )

Answer : B

Explaination

The jQuery.ajaxSetup( options ) method setups global settings for AJAX requests.

Q 21 - Which of the following jQuery method serializes a set of input elements into a string of data?

A - jQuery.ajax( options )

B - jQuery.ajaxSetup( options )

C - serialize( )

D - serializeArray( )

Answer : C

Explaination

The serialize() method serializes a set of input elements into a string of data.

Q 22 - Which of the following jQuery method serializes all forms and form elements like the .serialize() method but returns a JSON data structure for you to work with?

A - jQuery.ajax( options )

B - jQuery.ajaxSetup( options )

C - serialize( )

D - serializeArray( )

Answer : D

Explaination

The serializeArray( ) method serializes all forms and form elements like the .serialize() method but returns a JSON data structure for you to work with.

Answer : A

Explaination

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

Answer : B

Explaination

The jQuery.getJSON( url, [data], [callback], [type] ) method loads JSON data using an HTTP GET request.

Answer : C

Explaination

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

Answer Sheet

Question Number Answer Key
1 C
2 A
3 C
4 A
5 A
6 C
7 B
8 B
9 C
10 A
11 A
12 B
13 B
14 A
15 D
16 C
17 D
18 B
19 A
20 B
21 C
22 D
23 A
24 B
25 C
jquery_questions_answers.htm
Advertisements