Do you know that? 33% like freelancing because no office dress code next

Contact Email: teammmrem@yahoo.com

<< All Upwork (oDesk) and Elance Tests << Elance test answers << IT & Programming category

Test answers for jQuery 2020

(216, CL) Last updated: January 27
Elance • IT & Programming
Questions and answers are regularly updated. Answered and not answered tests questions.

This helps getting job: Hundreds of (cover letter examples , interview questions , profile samples ) • Earn on Upwork (oDesk)
Job assistance: jobs popularityfreelance rates

Popular test answers: HTML, .Net, CSS, English, SEO, Photoshop, iOS, Java, Android, Ruby, Python, JavaScript

See all 6 tests answers updated

Find Upwork (oDesk) and Elance test answers on this website:



Collapse | Expand

216 Answered Test Questions:

1. Which selector will only return one element?

Answers:

• :even

• :odd

• :one-based()

• :nth-child()

2. Which part of the following statement is the action? $('p').css('color','blue');

Answers:

• .css

• 'color'

• 'blue'

• $('p')

3. What is the correct way to check if an element has a specific class?

Answers:

• $("#foo").hasClass("bar");

• $("#foo").hasClass(".bar");

• $("#foo").class('bar');

• hasClass("foo", "bar");

4. How should your JQuery code be wrapped so it executes only once the page has loaded?

Answers:

• $(document).pageloadcomplete(function () { /* Code goes here */ });

• $(document).ready(function { /* Code goes here */ });

• document.ready(function () { /* Code goes here */ });

• $(document).ready({ /* Code goes here */ });

• $(document).ready(function () { /* Code goes here */ });

5. What does jQuery do?

Answers:

• makes editing websites content easier and organizes the codes with <script> into groups.

• Lets you easily change the appearance, location, or behavior of an element on a web page.

• It is embedded into the PHP code.

• Allows the script of a web page to automatically change when JQuery is applied.

6. What does the animate method do?

Answers:

• Allows you to animate CSS property controlled by a numeric value

• Allows you to animate any CSS property controlled by an alphabetic value

• Allows you to create a cartoon using the DOM

7. How do you pass options to a plugin?

Answers:

• $("...").foobar({ option1: 123, option2: 9 });

• $("...").foobar([ option1: 123, option2: 9 ]);

• $("...").foobar( option1: 123, option2: 9 );

8. What this following code will do: $('#mydiv').wrap('<div/>');

Answers:

• Create a div next to the element id 'mydiv'

• Create a parent 'div' tag for element id 'mydiv'.

• duplicate the element id 'mydiv'

9. The following code is an example of ______: $('.tooltip').hide().fadeIn(9000).delay(1000).fade0ut(9000);

Answers:

• Chaining

• it ends a statement

• an effect that disables

• statement

10. True or false? The jQuery library can be used to request a server-side script.

Answers:

• False

• True

11. Which of the following is used to schedule a function to execute after an animation has completed?

Answers:

• progressive enhancement

• chaining

• graceful degradation

• AJAX

• callback function

12. Which jQuery method is used to perform an asynchronous HTTP request?

Answers:

• jQuery.ajaxSetup()

• jQuery.asyncAjax()

• jQuery.ajax()

• jQuery.syncAjax

13. How would you prevent the default browser action from an event handler without affecting other properties of the event flow?

Answers:

• $a.click(false);

• $a.click(function (e) { /* code */ e.returnValue = false; });

• $a.click(function (e) { /* code */ e.preventDefault(); });

• $a.click(function () { /* code */ return false; });

14. What jQuery function is used to add HTML content just outside of a selection?

Answers:

• more()

• after()

• later()

• outside()

15. What does the $.get() jQuery function do?

Answers:

• It fires a GET OBJECT request

• It fires a GET AJAX request

• It returns an object

• It returns the DOM elements that are contained in the jQuery object.

16. Which jQuery function is used to prevent code from running, before the document is finished loading?

Answers:

• $(window).load()

• $(document).ready()

• $(document).load()

• $(body).onload()

17. What jQuery function is used to set an element's markup content?

Answers:

• echo()

• .html()

• document.write()

• .content()

18. In the following statement, which is the selector? $('p').css('color','blue');

Answers:

• p

• .css

• color

• blue

19. With jQuery, look at the following selector: $("div.intro"). What does it select?

Answers:

• All div elements with id="intro"

• The first div element with class="intro"

• All div elements with class="intro"

• The first div element with id="intro"

20. When using jQuery animation, you can specify duration in the following format:

Answers:

• 500

• 'fast'

• Leave it blank

• All of these

21. Which of the following statement best described the following code snippet:  $('#myID').animate({width:"90%"}, "fast");

Answers:

• Animate the tag with myID from 90% width to 0% width.

• Animate the tag with myID from the current width to 90% width.

• Animate the tag with myID from 90% width to 100% width.

• Animate the tag with myID from 90% width to the current width.

22. What method is the primary means of attaching a handler to an event?

Answers:

• .link()

• .behavior()

• .attach()

• .on()

23. Is this a valid statement in jQuery?  $("#foo").hide().show().css("color", "red").fadeOut();

Answers:

• No

• Yes

24. code for making all div elements 100 pixels high?

Answers:

• $("div").height(100)

• $("div").height.pos=100

• $("div").height="100"

• $("div").height=("100")

25. How do you clear the contents of this paragraph element?  <div id='file'><p>content goes here</p></div>

