jQuery - Mock Test


Advertisements

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 II

Q 2 - Which of the following jQuery selector selects elements with the given element tag-name?

A - $('tag-name')

B - $('#tag-name')

C - $('.tag-name')

D - None of the above.

Answer : A

Explaination

$('tag-name') selects all element of type tag-name in the document. For example, $('p') selects all paragraphs <p> in the document.

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 selector select elements whose css class is some-class?

A - $('some-class')

B - $('#some-class')

C - $('.some-class')

D - None of the above.

Answer : C

Explaination

$('.some-class') selects all elements in the document that have a class of some-class.

Q 5 - 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 6 - 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 7 - 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 8 - 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 9 - Which of the following jQuery method removes an attribute from each of the matched elements?

A - deleteAttr( name )

B - removeAttr( name )

C - removeAttribute( name )

D - None of the above.

Answer : B

Explaination

The removeAttr( name ) method can be used to remove an attribute from each of the matched elements.

Q 10 - Which of the following jQuery method returns true if the specified class is present on at least one of the set of matched elements?

A - hasCSSClass( class )

B - hasStyleClass( class )

C - hasClass( class )

D - None of the above.

Answer : C

Explaination

The hasClass( class ) method returns true if the specified class is present on at least one of the set of matched elements.

Q 11 - Which of the following jQuery method remove all or the specified class(es) from the set of matched elements?

A - removeClass( class )

B - removeStyleClass( class )

C - removeCSSClass( class )

D - None of the above.

Answer : A

Explaination

The removeClass(class) method remove all or the specified class(es) from the set of matched elements.

Q 12 - Which of the following jQuery method adds the specified class if it is not present, remove the specified class if it is present?

A - toggleStyleClass( class )

B - toggleClass( class )

C - toggleCSSClass( class )

D - None of the above.

Answer : B

Explaination

The toggleClass(class) method adds the specified class if it is not present, removes the specified class if it is present.

Q 13 - Which of the following jQuery method gets the html contents (innerHTML) of the first matched element?

A - html( )

B - getHtml( )

C - getInnerHtml( )

D - None of the above.

Answer : A

Explaination

The html() method gets the html contents (innerHTML) of the first matched element.

Q 14 - Which of the following jQuery method sets the html contents of an element?

A - html( val )

B - setHtml( val )

C - setInnerHtml( val )

D - None of the above.

Answer : A

Explaination

The html( val ) method sets the html contents of every matched element.

Q 15 - Which of the following jQuery method get the text contents of an element?

A - text( )

B - getText( )

C - getContent( )

D - None of the above.

Answer : A

Explaination

The text( ) method gets the combined text contents of all matched elements.

Q 16 - 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 17 - Which of the following jQuery method get the input value of an element?

A - getContent()

B - val( )

C - getValue( )

D - None of the above.

Answer : B

Explaination

The val( ) method gets the input value of the first matched element.

Q 18 - 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 19 - Which of the following jQuery method filter out elements from a set of matched elements?

A - filter( selector )

B - setFilter( selector )

C - putFilter( selector )

D - None of the above.

Answer : A

Explaination

The filter( selector ) method can be used to filter out all elements from the set of matched elements that do not match the specified selector(s). The selector can be written using any selector syntax.

Q 20 - Which of the following jQuery method reduce the set of matched elements to a single element?

A - isEqual( index )

B - eq( index )

C - checkEqual( selector )

D - None of the above.

Answer : B

Explaination

The eq( index ) method reduces the set of matched elements to a single element.

Q 21 - Which of the following jQuery method checks the current selection against an expression?

A - getIs( selector )

B - is( selector )

C - checkIs( selector )

D - None of the above.

Answer : B

Explaination

The is( selector ) method checks the current selection against an expression and returns true, if at least one element of the selection fits the given selector.

Q 22 - Which of the following jQuery method removes elements matching the specified selector from the set of matched elements?

A - getNotEquals( selector )

B - isNotEquals( selector )

C - not(selector)

D - None of the above.

Answer : C

Explaination

The not(selector) method removes elements matching the specified selector from the set of matched elements.

Q 23 - Which of the following jQuery method selects a subset of the matched elements?

A - subset( selector )

B - getSubset( selector )

C - slice(selector)

D - None of the above.

Answer : C

Explaination

The slice(selector) method selects a subset of the matched elements.

Q 24 - 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 25 - Which of the following jQuery method adds the previous selection to the current selection?

A - add( selector )

B - andSelf( )

C - append(selector)

D - None of the above.

Answer : B

Explaination

The andSelf( ) method adds the previous selection to the current selection.

Answer Sheet

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

Useful Video Courses


Video

JQuery Online Training

27 Lectures 1 hours

Mahesh Kumar

Video

JQuery for Beginners

27 Lectures 1.5 hours

Pratik Singh

Video

jQuery Masterclass Course: JavaScript and AJAX Coding Bible

72 Lectures 4.5 hours

Frahaan Hussain

Video

Projects In JavaScript & JQuery

60 Lectures 9 hours

Eduonix Learning Solutions

Video

jQuery for Beginner to Advanced: 12 Projects included

17 Lectures 2 hours

Sandip Bhattacharya

Video

jQuery Memory Game Project - Fun coding Project with jQuery

12 Lectures 53 mins

Laurence Svekis

Advertisements