Saturday, October 4, 2014

oDesk Knowledge of jQuery 1.3.2 Skills Test Answers 2017

oDesk Knowledge of jQuery 1.3.2 Skills 
Test Answers 2017


Question:-  Which of the following functions is/are jQuery regular expression built-in function(s)?
Answer:- b. match

Question:-  The height function returns the height of an element in ________.
Answer:- a. pixel unit

Question:-  offset function gets the current offset of the first matched element in pixels relative to the ________.
Answer:- a. document

Question:-  Consider the following code snippet:
$.map(array1, function1);

Question:-  Which of the following arguments is/are valid arguments of function1?
Answer:- d. a and b

Question:-  Which of the following statements returns all https anchor links?
Answer:- a. $('a[href^=https]');

Question:-  The above code snippet will ________.
Answer:- a. animate the tag with id1 from the current width to 80% width.

Question:-  How or Where can we declare a plugin so that the plugin methods are available for our script?
Answer:- a. In the head of the document, include the plugin after main jQuery source file, before our script file.

Question:-  Consider the following code snippet:
$(document).ready(function() {
  $('div').each(function(index) {
    alert(this);
  });
});

Question:-  Which of the following objects does the 'this' variable refer to?
Answer:- c. The current div tag of the iteration

Consider the following code snippet:
$(document).ready(function1);
$(document).ready(function2);
$(document).ready(function3);

Question:-  Which of the following functions are executed when DOM is ready?
Answer:- d. a, b and c

Question:-  Which of the following methods can be used to utilize animate function with backgroundColor style property?
Answer:- b. There is no need to do anything as jquery core already supports that style property.

Question:-  Read the following JavaScript code snippet:
$('div#id1').bind('click.divClick', function () {alert('A div was clicked');});

What is divClick in the code snippet?.
Answer:- d. A namespace.

Question:-  Which of the following values is/are valid value(s) of secondArgument in addClass('turnRed', secondArgument); function, if we use jQuery UI library?
Answer:- a. 'fast'
d. 3000
$("div").find("p").andSelf().addClass("border");

Question:-  The statement adds class border to ________.
Answer:- a. all div tags and p tags in div tags

Question:-  Which of the following functions can be used to attach event handler to an element?
Answer:- a. bind

Question:-  What does $('tr.rowClass:eq(1)'); return?
Answer:- a. One element set which is the second row of the first table.

Question:-  The hide() function hides an element by ________.
Answer:- a. setting "display" inline style attribute of that element to "none".

Question:-  is() function ________ the current selection against an expression.
Answer:- a. checks

Question:-  Assume that you want that first the tag with "id1" fades out and then the tag with "id2" fades in. Which of the following code snippets allow(s) you to do so?
Answer:- c. $('#id1').fadeOut('fast', function() {$('#id2').fadeIn('slow')});

Question:-  If you include jQuery after other library, how do you disable the use of $ as a shortcut for jQuery?
Answer:- a. By calling jQuery.noConflict(); right after including jQuery.

Question:-  Consider the following code snippet:
var message = 'Message';
$('#id1').bind('click', {msg: message}, function(event) {
alert(event.data.msg);
});
message = 'New message';
$('#id2').bind('click', {msg: message}, function(event) {
alert(event.data.msg);
});

Question:-  What does the alert box display if you click on "id1"?
Answer:- a. Message

Question:-  Consider the following code snippet:
$('#button1').bind('click', function(data) {...});

Question:-  What is the data argument?
Answer:- b. Function's data

Question:-  Which of the following statements select(s) all option elements that are selected?
Answer:- d. a and c

Question:-  Inner Height function returns the inner height of an element, ________ the border and ________ the padding.
Answer:- a. excludes, includes

Question:-  Which of the following statements return(s) a set of p tags that contain "jQuery"?
Answer:- d. a and b

Question:-  jQuery allows you to use ________ function to switch between showing and hiding an element.
Answer:- d. toggle

Question:-  Consider the following code snippet:
<div id='id1'><div id='id2'>Div 2</div></div>

Question:-  Which of the following tags is/are in the result of $('#id2').parents();?
Answer:- d. a and c

Question:-  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?
Answer:- c. unload

Question:-  each is a generic ________ function.
Answer:- a. comparator


Question:-  What does the above statement return?
Answer:- d. A set of li tags which are children of ul tags that have "myId" id.