Answers:

• $("file").clear();

• $(".file").empty();

• $("#p").empty()

• $("#file").clear();

• $('#file p').empty();

26. To dynamically set the src attribute of all img elements use:

Answers:

• $(img).setAttribute('src', 'photo.jpg');

• $('img').attr('src', 'photo.jpg');

• $('img src').set('photo.jpg');

• $('img').attr('src').set('photo.jpg');

27. Which of the following does jQuery NOT integrate seamlessly with?

Answers:

• HTML

• DOM

• CSS

• Java

28. What method is used to set one or more style properties for selected elements?

Answers:

• javascript()

• style()

• css()

• html()

29. What character is used to identify a child combinator relationship?

Answers:

• minus (-)

• right carat (>)

• medium

• left carat (<)

• plus (+)

30. True or False? live() method has been removed from version 1.9

Answers:

• False

• True

31. Which method stops an event before the default action is triggered?

Answers:

• .stopEvent()

• .preventDefault()

• .stopDefault()

• .end()

• medium

32. What is the END STATE STYLE of the paragraph element in the code $('p').hide(); ?

Answers:

• visibility: hidden;

• height: 0;

• opacity: 0;

• display: none;

33. Which of the following selectors is the fastest?

Answers:

• $('.grid12');

• $('div');

• $('div+.grid12');

• $('#container+div');

• $('#container');

34. Which of the following statements will display an alert dialog when the button with id "myBtn" is clicked on?

Answers:

• $var handler = $function() { alert("Hello"); }; $("#myBtn").click( handler() );

• $("#myBtn").click( function() { alert("hello"); } );

• $("#myBtn").click( alert("hello") );

• $("#myBtn").click( alert(event) );

35. Which of the following is a subset of jQuery's CSS selectors?

Answers:

• attribute selectors

• css3 selectors

• child selectors

• universal selectors

• All of these choices are subsets

36. Which is a state selector?

Answers:

• $('.name')

• $(':name')

• $('#name')

37. How do you fetch the first span on the page which has the class 'white'?

Answers:

• $('white;span;first')

• $('first.span.white')

• $('span.white:first')

• $('span; white: first')

38. What is the difference between searching 'find()' and 'children()'

Answers:

• There is no find() function

• Both do similar tasks

• The .find() and .children() methods are similar, except that the latter only travels a single level down the DOM tree.

• There is no children() function

39. How do you schedule a Javascript function to execute as soon as the document has been interpreted by the browser?

Answers:

• .load()

• .hide()

• .show()

• .ready()

40. Which function does jQuery provide to remove whitespace from the beginning and end of a string?

Answers:

• $.strip( )

• $.stripspace( )

• $.trim( )

• jQuery does not provide such function.

41. What does every selector expression return?

Answers:

• result set

• HTML text

• jQuery object

• recordset

42. What does $("div.intro") select?

Answers:

• The first div element with id="intro"

• The first div element with class="intro"

• All div elements with class="intro"

• All div elements with id="intro"

43. Which of the following is NOT a valid example of a selector filter?

Answers:

• tr:odd

• tr:even

• li:last

• div:left

• p:first

44. Which of the following methods can be used to remove the title of an img element?

Answers:

• $("img").removeTitle()

• $("img").deleteTitle()

• $("img").removeAttr("title")

• $("img").remove("title")

45. Where does jQuery code run?

Answers:

• host browser

• client server

• host server

• client browser

46. The "hide()" function set which of the following properties?

Answers:

• The "visibility" property

• The "height" property

• The "display" property

• The "width" property

47. What can be used to append a new paragraph element into a div with id 'mydiv'?

Answers:

• $("div#mydiv").before("<p>Paragraph</p>");

• $("<p>Paragraph</p>").new("div#mydiv");

• $("<p>Paragraph</p>").appendTo("div#mydiv");

• $("div#mydiv").never("<p>Paragraph</p>");

48. How do you change the CSS property 'color' of an element?

Answers:

