jQuery Quiz-1 with answers

1. What does CDN stand for?

  • Complex Domain Name
  • Content Delivery Network
  • Code Deployment Network

2. jQuery UI is …

  • a theme in the jQuery Core library
  • a set of rules for implementing jQuery in a web page
  • a library of effects and widgets that complements the Core jQuery library

3. What does jQuery excel at?

  • Cross-browser compatibility
  • Browser styling
  • Upgrading old browsers

4. To add a new CSS class to a selected element, you …

  • Use the “addClass” method
  • Get your co-worker to do it for your
  • Use the “toggle” method

5. How do you conduct multiple queries with a single selector?

  • Separate the selectors with spaces, eg: $(‘p h1 div’)
  • Separate the selectors with commas, eg: $(‘p,h1,div’)
  • Pass in an array of selectors, eg: $([‘p’,’h1′,’div’])

6. A callback function is used …

  • To specify code to run after an action has completed
  • To fade-in a selected element
  • To let you know if you scored the job you interviewed for

Which one isn’t a jQuery easing style?

  • Linear
  • Spiral
  • Swing

8. What method is used to pause animation?

  • delay()
  • pause()
  • animate()

9. Which of the following is not a great source of assistance in creating animation?

  • jQuery UI
  • community plugins
  • The ScrollTo plugin

10. The best lightbox solution is:

  • Colorbox
  • One you code yourself
  • The solution that best matches your needs after you’ve done some research

11. To get the second element in the current jQuery selection, you use:

  • .eq(2)
  • .is(“:second”)
  • .eq(1)

12. To figure out the capabilities of a jQuery plugin, you should always:

  • Put random values in all the option fields to see what it does
  • Copy and paste settings from Google
  • Thoroughly read the documentation

13. The jQuery “data” method is used:

  • For storing custom values on an element, to be retrieved later
  • For billing purposes
  • To sort the z-order of selected elements

14. “Bubbling” is one type of event …

  • Deprecation
  • Replication
  • Propagation

15. A widget, in a jQuery context, refers to …

  • A standalone piece of functionality that can be reused
  • A DOM element that can only be selected once
  • An external plugin accessed through the JSON format

16. In an if statement, “||” and “&&” are what kind of operators?

  • Assignment
  • Logical
  • Comparison

17. The purpose of namespacing your code is to:

  • Show your fellow coders how good you are
  • Help prevent naming conflicts with other page scripts
  • Signify code that should execute on page load

18. “Browser sniffing” is used to execute different code based on the user’s browser (IE, Chrome, etc). This is:

  • Bad, because it’s not future-proof and better alternatives exist
  • Good, because it’s very simple to implement
  • Bad, because jQuery has no methods that help with browser sniffing

19. To execute code that will run after an AJAX call, even if the call fails:

  • Duplicate the code in both the “.done” and “.fail” handlers
  • Add the code to the “.always” method
  • Add the code as a parameter to the $.ajax call

20. Handling AJAX errors is:

  • Difficult, so don’t worry about it
  • Simple, so do it at the end of the project if there’s time
  • Simple, so make a habit of it

21. jQuery UI can help you do what to your forms?

  • Add server-side security to prevent SQL injections
  • Hash password fields
  • Add autocomplete functionality

22. What does progressive enhancement refers to?

  • Styling a web page in stages using the latest jQuery methods and actions
  • Providing an acceptable experience to all web users in a layered way starting with basic functionality
  • Adapting a project’s JavaScript quotient to fit a mobile device

23. When using the Ajax load() method, content must be …

  • Stored in a database
  • Stored on the same domain as the web page from which the script runs
  • Stored anywhere, as long as the content is password-protected

24. Adding a second parameter to a jQuery selector (e.g. the “this” in $(“”, this)) is used:

  • To specify a context (parent) for jQuery to search in
  • For keeping notes for the programmer
  • To tell jQuery to search backwards instead of forwards

25. Manipulating HTML lists with jQuery …

  • Requires a different mindset than when manipulating divs and spans
  • Is just as easy as manipulating anything else
  • Shouldn’t be attempted by beginners

26. Many jQuery methods (prop, text, addClass …) can accept a function as a parameter. This is useful because:

  • The function gives you the element’s current value so you can update it easily
  • It helps namespace the code
  • The function will warn you about any validation errors

27. What is jQuery Mobile grounded in?

  • Java
  • Cloud computing
  • HTML5 and CSS3

28. Content that’s immediately visible on a page is referred to as being …

  • Above the fold
  • Out of the box

29. What is a higher order function?

  • A function that works with external data, such as an Ajax call
  • A function that accesses the top level of the DOM
  • A function that takes a function as a parameter

30. $ sign represents jQuery  OR “$ sign can be replaced with “jQuery ” keyword”

  • False
  • True

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s