jQuery
Test
Consider
the following code snippet:
<ul
id=’id1’>
<li id=’li1’>Item 1</li>
<li id=’li2’>Item 2</li>
<li id=’li3’>Item 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’);
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
<li>Item</li> into each span that has item class.
d. Replaces each span tag
that has class item with a <li>Item</li>.
Which of the
following will select a particular option in a <select> element using its index?
$(‘select option
[value=”1”] ‘)
$(‘select option:eq(1)’)
$(‘select
option:contains(“Selection 1”) ’)
All of the above
What is
the result of this function: jQuery.makeArray ( true )?
a. 1
b. NaN
c. [ true ]
d. [ ]
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.
Consider
having multiple $(document).ready() function in one or many linked
JavaScript files.
Give this
information, which of the following will be executed?
a. first ready() function
b. last ready() function
c. All ready() functions
d. Non of them
Which of
the following events can be used to disable right click contextual menu?
a. contextmenu
b. contextualmenu
c. rightclickmenu
d. The right-click
contextual menu cannot be disabled
Which of
the following functions is/are built-in jQuery regular expression function(s)?
a. test
b. match
c. find
d. jQuery does not have
built-in regular expression functions
Consider
the following code snippet:
$(‘#id1’).animate({width:”240px”},
{ queue:false, duration:1000 }) .animate ({height:”320px”}, “fast”);
The order
of the animations of this code snippet is __________.
a. First the width
animation, then the height animation
b. First the height animation, then the width animation
c. Both the width
animation and the height animation occur at the same time
d. The order of animations
is random
Consider
the following code snippet:
<ul
id=’id1’>
<li id=’li1’>Item 1</li>
<li id=’li2’>Item 2</li>
<li id=’li3’>Item 3</li>
</ul>
Which of
the following code snippets returns(s) a set of all li tags within id1 except
for the 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’));
Which
option is correct to perform a synchronous AJAX request?
a. beforecreate: function
(node,targetNode,type,to) {
jQuery.ajax({
url:
‘http://example.com/catalog/create/’
+
targetNode.id
+ ‘?name=’
+ encode (to.inp[0].value),
success: function (result) {
if (result.isOk ==
false)
alert
(result.message);
}
});
}
b. beforecreate: function (node,targetNode,type,to) {
jQuery.ajax ({
url: ‘http://example.com/catalog/create/’
+ targetNode.id
+
‘?name=’
+
encode (to.inp [0].value),
success:
function (result) {
if (result.isOk ==
false)
alert
(result.message) ;
},
async: sync (true)
});
}
c. beforecreate: function (node,targetNode,type,to) {
jQuery.ajax ({
url: ‘http://example.com/catalog/create/’
+ targetNode.id
+ ‘?name=’
+
encode (to.inp [0].value),
success:
function (result) {
if (result.isOk ==
false)
alert (result.message) ;
}
,
async: false
}) ;
}
d. jQuery only allow asynchronous
AJAX request
each ()
is a generic __________ function.
a. comparator
b. operator
c. iterator
d. normal
Which of
the following functions can be used to stop event propagation?
a. stopPropagation
b. disablePropagation
c. cancelPropagation
d. preventPropagation
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
Which of
the following methods can be used to copy element?
a. clone
b. cloneTo
c. move
d. moveTo
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. function1, function2, and function3
$ (“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 enclosed in
div tags
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
Which of
the following methods can be used to utilize the animate function with the
backgroundColor style property?
a. Use the jQuery UI
library
b. There is no need to do anything as jQuery core already supports
that style property
c. There is no way to use
animate with that style property
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
Which of
the following values is/are valid value(s) of secondArgument in addClass
(“turnRed”, secondArgument) ; function, if the jQuery UI library is being used?
Note:
There may be more than one right answer.
a. “fast”
b. slow
c. 1000ms
d. 3000
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:
$
(‘#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
How can
the href for a hyperlink be changed using jQuery?
a. $ (“a”) .link (“http://www.google.com/”)
;
b. $ (“a”) .change
(“href”, “http://www.google.com/”) ;
c. $ (“a”) .link(“href”,
“http://www.google.com/”) ;
d. $ (“a”) .attr (“href”, “http://www.google.com/”) ;
Assuming
that the jQuery UI library is used 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 () ;
What is
the purpose of $ (document) .read () function in jQuery?
a. To execute functions
after all content and images are loaded
b. To execute functions after DOM is loaded
c. To execute functions
before DOM load
d. To execute functions
before content and images load
Which of
the following is the correct way to get the value of a textbox using id in
jQuery?
a. $ (“.textbox”) .text ()
b. $ (“#textbox”) .val ()
c. $ (“.textbox”) .val ()
d. $ (“#textbox”) .text ()
How or
where can a plugin be declared, so that the plugin methods are available for the
scrip?
a. In the head of the
document, include the plugin after main jQuery source file, before the 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
Which of
the following is the correct way to get “Option B” with the value ‘2’ from
following HTML code in jQuery?
<select
id=’list’>
<option value= ‘1’>Option
A</option>
<option value= ‘2’>Option
B</option>
<option value= ‘3’>Option
C</option>
</select>
a. $ (“#list [value=’2’]”)
.text () ;
b. $ (“#list option
[value= ‘2’]”) .text () ;
c. $ (this) .find
(“option:selected”) .text () ;
d. element.options
[element.selectedIndex] .text
The
position function gets the ________ positions of an element that are relative
to its offset parent.
a. top and left
b. top and right
c. bottom and left
d. bottom and right
Which of
the following returns the children tags of “id1”?
a. $ (‘#id1’) .children () ;
b. $ (‘#id1’) .getChildren
() ;
c. children (‘#id1’)
d. getChildren (‘#id1’) ;
If jQurey
is included before another library, how can conflict between jQuery and that
library be avoided?
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 using the jQuery
object when working with the jQuery library and using the $ object for other
libraries
The
height function returns the height of an element in _________.
a. pixel units
b. points units
c. em units
d. millimeter units
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
Which option
can be used to have jQuery wait for all images to load before executing
something on a page?
a. All jQuery code need to
add inside @function () { }
syntax
b. With jQuery, can use $(document) .ready () to execute something
when the DOM is loaded and $ (window) .load () to execute something when all
other things are loaded as well, such as the images
c. With jQuery, can use
$(document) .ready () or $(window) .load
() syntax as these both are the same
d. $ (window) .onLoad
(function () { })
Which of
the following makes use of jQuery to select multiple elements?
a. $ (‘table td’) .eq ([0,
5, 9])
b. $ (‘table td:eq(0),
table td:eq(5), table td:eq(9) ‘)
c. $ (‘table td’) .eqAny
([1, 5, 9]) ;
d. None of these
What is
the result of NaN == NaN?
a. true
b. alse
c. An error occurs
d. None of these
How can the
child img be selected inside the div with a selector?
a. jQuery (this) .children
(“img”) ;
b. jQuery (this) .find
(“img”) ;
c. $ (this) .find (“img”)
.attr (“alt”)
d. $ (this) .children
(“img”) .attr (“alt”)
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
the body
Which of
the following code snippets insert (s) the code snippet
<div
class=“footer”>footer</div>
at the
end of div tags?
Note:
There may be more than one right answer.
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’) ;
0 comments:
Post a Comment