• $("#someID"))((.style("color","red");

• $("#someID").css("color","red");

• $("#someID").css("color:red");

• $.css("color:red");

49. $.foo() is equivalent to:

Answers:

• jQuery.foo()

• document.foo()

• None of them

• javascript.foo()

50. Which is a syntactically valid jQuery command?

Answers:

• $("book").fadeOut{}

• jQuery("book").fadeOut{}

• $(#book).fadeOut();

• $("#book").fadeOut();

51. jQuery uses CSS selectors to select elements?

Answers:

• False

• True

52. Which function is used to make a copy of a selected element?

Answers:

• .clone()

• .repeat()

• .duplicate()

• .copy()

53. What is jQuery used for?

Answers:

• Simplify JavaScript coding

• All of these

• Rapid web development

• Overcome cross-browser issues

54. How do you delete an element with an id of "dialog" from the DOM using jQuery?

Answers:

• $("#dialog").delete();

• $.delete(#dialog);

• $(".dialog").remove();

• $("#dialog").remove();

• $.remove("#dialog");

55. How do you test if an element has a specific class?

Answers:

• use .getClass()

• use .hasClass()

• use .isClass()

• use .hasThis()

• use.class()

56. Which method is used to hide selected elements?

Answers:

• hide(display)

• hidden()

• hide()

• display(none)

57. jQuery.trim() function is used to ?

Answers:

• Remove Whitespace from end of string

• Remove Whitespace from beginning & ending of string

• trim() is not a valid Jquery function

• Remove Whitespace from beginning of string

58. Illustrate selecting a HTML element using its class:

Answers:

• $(".myClass")

• #(".myClass")

• $("#myClass")

• $('#myClass')

59. Which of the following is correct?

Answers:

• All of these

• jQuery is a JSON Library

• jQuery is a python Library

• jQuery is a JavaScript Library

60. Which selector matches all elements?

Answers:

• *

• ?

• &

• #

61. What function can be used to alternate an element's state between display and hidden?

Answers:

• flip

• alternate

• toggle

• switch

• reverse

62. Which method is used to prevent the default action of an event?

Answers:

• event.preventDefault()

• event.preventAction()

• event.stopDefault()

• event.stopData()

63. What method is used to switch between adding/removing one or more classes (for CSS) from selected elements?

Answers:

• classSwitch()

• switch()

• switchClass()

• toggleClass()

64. What is the proper way to show an element?

Answers:

• $('#foo').display('show');

• $('#foo').showElement();

• $('#foo').style('show');

• $('#foo').show();

65. Which command selects an element using its ID?

Answers:

• #{".myID"}

• $("#myID")

• ${."myID"}

• ${"#myID"}

66. Which of the following is valid?

Answers:

• $('p').css('color', 'red');

• $('p').css('color: red;');

• $('p').css('color: red');

67. How would you hide the following element ?  <input id="id_txt" name="txt" type="text" value="" />

Answers:

• $("#id_txt").remove();

• $("id_txt").hide();

• $("text").hide();

• $("#id_txt").hide();

• $(#id_txt).remove();

68. Which is an example of chaining a jQuery command?

Answers:

• $(???box???).fadeOut().fadeIn()

• $(#box).fadeOut().fadeIn()

• $(<#box>).fadeOut().fadeIn();

• $("#box").fadeOut().fadeIn();

69. What keyword would you use to refer to the object on which the currently executing method has been invoked?

Answers:

• here

• that

• object

• medium

• this

70. True or False : jQuery method fadeTo() permits fading to a given opacity.

Answers:

• True

• False

71. Which sign does jQuery use as a shortcut for jQuery?

Answers:

• the # sign

• the > sign

• the $ sign

• the . sign

72. What is '$();' equivalent to?

Answers:

• operator();

• Function();

• function();

• jQuery();

• java();

73. Which of the following is the correct command to fade in an element over a three-second time period?

Answers:

• fadeIn(3000)

• fadeIn(3)

• fadeIn('3 sec')

• fadeIn('3 seconds')

• fadeIn('three')

74. Which is a class selector?

Answers:

• $('#name')

• $('_name')

• $('.name')

75. What does this script do?   $(function() {  $( "#effect" ).animate({           backgroundColor: "#fff"         }, 1000 );   });

Answers:

• Changes the background color of the element with id 'effect' to #fff within 1 second.

• Changes the background color of the element with class 'effect' to #fff within 1 second.

76. Is jQuery a library for client scripting or server scripting?

Answers:

• Client Scripting

• Server Scripting

77. What is the difference between .width() and .outerWidth()?

Answers:

• No difference. width() is a shorthand alias for outerWidth()

• width() returns the computed width of the element while outerWidth() returns the width plus all the margins and paddings.

• Only difference is .width() returns a number & outerWidth() returns a string.

78. What does the jQuery attr() function do?

Answers:

• Takes the element and duplicates it.

• Takes the name of an attribute on the page and makes it animate.

• Takes the name of an attribute and duplicates it.

• Takes the name of an attribute on your page and gives the value of that attribute.

79. $() is an alias of the jQuery() function

Answers:

• True

• False

80. Which is NOT a jQuery method?

Answers:

• alias()

• show()

• fadeIn()

• toggle()

81. The '#' symbol indicates a lookup on what?

Answers:

• element

• Name

• element's ID

• Attribute

82. What do selectors do?

Answers:

• Allows you to select HTML elements (or groups of elements) by element name, attribute name or by content.

• Allows you to select an array in the node list.

• Allows the content to be stopped at some point.

• Allows selection of libraries.

83. What language is jQuery written in?

Answers:

• PHP

• Java

• JavaScript

• CSS

84. Illustrate the code needed to include the jQuery library in an HTML file:

Answers:

• <script src="jQuery.js"></script>

• $(script src)="jQuery.js"(/script)

• $(script) src="jQuery.js")

• $script src="jQuery.js"

85. Which is an id selector?

Answers:

• $('.name')

• $('#name')

• $(':name')

86. Which of the following is correct?

Answers:

• jQuery is a JavaScript Library

• None of these

• jQuery is a JSON Library

87. What language is jQuery constructed in?

Answers:

• C++

• PHP

• Java

• JavaScript

88. Is it possible to use jQuery with AJAX?

Answers:

• It is code dependent

• No

• Yes

89. True or false: it is possible to use jQuery together with AJAX?

Answers:

• False

• True

90. Is it possible to use jQuery together with AJAX?

Answers:

• Yes

• No

91. which property in the event object can be used to get the key code of a key press event

Answers:

• event.type

• event.key

• event.which

• event.keyCode

92. Assuming there are p tags on a page, what will be the result of the code below: $(function(){           $("p").hide("slow").show(); });

Answers:

• The p tags will collapse slowly and then appear.

• The p tags will be hidden.

• The opacity of all the p tags will be set to 0

• A JavaScript error will occur.

93. We can delay execution of .css() with .delay()

Answers:

• true

• false

94. True or False :jQuery method dequeue() used while creating animation effects removes all remaining queued functions from the selected elements

Answers:

• True

• False

95. How is jQuery licensed?

Answers:

• Proprietary

• Secret

• Open source

• Private

96. What is not a an AjaxEvent.

Answers:

• .ajaxError()

• .ajaxComplete()

• .ajaxStop()

• .ajaxSend()

• .ajaxRun()

97. How do I pull a native DOM element from a jQuery object?

Answers:

• $( "#foo" ).find(native[ 0 ]);

• $( "#foo" ).get( 0 );

• $("#foo[0]");

• $( "#foo" ).get(native[ 0 ]);

98. What is $(fn); a shortcut for?

Answers:

• $( fn() ); // Shortcut to create or select elements using the string returned by the "fn" function.

• $(window).on('load', fn);

• $(document).ready(fn);

99. Which of the following selectors is NOT equivalent to the others?

Answers:

• :nth-child(1)

• :first

• :first-child

100. What does the serialize() method do: $('#myForm').serialize();

Answers:

• fetches the names and values in all input fields and creates a JSON representation of the form

• fetches the names and values of all the input fields contained in the form, and generates a URL encoded string representation

• fetches the names and values in all input fields, and returns them as an object.

• fetches the code and makes it numeric.

101. What is the name of a function that intercepts combinations of user actions?

Answers:

• medium

• user generated event

• user function

• compound event handler

• combo function

102. What is the difference between $('#element').remove() and $('#element').detach()

Answers:

• remove() removes the element from the DOM along with any jQuery data, while detach() only removes the element from the DOM.

• detach() removes the element along with all the jQuery data, whereas remove() only removes it from the DOM.

• remove() removes the element from the DOM, while detach() only removes jQuery data.

• detach() removes the element from the DOM, while remove() only removes jQuery data.

103. What does the filter() method do in this: $('div').filter('.nav')

Answers:

• it sifts through all the divs and leaves only those with the nav class

• it filters all the ('.nav') and leaves only the divs

• it sifts through all divs and leaves only those contained within a .nav element

• The filter funtion is run when the DOM is initialized

104. How can you get the number of paragraphs in the html document using jQuery?

Answers:

• $('p').count()

• $('p').length

• count($('p'))

• $('p').count

• $('p').length()

105. Which custom selector is case sensitive?

Answers:

• medium

• :case()

• :includes()

• :custom()

• :contains()

106. Which can be used to detect broken images?

Answers:

• image.elements()

• image.error()

• $("img").isBroken()

• $("img").error(callbackFunction)

• $("img").error()

107. What method allows us to remove values that were previously set using jQuery.data()?

Answers:

• .data().remove()

• .dequeue()

• .removeData()

• .clearQueue()

108. How do you get the value of the selected radio button in a group of radio buttons with the name of 'radioName'?

Answers:

• $('#myForm', 'input[name=radioName]').is('checked').val()

• $('input[name=radioName]:first').val()

• None of these

• $('input[name=radioName]:checked', '#myForm').val()

109. Which will NOT select the second "li" element?

Answers:

• $( "li:eq( 2 )" )

• $( "li:nth-child( 2 )" )

• $( "li:eq( 1 )" )

110. What is an event handler?

Answers:

• A function that executes your code after the event occurs.

• A function that occurs during and after the event is executed.

• A function that executes your code before the event occurs.

• A function that executes your code as the event occurs.

111. $(".clicker").click(function() {     $('link[rel=stylesheet]').attr('href' , $(this).attr('rel'));    });  The above is used to do what?

Answers:

• Change the stylesheet loaded in the page upon clicking the element with class "clicker"

• Nothing, it returns a console.log error

• Adds the contents of another stylesheet to the currently loaded one upon clicking the element with class "clicker"

• Reload the currently selected stylesheet upon clicking the element with class "clicker"

112. How can we use protocol less URL while referencing jQuery from CDNs?

Answers:

• <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

• (both of these are correct)

• <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

113. Which of the following will get the CURRENT COORDINATES of the first element in the set of matched elements, RELATIVE TO THE DOCUMENT?

Answers:

• position()

• coord()

• offset()

• pos()

114. Which of the following is NOT a custom jQuery form selector?

Answers:

• :checkbox

• :enabled

• :form

• :selected

115. What does the empty() function do?

Answers:

• Checks if a node is empty

• Removes all child nodes of the set of matched elements from the DOM

• Removes all child nodes of the set of matched elements from the DOM including the parent node

• Clears the text in a node

116. True or False : It is not possible to use relative values for jQuery animate() method.

Answers:

• True

• False

117. What does the following code do?  $(".foobar").find(".foo").fadeOut();

Answers:

• Fade out of elements matching ".foo" that are descendants of elements matching ".foobar"

• Fade out of elements matching ".foobar"

• Fade out of all descendants of elements matching ".foo" inside those matching ".foobar"

• Fade out of all children of elements matching ".foobar"

118. The "complete" callback in a jQuery AJAX request, is called only after...

Answers:

• the AJAX request is failed

• the AJAX request finishes, irrespective of error or success

• the AJAX request is successful without any errors

• if there is no "success" callback defined in the AJAX request

119. By default, the outerWidth(true) function returns the width of the element including

Answers:

• margin,border and padding

• margin and border

• margin and padding

• border and padding

120. Given the following HTML code snippet:  <div id="wrapper">   <div class="wText">...</div>   ...<!-- more wText items here -->   <div class="wImg">...</div>   ...<!-- more wImg items here -->   <div class="wVideo">...</div>   ...<!-- more wVideo items here --> </div>  How would you attach a click event to each of the items inside the wrapper?

Answers:

• $('div').click(function( e ) { alert("I got clicked!"); });

• (all of these)

• $('div.wrapper').children().bind('click', function( e ) { alert("I got clicked!"); });

• $('#wrapper').children().click(function(e) { alert("I got clicked!"); });

121. var result = $("#div").css("color","red")  What does the "result" var contain?

Answers:

• jQuery object

• CSS property

• True

• False

122. Which one will be found faster?

Answers:

• $('div.element')

• $('.element')

• $('div#element')

• $('#element')

123. How to set default options for all future AJAX requests?

Answers:

• .ajaxStart()

• jQuery.ajaxSetup( options )

• jQuery.ajax()

• .ajaxSend()

124. Which of these is NOT a pseudoclass?

Answers:

• :next

• :after

• :first

• :before

• :last

125. What index value does the :nth-child() selector starts with?

Answers:

• 0

• 2

• 1

126. Which jQuery method can be used to bind both the mouseover and the mouseout events?

Answers:

• toggle()

• switch()

• change()

• mouse()

• hover()

127. For best performance in modern browsers, which of the following would you use to select all radio inputs?

Answers:

• $('[type="radio"]');

• $('||radio');

• $('.radio');

• $('[input.radio]');

• $('[input="radio"]');

128. Event delegation:

Answers:

• Allows you to trigger events on related DOM elements simultaneously

• Allows you to register handlers before elements are added to the page

• Is a technique that lets you separate event-handling code from other code

• Does not let you pause or delay the propagation of events

129. What term refers to the acceleration and deceleration that occurs during an animation?

Answers:

• velocity

• resizing

• gradient

• easing

• speeding

130. What method returns control of the $ identifier to other libraries?

Answers:

• .noConflict()

• .$()

• .return()

• medium

• .library()

131. What does this do? $("p").find("span").end().css("border", "2px red solid");

Answers:

• Selects all paragraphs, finds span elements inside these, and reverts the selection back to the paragraphs, then apply CSS rule.

• Selects all paragraphs, finds span elements inside these, go to the end of each paragraph, then apply CSS rule.

• Selects all paragraphs, apply CSS rule, then reverts the selection back to the spans.

• Selects all spans, then apply CSS rule.

132. Which of the following syntaxes are equivalent to $(document).ready(handler)?

Answers:

• $(handler)

• All of these

• .ready()

• .load()

133. What keyword can be used to refer to the element that triggered the event (in the event handler callback)?

Answers:

• element

• this

• that

• event

• e

134. What will be the value of "display" css property of the following tag?  $('span').hide(); $('span').show();

Answers:

• It will vary depending the value of the span's initial display property

• inline

• block

• inherit

• inline-block

135. Which jQuery method animates the height of matched elements?

Answers:

• None of these

• All of these

• .slideHeight()

• .height()

• .slideToggle()

136. What does this return: $(".class").attr("id");

Answers:

• The value of the 'id' attribute for the first element in the set of matched elements

• The value of the 'class' attribute for the first element in the set of matched elements

• Nothing

• The value of the 'id' attribute for all the elements in the set of matched elements

137. What method selects the sibling element that immediately follows the current one?

Answers:

• medium

• next()

• next_element()

• sibling()

• next_sibling()

138. Which is not a type of selector?

Answers:

• Custom Selector

• Javascript Selector

• XPath Selector

• CSS selector

139. What does this code do:  $('#id1').animate({width:"250px"},  "slow").animate({height:"250px"}, "fast");

Answers:

• Both the width and height animates at the same time.

• First the height animates, then the width animates.

• First the width animates, then the height animates.

140. What does the following code do: $('#myDiv').trigger('click');

Answers:

• It sets up a trigger. When a click occurs, the trigger is going to be activated.

• It makes a click on any element and creates a trigger.

• When a click occurs the trigger is going to be activated.

• It simulates a click on the element and runs all the event handlers associated with it.

141. How to Remove from the queue all items that have not yet been run in jquery?

Answers:

• hide()

• clearQueue()

• dequeue()

• queue()

142. Why do we add the stop() function before the animate() function?

Answers:

• to tell jQuery that the animation has to be stopped at some point.

• stop() halts the execution of the scripts on the page until any animations have finished.

• to stop the animation after it has finished.

• stop() ends any currently running animations on the element.

143. What method checks for the presence of a class before applying or removing it?

Answers:

• .toggleClass()

• medium

• .checkPresence()

• .checkFunction()

• .apply_remove()

144. $(function(){     //executable code });  The executable code will be run:

Answers:

• after the DOM has loaded, but prior to anything else loading

• before anything has loaded

• after everything except other scripts are loaded

• after all other javascript has been read and executed

• after everything has loaded

145. Given the following HTML code snippet:  <div id="wrapper">   <div class="wText">...</div>   ...<!-- more wText items here -->   <div class="wImg">...</div>   ...<!-- more wImg items here -->   <div class="wVideo">...</div>   ...<!-- more wVideo items here --> </div>  How would you get a collection of all the items inside the "wrapper"?

Answers:

• $('#wrapper').find("all");

• $('#wrapper').children();

• $('#wrapper').contents();

• $('#wrapper').html();

146. What does $("div#intro .head") select?

Answers:

• All div elements with id="intro" or class="head"

• All elements with class="head" inside the first div element with id="intro"

• The first element with id="head" inside any div element with class="intro"

147. Which function locates elements at the same level as the current selection?

Answers:

• .siblings()

• .closest()

• .find()

• .children()

148. When an event is triggered on an element, the same event is also triggered on all of that element???s ancestors.  What is the name of this process?

Answers:

• upward progress

• progressive enhancement

• event bubbling

• medium

• global event

149. What element type can you apply the "jQuery.unique(...)" on?

Answers:

• Arrays of characters

• Arrays of DOM elements

• Arrays of numbers

• Arrays of strings

150. Which of the following jQuery functions are deprecated?

Answers:

• .die()

• .live()

• All of these

• .sub()

• .browser()

151. The insertAfter function adds a new element as a sibling.  What comparable function adds a new element as a child?

Answers:

• appendTo

• createChild

• addChild

• insertNew

• expandFamily

152. What is the output of the following:  $.each([1,2,3], function(){   document.write(this + 1); });

Answers:

• "234"

• 223

• 1231

• undefined

153. Which term is given to the jQuery feature that allows the attachment of one function to another?

Answers:

• outer join

• chaining

• stringing

• concatenation

154. What does the greater sign (>) indicate in the following code?  $('#summary > div').hide();

Answers:

• comparison operator

• hierarchical relationship

• directional indicator

• child selector

• chaining

155. The selector :disabled will perform the following:

Answers:

• Disable any elements currently set to an enabled state

• None of the above

• Create a new element with the state set to disabled

• Select only elements in a disabled state

156. What does $('#myDiv').load('page.html') do?

Answers:

• it fires an AJAX request, fetches the result of page.html as text, and inserts it into the div

• it loads the #myDiv on the contents of the 'page.html' browser

• It adds the string 'page.html' as the contents of the #myDiv div.

157. What is the difference between remove() & empty()

Answers:

• they are same

• remove() method removes the selected element(s) and its child elements whereas empty() method removes the child elements of the selected element(s)

• remove() method removes the child elements of the selected element(s) whereas empty() method removes the selected element(s) and its child elements

158. Which of the following statement returns all anchor links that start with "https"?

Answers:

• $('a[href="https"]');

• $('a[href^="https"]');

• $('a[href] = "https"');

• $('a[href$="https"]');

159. What is the equivalent of the following code? $('div').click(function {alert(1);});

Answers:

• $('div').event('click',function {alert(1);});

• $('div').bind('click',function {alert(1);});

• $('div').handler('click',function {alert(1);});

• $('div').call('click',function {alert(1);});

160. True or False: .position() accepts an optional argument as a selector

Answers:

• true

• false

161. How can the following be optimized while maintaining the ability to add ".foobar" elements without re-binding events:  <code> $('.foobar').live('click', fn); // equivalent of: $(document).on('click', '.foobar', fn); </code>

Answers:

• By using $.fn.delegate(event, fn) on the closest consistent parent of ".foobar". Such as $('.foobar-container').on('click', '.foobar', fn);

• By using $('.foobar').bind('click', fn)

• By using $(document).delegate('.foobar', 'click' , fn) instead of $('.foobar').live('click', fn);

162. How can I make a redirect page in jQuery?

Answers:

• $(location).attr('href','http://smarterer.com/');

• window.location.href = "http://stackoverflow.com";

• window.location.replace("http://stackoverflow.com");

• none of these

163. You can copy an element by calling which of the following methods?

Answers:

• clone()

• cloneTo()

• moveTo()

• copy()

164. Which method is used to bind an event handler to existing and future matching elements?

Answers:

• attach();

• .on();

• click();

165. If you want to change the text displayed in a paragraph by adding text before what's currently displayed, which would be correct?

Answers:

• $('p').html('text to add');

• $('p').append('text to add');

• $('p').text('text to add');

• $('p').content('text to add');

• $('p').prepend('text to add');

166. Attribute Contains Prefix Selector is:

Answers:

• [name|="value"]

• [name~="value"]

• [name$="value"]

• [name*="value"]

• [name+="value"]

167. Which of the following will get the current coordinates (of the first element in the jQuery collection) relative to the offset parent?

Answers:

• offset()

• relativePosition()

• position()

• relOffset()

168. What do you use jQuery.noConflict() for?

Answers:

• To only have one javascript library on a page.

• to make jQuery's $ function accessible by other libraries

• to restore the '$' to its previous owner.

• to prevent other libraries from stealing the '$' function.

169. What does .delegate() allow you do, that .live() does not?

Answers:

• Attach the event handler to any DOM element.

• Override existing event listeners.

• Capture events that are fired from parent DOM elements.

• Instantiate event listeners before the document is ready.

170. What does the ".divClick" code snippet refers to in the following code snippet:  $('div#id1').bind('click.divClick', function () {alert('A div was clicked');});

Answers:

• A div class

• An event function

• A div ID

• An event type

• A namespace

171. $("[id|=experience]") will select which ID?

Answers:

• <div id="experienceFiftyOne">

• <div id="experience-51">

• <div id="experience51">

• <div id="experience_51">

172. What does $("ul>li:first") select ?

Answers:

• Selects the all <li> elements of the first <ul> element

• Selects the first <li> element of the all<ul> elements

• Selects the first <li> element of the first <ul> element

• Selects the first element of the first <ul> element

173. What does this do? $("p").find("span").end().css("border", "2px red solid");

Answers:

• Selects all paragraphs, finds span elements inside these, and reverts the selection back to the paragraphs, then apply CSS rule.

• Selects all paragraphs, apply CSS rule, then reverts the selection back to the spans.

• Selects all spans, then apply CSS rule.

• Selects all paragraphs, finds span elements inside these, go to the end of each paragraph, then apply CSS rule.

174. Which of the following is a valid jQuery multiple class selector?

Answers:

• none of these

• $('.a .b')

• $('.a', '.b')

• $('.a.b')

175. True or False? jQuery UI is part of jQuery.

Answers:

• False

• True

176. Which of these is NOT a valid way to initiate the document.ready call?

Answers:

• $(document).ready(function() { /* Stuff here */ });

• $(function() { /* Stuff here */ });

• (function(x) { x(function() { /* Stuff here */ }); })(jQuery);

• jQuery(document).ready(function($) { /* Stuff here */ })(jQuery);

177. What is an event handler?

Answers:

• A function that executes your code as the event occurs.

• A function that executes your code after the event occurs.

• A function that occurs during and after the event is executed.

• A function that executes your code before the event occurs.

178. In what scenario will the alert box show? $(function(){    if(!$("p"))        alert("hello"); });

Answers:

• When there are no p tags on the page

• When there are p tags on the page

• When there is more than one p tag on the page

• It will never show.

179. In what scenario will the alert box show? $(function(){    if(!$("p"))        alert("hello"); });

Answers:

• When there are no p tags on the page

• When there are p tags on the page

• When there is more than one p tag on the page

• It will never show.

180. The "complete" callback in a jQuery AJAX request, is called only after...

Answers:

• the AJAX request is successful without any errors

• the AJAX request finishes, irrespective of error or success

• the AJAX request is failed

• if there is no "success" callback defined in the AJAX request

181. What does the following return?  $.inArray("foo", ["foo", "bar"]);

Answers:

• true

• 0

• TRUE

• 1

182. What does the following code do?  $(".foobar").find(".foo").fadeOut();

Answers:

• Fade out of elements matching ".foobar"

• Fade out of all descendants of elements matching ".foo" inside those matching ".foobar"

• Fade out of elements matching ".foo" that are descendants of elements matching ".foobar"

• Fade out of all children of elements matching ".foobar"

183. What is an event handler?

Answers:

• A function that occurs during and after the event is executed.

• A function that executes your code after the event occurs.

• A function that executes your code as the event occurs.

• A function that executes your code before the event occurs.

184. True or false: The .blur() function can be bound to a form element to detect when a child element loses focus.

Answers:

• False

• True

185. You can animate 'color' and 'background-color' properties.

Answers:

• False

• True

186. The "complete" callback in a jQuery AJAX request, is called only after...

Answers:

• the AJAX request finishes, irrespective of error or success

• the AJAX request is failed

• if there is no "success" callback defined in the AJAX request

• the AJAX request is successful without any errors

187. How can you get the number of paragraphs in the html document using jQuery?

Answers:

• $('p').length

• $('p').count()

• $('p').length()

• count($('p'))

• $('p').count

188. $(".clicker").click(function() {     $('link[rel=stylesheet]').attr('href' , $(this).attr('rel'));    });  The above is used to do what?

Answers:

• Adds the contents of another stylesheet to the currently loaded one upon clicking the element with class "clicker"

• Nothing, it returns a console.log error

• Reload the currently selected stylesheet upon clicking the element with class "clicker"

• Change the stylesheet loaded in the page upon clicking the element with class "clicker"

189. What does the following code do?  $(".foobar").find(".foo").fadeOut();

Answers:

• Fade out of all descendants of elements matching ".foo" inside those matching ".foobar"

• Fade out of elements matching ".foo" that are descendants of elements matching ".foobar"

• Fade out of all children of elements matching ".foobar"

• Fade out of elements matching ".foobar"

190. How can we use protocol less URL while referencing jQuery from CDNs?

Answers:

• (both of these are correct)

• <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

• <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

191. How do you get the value of the selected radio button in a group of radio buttons with the name of 'radioName'?

Answers:

• $('input[name=radioName]:checked', '#myForm').val()

• $('input[name=radioName]:first').val()

• $('#myForm', 'input[name=radioName]').is('checked').val()

• None of these

192. Which will NOT select the second "li" element?

Answers:

• $( "li:eq( 2 )" )

• $( "li:nth-child( 2 )" )

• $( "li:eq( 1 )" )

193. How do I pull a native DOM element from a jQuery object?

Answers:

• $( "#foo" ).get(native[ 0 ]);

• $( "#foo" ).find(native[ 0 ]);

• $("#foo[0]");

• $( "#foo" ).get( 0 );

194. What does the filter() method do in this: $('div').filter('.nav')

Answers:

• The filter funtion is run when the DOM is initialized

• it sifts through all the divs and leaves only those with the nav class

• it sifts through all divs and leaves only those contained within a .nav element

• it filters all the ('.nav') and leaves only the divs

195. For best performance in modern browsers, which of the following would you use to select all radio inputs?

Answers:

• $('[input="radio"]');

• $('.radio');

• $('||radio');

• $('[input.radio]');

• $('[type="radio"]');

196. What is $(fn); a shortcut for?

Answers:

• $(window).on('load', fn);

• $(document).ready(fn);

• $( fn() ); // Shortcut to create or select elements using the string returned by the "fn" function.

197. Which one will be found faster?

Answers:

• $('div#element')

• $('div.element')

• $('.element')

• $('#element')

198. Given the following HTML code snippet:  <div id="wrapper">   <div class="wText">...</div>   ...<!-- more wText items here -->   <div class="wImg">...</div>   ...<!-- more wImg items here -->   <div class="wVideo">...</div>   ...<!-- more wVideo items here --> </div>  How would you get a collection of all the items inside the "wrapper"?

Answers:

• $('#wrapper').html();

• $('#wrapper').contents();

• $('#wrapper').find("all");

• $('#wrapper').children();

199. What does $('#myDiv').load('page.html') do?

Answers:

• it fires an AJAX request, fetches the result of page.html as text, and inserts it into the div

• It adds the string 'page.html' as the contents of the #myDiv div.

• it loads the #myDiv on the contents of the 'page.html' browser

200. What is the output of the following:  $.each([1,2,3], function(){   document.write(this + 1); });

Answers:

• "234"

• 1231

• undefined

• 223

201. Which of the following statement returns all anchor links that start with "https"?

Answers:

• $('a[href] = "https"');

• $('a[href="https"]');

• $('a[href$="https"]');

• $('a[href^="https"]');

202. What does $("div#intro .head") select?

Answers:

• The first element with id="head" inside any div element with class="intro"

• All elements with class="head" inside the first div element with id="intro"

• All div elements with id="intro" or class="head"

203. What is the equivalent of the following code? $('div').click(function {alert(1);});

Answers:

• $('div').call('click',function {alert(1);});

• $('div').event('click',function {alert(1);});

• $('div').bind('click',function {alert(1);});

• $('div').handler('click',function {alert(1);});

204. If you want to change the text displayed in a paragraph by adding text before what's currently displayed, which would be correct?

Answers:

• $('p').text('text to add');

• $('p').prepend('text to add');

• $('p').html('text to add');

• $('p').content('text to add');

• $('p').append('text to add');

205. Which of the following is correct?

Answers:

• jQuery is a python Library

• All of these

• jQuery is a JavaScript Library

• jQuery is a JSON Library

206. Which of the following is correct?

Answers:

• jQuery is a JSON Library

• jQuery is a JavaScript Library

• None of these

207. Which can be used to detect broken images?

Answers:

• image.error()

• $("img").isBroken()

• image.elements()

• $("img").error(callbackFunction)

• $("img").error()

208. Given the following HTML code snippet:  <div id="wrapper">   <div class="wText">...</div>   ...<!-- more wText items here -->   <div class="wImg">...</div>   ...<!-- more wImg items here -->   <div class="wVideo">...</div>   ...<!-- more wVideo items here --> </div>  How would you attach a click event to each of the items inside the wrapper?

Answers:

• $('div').click(function( e ) { alert("I got clicked!"); });

• $('div.wrapper').children().bind('click', function( e ) { alert("I got clicked!"); });

• $('#wrapper').children().click(function(e) { alert("I got clicked!"); });

• (all of these)

209. What does this return: $(".class").attr("id");

Answers:

• The value of the 'class' attribute for the first element in the set of matched elements

• The value of the 'id' attribute for the first element in the set of matched elements

• The value of the 'id' attribute for all the elements in the set of matched elements

• Nothing

210. How can the following be optimized while maintaining the ability to add ".foobar" elements without re-binding events:  <code> $('.foobar').live('click', fn); // equivalent of: $(document).on('click', '.foobar', fn); </code>

Answers:

• By using $.fn.delegate(event, fn) on the closest consistent parent of ".foobar". Such as $('.foobar-container').on('click', '.foobar', fn);

• By using $('.foobar').bind('click', fn)

• By using $(document).delegate('.foobar', 'click' , fn) instead of $('.foobar').live('click', fn);

211. What will be the value of "display" css property of the following tag?  $('span').hide(); $('span').show();

Answers:

• inherit

• inline-block

• inline

• block

• It will vary depending the value of the span's initial display property

212. How can I make a redirect page in jQuery?

Answers:

• window.location.replace("http://stackoverflow.com");

• $(location).attr('href','http://smarterer.com/');

• window.location.href = "http://stackoverflow.com";

• none of these

213. $("[id|=experience]") will select which ID?

Answers:

• <div id="experience_51">

• <div id="experienceFiftyOne">

• <div id="experience-51">

• <div id="experience51">

214. Attribute Contains Prefix Selector is:

Answers:

• [name*="value"]

• [name+="value"]

• [name~="value"]

• [name|="value"]

• [name$="value"]

215. What do you use jQuery.noConflict() for?

Answers:

• to restore the '$' to its previous owner.

• to make jQuery's $ function accessible by other libraries

• to prevent other libraries from stealing the '$' function.

• To only have one javascript library on a page.

216. Which of the following is a valid jQuery multiple class selector?

Answers:

• $('.a .b')

• $('.a.b')

• $('.a', '.b')

• none of these