Elance jQuery 1.3.2 Skills Test Questions

Question: 01
Consider the following code snippet:


<ul id='id1'>
  <li id='li1'>Items 1</li>
  <li id='li2'>Items 2</li>
  <li id='li3'>Items 3</li>
</ul>

Which of the following code snippets returns the same result as $('#id1 li').not($('#li2'));?

    a.     $('#li2').siblings();
    b.     $('#id2').siblings('#li2');
    c.     $('#li2').children();
    d.     $('#id2').children('#li2');


Question: 02
Consider the following code snippet:


$('#ul1 li').live('click', function1);
$('#ul1').after('<li id="lastLi">Last item</li>');

Is function1 executed if "lastLi" is clicked?

    a.     Yes
    b.     No
    c.     "lastLi" does not exist.


Question: 03
innerHeight function returns the inner height of an element, ___ the border and ___ the padding.


    a.     excludes, includes
    b.     excludes, excludes
    c.     includes, excludes
    d.     includes, includes


Question: 04
Consider the following code snippet:


$('#id1').animate({width:"240px"}, "slow").animate({height:"320px"}, "fast");

The order of the animations of this code snippet is:

    a.     first width animation, then height animation
    b.     first height animation, then width animation
    c.     both width animation and height animation occur at the same time.


Question: 05
Consider the following code snippet:


ajaxStart(function1);

The function1 will be executed when ___.

    a.     any ajax request starts.
    b.     ajaxStart function is executed.
    c.     any ajax request starts and there is no active ajax request.
    d.     jQuery does not have ajaxStart function.


Question: 06
Read the following JavaScript code snippet:


$('div#id1').bind('click.divClick', function () {alert('A div was clicked');});

What is divClick in the code snippet?

    a.     An event type.
    b.     An event function.
    c.     A div class.
    d.     A namespace.


Question: 07
Which of the following methods can be used to copy element?


    a.     clone.
    b.     cloneTo.
    c.     move.
    d.     moveTo.


Question: 08
Which of the following statements return(s) a set of p tags that contain "jQuery"?


    a.     $('p:contains(jQuery)');
    b.     $('p:contains("jQuery")');
    c.     $('p:has("jQuery")');
    d.     a and b
    e.     a and c


Question: 09
What is the result of the following code snippet?


jQuery.unique([1, 2, 2, 3, 3, 1]);

    a.     [1, 2, 3].
    b.     [1, 2, 3, 1].
    c.     [1, 3, 2, 1, 2, 3].
    d.     [1, 1, 2, 2, 3, 3].
    e.     None of the above


Question: 10
Which of the following methods can be used to delete a specified tag?


    a.     remove.
    b.     delete.
    c.     truncate.
    d.     empty.


Question: 11
Assume that you need to build a function that manipulates an image when the image is loaded. Which of the following functions should you use?


    a.     ready
    b.     load
    c.     change
    d.     focus


Question: 12
Consider the following code snippet:


$.map(array1, function1);

Which of the following arguments is/are valid arguments of function1?

    a.     The index of the element to be translated in array1.
    b.     The item to be translated.
    c.     function1 has no arguments.
    d.     a and b
    e.     a and c


Question: 13
How or Where can we declare a plugin so that the plugin methods are available for our script?


    a.     In the head of the document, include the plugin after main jQuery source file, before our script file.
    b.     In the head of the document, include the plugin after all other script tags.
    c.     In the head of the document, include the plugin before all other script tags.
    d.     Anywhere in the document.


Question: 14
$('#id1').animate({width:"80%"}, "slow")

The above code snippet will ___.


    a.     animate the tag with id1 from the current width to 80% width.
    b.     animate the tag with id1 from 80% width to current width.
    c.     animate the tag with id1 from the current 80% width to 0px.
    d.     animate the tag with id1 from 80% width to 100% width.


Question: 15
Which of the following functions can be used to bind an event handler to display a message when the window is closed, reloaded or navigated to another page?


    a.     end
    b.     exit
    c.     unload
    d.     None of the above.