Question:-  Which of the following commands creates a basic dialog containing this code snippet «font size=2»«div id="id1"»Simple dialog«/div»«/font» using jQuery UI?
Answer:- a. $('#id1).dialog();

Question:-  What is the result of this function jQuery.makeArray ( true )?
Answer:- d. []

Question:-  What is the difference between $('p').insertBefore(arg1) and $('p').before(arg2) statement?
Answer:- a. The former inserts p tags before the tags specified by arg1, the latter inserts content specified by arg2 before all p tags.
$.grep(array1, function1);

Question:-  The above statement ________ the elements of array1 array which satisfy function1 function.
Answer:- d. finds

Question:-  Consider the following code snippet:
var message = 'Message';
$('#id1').bind('click', function() {
    alert(message);
});
message = 'New message';
$('#id2').bind('click', function() {
    alert(message);
});

Question:-  What does the alert box display if you click on "id1"?
Answer:- a. Message

Question:-  Which of the following statements uses a valid selector?
Answer:- d. a, b and c
e. b and c

Question:-  Consider the following code snippet:
<font size=2>
<ul id='id1'>
  <li id='li1'>Items 1</li>
  <li id='li2'>Items 2</li>
  <li id='li3'>Items 3</li>
</ul>
</font>

Question:-  Which of the following code snippets return(s) a set of all li tags within "id1" except for li tag with id "li2"?
Answer:- a. $('#id1 li').not($('#li2'));

Question:-  Which of the following functions will return an empty set when end() function is chained right after that function?
Answer:- c. filter

Question:-  Assuming that you use jQuery UI library to make a list sortable, which of the following code snippets makes "list1" sortable?
Answer:- a. $('#list1').sortable();

Question:-  The outer height is returned by outerHeight function including ________ and ________ by default.
Answer:- a. border, padding
$('#a1').one('click', {times: 3}, function1);

Question:-  Which of the following is true for the above?
Answer:- a. function1 will be executed once regardless of the number of times a1 is clicked.

Question:-  Consider the following code snippet:
$('span.item').each(function (index) {
    $(this).wrap('«li»Item«/li»');
});

Question:-  What does this code snippet do?
Answer:- a. Wraps each span tag that has class item within a li tag.

Question:-  Which of the following values is/are valid argument(s) of eq() function?
Answer:- a. 1

Question:-  Which of the following methods can be used to delete a specified tag?
Answer:- a. remove.

Question:-  Which of the following statements returns the number of matched elements of $('.class1')?
Answer:- a. $('.class1').size();

Question:-  Which of the following gets the href attribute of "id1"?
Answer:- a. $('#id1).attr('href');

Question:-  If you include jQuery before another library, how do you avoid conflict between jQuery and that library?
Answer:- a. By calling jQuery.noConflict(); right after including jQuery.

Question:-  Consider the following code snippet:
$('#ul1 li').live('click', function1);
$('#ul1').after('<li id="lastLi">Last item</li>');

Question:-  Is function1 executed if "lastLi" is clicked?
Answer:- b. No

Question:-  Which of the following methods can be used to load data?
Answer:- a. getJSON.
b. get.

Question:-  Which of the following functions moves p tags that have para class to div with content id?
Answer:- a. function moveElement() {
        $('p.para').each(function(index) {
            $(this).appendTo('#content');
        });
    }

Question:-  Which of the following events can be used to disable right click contextual menu?
Answer:- a. contextmenu

Question:-  Which of the following functions can be used to stop event propagation?
Answer:- a. stopPropagation

Question:-  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?
Answer:- b. load

Question:-  Consider the following code snippet:
$('#id1').animate({width:"240px"}, { queue:false, duration:1000 }).animate({height:"320px"}, "fast");

Question:-  The order of the animations of this code snippet is ________.
Answer:- b. first height animation, then width animation

Question:-  jQuery allows simulating an event to execute an event handler as if that event has just occurred by using ________.
Answer:- a. trigger function

Question:-  What is the result of NaN == NaN?
Answer:- a. true
b. false

Question:-  The css() function allows you to ________.
Answer:- d. change the inline style attribute of an element.

Question:-  What is the result of the following code snippet?
jQuery.unique([1, 2, 2, 3, 3, 1]);
.
Answer:- e. None of the above

Question:-  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'));?
Answer:- a. $('#li2').siblings();

Question:-  Is the following code snippet a valid ajax request?
$.ajax({data: {'name': 'jQuery'},});
Answer:- a. Yes.

Question:-  Consider the following code snippet:
<form id="form1">
    <input type="text" id="text1" value="default" />
    <input type="text" name="email" />
</form>
<script type="text/javascript">
    function submitForm1()
    {
      alert($('#form1').serialize());
    }
</script>

What does the alert box display when the function submitForm1 is called?
Answer:- a. email=

Question:-  Which of the following statements return(s) a set of even rows?
Answer:- e. b and c

Question:-  One advantage of $.ajax function over $.get or $.post is that ________.
Answer:- a. $.ajax offers error callback option.

Question:-  What is the result of this code snippet?
Answer:- a. Showing table1's rows from 11th to 20th.

Question:-  Which of the following is the result of this code snippet?
Answer:- a. Replacing "bad" word in the inner html of div1.

Question:-  Which of the following methods can be used to copy element?
Answer:- a. clone.

Consider the following code snippet:
$('#table1 tr:odd').addClass('oddRow');
$('#table1 tr:even').addClass('evenRow');

The result of the above code snippet is ________.
Answer:- a. the odd rows of table1 have evenRow class, while the even rows have oddRow class

Question:-  Consider the following code snippet:
$('#id1').animate({width:"240px"}, "slow").animate({height:"320px"}, "fast");

Question:-  The order of the animations of this code snippet is:
Answer:- a. first width animation, then height animation

Question:-  Consider the following code snippet:
ajaxStart(function1);

Question:-  The function1 will be executed when ________.
Answer:- c. any ajax request starts and there is no active ajax request.

Question:-  position function gets the ________ positions of an element that are relative to its offset parent.
Answer:- a. top and left

Question:-  Which of the following code snippets insert(s) the code snippet <div class="footer">footer</div> at the end of div tags?
Answer:- a. $('div').append('<div class="footer">footer</div>');

Question:-  Consider the following code snippet:$('#table1').find('tr').filter(function(index) { return index % 3 == 0}).addClass('firstRowClass');

The result of the above code snippet is ________.
Answer:- a. the rows of table1 at order 3n + 1 (n = 0, 1, 2,...) have class firstRowClass
$.merge(array1, array2);

Question:-  The above function merges ________.
Answer:- b. array2 into array1.

Question:-  Consider the following code snippet:
<div id='id1'><div id='id2'>Div 2</div></div>

Which of the following tags is/are in the result of $('#id2').parents();?
Answer:- d. a and c
e. b and c
$.extend(false, object0, object1, object2);

Question:-  What does the above do?
Answer:- a. Extends the object0 by merging object1 and object2 with object0.

Question:-  Consider the following code snippet:
  function function1() {
    alert(arguments.length);
  }

Question:-  Which of the following is true when you run function1();?
Answer:- d. The alert box displays 0.

Question:-  What does $('tr:nth-child(4)') return?
Answer:- a. A set of the fourth rows of the tables.

Question:-  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?
Answer:- a. Yes.
b. No.

Question:-  Consider the following code snippet:
$('span.item').each(function (index) {
    $(this).wrap('<li>Item</li>');
});

Question:-  What does this code snippet do?
Answer:- a. Wraps each span tag that has class item within a li tag.

$("div").find("p").andSelf().addClass("border");

Question:-  The statement adds class border to ________.
Answer:- a. all div tags and p tags in div tags

Question:-  Which of the following commands creates a basic dialog containing this code snippet <div id="id1"> Simple dialog</div> using jQuery UI?
Answer:- a. $("#id1").dialog();

Question:-  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>

Question:-  Which of the following code snippets return(s) a set of all li tags within "id1" except for li tag with id "li2"?
Answer:- a. $('#id1 li').not($('#li2'));

Question:-  Consider the following code snippet:
$('span.item').each(function (index) {
    $(this).wrap('<li>Item</li>');
});

Question:-  What does this code snippet do?
Answer:- d. Replaces each span tag that has class item with a <li>Item</li>.

Question:-  Which of the following seems to be correct for ajaxStart(function()) method as shown in the below Code snippet?
$("#div1").ajaxStart(function())
Answer:- c. Method Attaches a function to be executed whenever an AJAX request begins and there is none already activated.

Question:-  Consider the following code snippet:
$('span.item').each(function (index) {
    $(this).wrap('<li>Item</li>');
});

Question:-  What does this code snippet do?
Answer:- a. Wraps each span tag that has class item within a li tag.

Question:-  Which of the following code snippets insert(s) the code snippet <div class="footer">footer</div> at the end of div tags?
Answer:- a. $('div').append('
    footer
    ');

d. $('
    footer
    ').appendTo('div');

Question:-  Consider the following code snippet:
<form id="form1">
    <input type="text" id="text1" value="default" />
    <input type="text" name="email" />
</form>
<script type="text/javascript">
    function submitForm1()
    {
      alert($('#form1').serialize());
    }
</script>

Question:-  What does the alert box display when the function submitForm1 is called?
Answer:- a. email=

Question:-  Which of the following functions moves p tags that have para class to div with content id?
Answer:- c. function moveElement() {
        $('p.para').each(function(index) {
            $(this).insertAfter('#content');
        });
    }

Question:-  Which of the following is true when you run function1();?
Answer:- d. The alert box displays 0.

Question:-  How can an Ajax Request that has not yet received the response, be canceled or aborted?
Answer:- a. //xhr is ajax variable
    xhr.abort()

Question:-  Which of the following is the correct way to get a Value of selected dropdownlist in jQuery without using the selected value?
Answer:- a. $("#yourdropdownid option:selected").text();

Question:-  Which of the following is the correct way to get the current URL in jQuery?
Answer:- b. $(location).attr('href');

Question:-  Which of the following is the correct way to do the following javascript Code with jQuery? var d = document; var odv = d.createElement("div"); odv.style.display = "none";this.OuterDiv = odv; var t = d.createElement("table"); t.cellSpacing = 0; t.className = "text"; odv.appendChild(t);
Answer:- a. this.$OuterDiv = $('
    ')
    .hide()
    .append($('
    ‘)

    .attr({ cellSpacing : 0 })
    .addClass("text")
    );

Question:-  Which of the following is the correct way to select all the elements with JQuery from html that have the two classes a and b?
Answer:- a. $('.a.b')


Question:-  Which of the following is the correct way to Hide menu div by clicking outside the menu div?
Answer:- c. $(document).click(function(event) {
    if($(event.target).parents().index($('#menucontainer')) == -1) {
    if($('#menucontainer').is(":visible")) {
    $('#menucontainer').hide()
    }
    }
    })

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.