Upwork Test Answer jQuery 1.3.2 Skill Test Part 01

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

a. test
b. match
c. find
d. jQuery does not have regular expression built-in functions.
Answer: b. match


Question: 02
The height function returns the height of an element in --------------?

a. pixel unit
b. point unit
c. em unit
d. millimeter unit
Answer: a. pixel unit


Question: 03
offset function gets the current offset of the first matched element in pixels relative to the ---------?

a. document
b. parent element
c. children element
d. container
Consider the following code snippet:
$.map(array1, function1);
Answer: a. document


Question: 04
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
Answer: d. a and b


Question: 05
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');
$('#id1').animate({width:"80%"}, "slow")
Answer: a. $('a[href^=https]');


Question: 06
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.
Answer: a. animate the tag with id1 from the current width to 80% width.


Question: 07
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.
Answer: a. In the head of the document, include the plugin after main jQuery source file, before our script file.


Question: 08
Consider the following code snippet:

$(document).ready(function() {
  $('div').each(function(index) {
    alert(this);
  });
});

Which of the following objects does the 'this' variable refer to?


a. window
b. document
c. The current div tag of the iteration
d. The last element tag in body
Answer: c. The current div tag of the iteration


Question: 09
Which of the following returns the children tags of "id1"?

a. $('#id1').children();
b. $('#id1').getChildren();
c. children('#id1');
d. getChildren('#id1');
Answer: a. $('#id1').children();


Question: 10
Which of the following arguments is/are (a) valid argument(s) of fadeIn function?

a. 'slow'
b. 1000ms
c. 3000
d. a and b
e. a and c
Answer: e. a and c


Question: 11
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.
Answer: d. a, b and c


Question: 12
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.
Answer: b. There is no need to do anything as jquery core already supports that style property.


Question: 13
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.
Answer: d. A namespace.   


Question: 14
Which of the following values is/are valid value(s) of secondArgument in addClass('turnRed', secondArgument); function, if we use jQuery UI library?

a. 'fast'
b. slow
c. 1000ms
d. 3000
Answer: d. 3000


Question: 15
$("div").find("p").andSelf().addClass("border");
The statement adds class border to --------------?

a. all div tags and p tags in div tags
b. all div tags
c. all p tags
d. all p tags that in div tag
Answer: a. all div tags and p tags in div tags


Question: 16
Which of the following functions can be used to attach event handler to an element?

a. bind
b. attach
c. add
d. handle
Answer: a. bind


Question: 17
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 .
Answer: a. One element set which is the second row of the first table.


Question: 18
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".
Answer: a. setting "display" inline style attribute of that element to "none".


Question: 19
is() function --------- the current selection against an expression?

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


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

a. $('#id1').fadeOut('fast'); $('#id2').fadeIn('slow');
b. $('#id2').fadeIn('slow'); $('#id1').fadeOut('fast');
c. $('#id1').fadeOut('fast', function() {$('#id2').fadeIn('slow')});
d. $('#id2').fadeIn('slow', function() {$('#id1').fadeOut('fast')});
Answer: c. $('#id1').fadeOut('fast', function() {$('#id2').fadeIn('slow')});


Question: 21
If you include jQuery after other library, how do you disable the use of $ as a shortcut for jQuery?

a. By calling jQuery.noConflict(); right after including jQuery.
b. By calling jQuery.useDefault = false; right after including jQuery.
c. By calling jQuery.useShortcut = false; right after including jQuery.
d. By calling jQuery.conflict = false; right after including jQuery.
Answer: a. By calling jQuery.noConflict(); right after including jQuery.


Question: 22
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);
});

What does the alert box display if you click on "id1"?


a. Message
b. New message
c. Nothing
d. None of the above
Answer: a. Message


Question: 23
Consider the following code snippet:

$('#button1').bind('click', function(data) {...});

What is the data argument?


a. Click event's data
b. Function's data
c. Global variable
d. Local variable
Answer: b. Function's data


Question: 24
Which of the following statements select(s) all option elements that are selected?

a. $(':selected');
b. $('select[selected]');
c. $('option:selected');
d. a and c
e. b and c
Answer: d. a and c


Question: 25
Inner Height 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
Answer: a. excludes, includes  


Question: 26
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
Answer: d. a and b


Question: 27
jQuery allows you to use -------- function to switch between showing and hiding an element?

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


Question: 28
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();?


a. <html>
b. <head>
c. <body>
d. a and c
e. b and c
Answer: d. a and c


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


Question: 30
each is a generic ------- function.

a. comparator
b. operator
c. iterator
d. normal
Answer: a. comparator


Question: 31
$('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.
Answer: d. A set of li tags which are children of ul tags that have "myId" id.


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

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


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

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


Question: 34
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.
Answer: a. The former inserts p tags before the tags specified by arg1, the latter inserts content specified by arg2 before all p tags.

Question: 35
$.grep(array1, function1);
The above statement -------- the elements of array1 array which satisfy function1 function.

a. sorts
b. updates
c. removes
d. finds
Answer: d. finds


Question: 36
Which of the following statements uses a valid selector?

a. $('P');
b. $('#myId');
c. $('.myClass');
d. a, b and c
e. b and c
Answer: d. a, b and c


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

Which of the following code snippets return(s) a set of all li tags within "id1" except for li tag with id "li2"?


a. $('#id1 li').not($('#li2'));
b. $('#id1 li').except($('#li2'));
c. $('#id1 li').remove($('#li2'));
d. $('#id1 li').delete($('#li2'));
Answer: a. $('#id1 li').not($('#li2'));


Question: 38
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
Answer: c. filter


Question: 39
Assuming that you use jQuery UI library to make a list sortable, which of the following code snippets makes "list1" sortable?

a. $('#list1').sortable();
b. $('#list1').changeable();
c. $('#list1').interchangeable();
d. $('#list1').organizeable();
Answer: a. $('#list1').sortable();


Question: 40
The outer height is returned by outerHeight function including ------- and ------- by default?

a. border, padding
b. border, margin
c. margin, padding
d. None of the above.
Answer: a. border, padding


Question: 41
$('#a1').one('click', {times: 3}, function1);
Which of the following is true for the above?

a. function1 will be executed once regardless of the number of times a1 is clicked.
b. function1 will be executed at most 3 times if a1 is clicked more than twice.
c. There is at most one instance of function1 to be executed at a time.
d. There are at most three instances of function1 to be executed at a time.
Answer: a. function1 will be executed once regardless of the number of times a1 is clicked.


Question: 42
Consider the following code snippet:

$('span.item').each(function (index) {
    $(this).wrap('«li»Item«/li»');
});

What does this code snippet do?


a. Wraps each span tag that has class item within a li tag.
b. Inserts each span tag that has class item into a li tag.
c. Inserts «font size=2»«li»Item«/li»«/font» into each span that has item class.
d. Replaces each span tag that has class item with a «font size=2»«li»Item«/li»«/font».
Answer: a. Wraps each span tag that has class item within a li tag.

[ You may also see the first post for getting top score >> Upwork Test Answer jQuery 1.3.2 Skill Test Part 02 ]

Don't Miss A Single Updates

Remember to check your email account to confirm your subscription.

Blogger
Disqus
Post a comment ➜

No Comment