Question: 16
Which of the following commands creates a basic dialog containing this code snippet <div id="id1"> Simple dialog</div> using jQuery UI?


    a.     $("#id1").dialog();
    b.     $('#id1).showDialog();
    c.     $('#id1).widget();
    d.     $('#id1).showWidget();


Question: 17
Which of the following code snippets insert(s) the code snippet <div class="footer">footer</div> at the end of div tags?


    a.     $('div').append('<div class="footer">footer</div>');
    b.     $('div').appendTo('<div class="footer">footer</div>');
    c.     $('<div class="footer">footer</div>').append('div');
    d.     $('<div class="footer">footer</div>').appendTo('div');


Question: 18
Which of the following functions moves p tags that have para class to div with content id?


    a.     function moveElement() {
    $('p.para').each(function(index) {
        $(this).appendTo('#content');
    });
}
    b.     function moveElement() {
    $('p.para').each(function(index) {
        $(this).append('#content');
    });
}
    c.     function moveElement() {
    $('p.para').each(function(index) {
        $(this).insertAfter('#content');
    });
}
    d.     function moveElement() {
    $('p.para').each(function(index) {
        $(this).after('#content');
    });
}


Question: 19
What is the result of this function jQuery.makeArray ( true )?


    a.     1
    b.     NaN
    c.     [ true ]
    d.     []


Question: 20
Is it true that we have to place the result of jQuery.getScript between <script type="text/javascript"></script> tags in order to use the loaded script?


    a.     Yes.
    b.     No.


Question: 21
Is the following code snippet a valid ajax request?


$.ajax({data: {'name': 'jQuery'},});

    a.     Yes.
    b.     No, because it does not have url.
    c.     No, because it does not have any argument after the comma.
    d.     No, because the function ajax does not exist in jQuery.


Question: 22
Which of the following gets the href attribute of "id1"?


    a.     $('#id1').attr('href');
    b.     $('#id1').getAttribute('href');
    c.     $('#id1')[0].attr('href');
    d.     All of the above.


Question: 23
What does $('tr:nth-child(4)') return?


    a.     A set of the fourth rows of the tables.
    b.     A set of the fifth rows of the tables.
    c.     A set of the fifth tr tags of the tables which have "nth-child(4)" class.
    d.     A set of the fifth tr tags of the tables which have "nth-child(4)" id.


Question: 24
Which of the following functions can be used to stop event propagation?


    a.     stopPropagation
    b.     disablePropagation
    c.     cancelPropagation
    d.     preventPropagation


Question: 25
The hide() function hides an element by ___.


    a.     setting "display" inline style attribute of that element to "none".
    b.     setting "visibility" inline style attribute of that element to "hidden".
    c.     setting the horizontal attribute of that element to "-100".
    d.     setting the vertical attribute of that element to "-100".


Question: 26
$.extend(false, object0, object1, object2);

What does the above do?

    a.     Extends the object0 by merging object1 and object2 with object0.
    b.     Extends the object1 by merging object0 and object2 with object1.
    c.     Extends the object2 by merging object0 and object1 with object2.
    d.     The statement is invalid because its arguments are invalid.


Question: 27
Consider the following code snippet:


$('#div1').html($('#div1').html().replace(/bad/, " "));

Which of the following is the result of this code snippet?

    a.     Replacing "bad" word in the inner html of div1.
    b.     Removing any word containing "bad" in the inner html of div1.
    c.     Appending an inner html of div1 which removes "bad" word to div1's inner html.
    d.     Appending an inner html of div1 which removes any word containing "bad" to div1's inner html.


Question: 28
jQuery allows simulating an event to execute an event handler as if that event has just occurred by using ___.


    a.     trigger function
    b.     execute function
    c.     intimate function
    d.     jQuery does not have this feature.


Question: 29
is() function ___ the current selection against an expression.


    a.     checks
    b.     finds
    c.     filters
    d.     gets


Question: 30
Which of the following methods can be used to utilize animate function with backgroundColor style property?


    a.     Use jQuery UI library.
    b.     There is no need to do anything as jquery core already supports that style property.
    c.     There's no way to use animate with that style property.


Question: 31
Which of the following functions will return an empty set when end() function is chained right after that function?


    a.     add
    b.     children
    c.     filter
    d.     remove


Question: 32
jQuery allows you to use ___ function to switch between showing and hiding an element.


    a.     show
    b.     hide
    c.     switch
    d.     toggle


Question: 33
Which of the following values is/are valid argument(s) of eq() function?


    a.     1
    b.     '2'
    c.     both a and b
    d.     neither a nor b


Question: 34
$('ul#myId > li');

What does the above statement return?

    a.     A set of tags whose id is "li".
    b.     A set of tags which contains class "li".
    c.     A set of li tags which are children of ul tags that have "myId" class.
    d.     A set of li tags which are children of ul tags that have "myId" id.


Question:35
What does $('tr.rowClass:eq(1)'); return?


    a.     One element set which is the second row of the first table.
    b.     One element set which is the first row of the first table.
    c.     A set of tr tags which have "rowClass:eq(1)" class .
    d.     A set of tr tags which have "eq(1)" class .


Question: 36
Consider the following code snippet:


$(document).ready(function1);
$(document).ready(function2);
$(document).ready(function3);

Which of the following functions are executed when DOM is ready?

    a.     function1
    b.     function2
    c.     function3
    d.     a, b and c
    e.     No function is executed.


Question: 37
Which of the following statements return(s) a set of even rows?


    a.     $('tr').filter(':even');
    b.     $('tr:nth-child(even)');
    c.     $('tr:odd');
    d.     a and b
    e.     b and c


Question: 38
One advantage of $.ajax function over $.get or $.post is that ___.


    a.     $.ajax offers error callback option.
    b.     $.ajax is easier to use.
    c.     $.ajax allows passing request parameters.
    d.     the result of $.ajax is formatted.


Question: 39
Which of the following statements returns all https anchor links?


    a.     $('a[href^=https]');
    b.     $('a[href$=https]');
    c.     $('a[href=https]');
    d.     $('a[href]=https');


Question: 40
What is the difference between $('p').insertBefore(arg1) and $('p').before(arg2) statement?


    a.     The former inserts p tags before the tags specified by arg1, the latter inserts content specified by arg2 before all p tags.
    b.     The former inserts content specified by arg1 before p tags, the latter inserts p tags before tags specified by arg2.
    c.     The former inserts arg1 inside p tags, the latter inserts p tags inside tags specified by arg2.
    d.     The former inserts p tags inside tags specified by arg1, the latter inserts arg2 inside p tags.

Don't Miss A Single Updates

Remember to check your email account to confirm your subscription.

Blogger
Disqus
Post a comment ➜

No Comment