Question: 43
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
Answer: a. 1


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

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


Question: 45
Which of the following statements returns the number of matched elements of $('.class1')?

a. $('.class1').size();
b. count($('.class1'));
c. $('.class1').count;
d. None of the above
Answer: a. $('.class1').size();


Question: 46
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.
Answer: a. $('#id1).attr('href');


Question: 47
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.
Answer: b. No


Question: 48
Which of the following methods can be used to load data?

a. getJSON.
b. get.
c. ajaxSend.
d. ajaxStart.
Answer: a. getJSON. and b. get.


Question: 49
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');
        });
    }
Answer: a. function moveElement() {
        $('p.para').each(function(index) {
            $(this).appendTo('#content');
        });
    }



Question: 50
Which of the following events can be used to disable right click contextual menu?

a. contextmenu
b. contextualmenu
c. rightclickmenu
d. Right click contextual menu cannot be disabled
Answer: a. contextmenu


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

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


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


Question: 53
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 width animation, then height animation
b. first height animation, then width animation
c. both width animation and height animation occur at the same time.
d. random
Answer: b. first height animation, then width animation


Question: 54
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.
Answer: a. trigger function


Question: 55
What is the result of NaN == NaN?

a. true
b. false
c. An error occurs.
d. None of the above.
Answer: b. false


Question: 56
The css() function allows you to ----------?

a. change the css class attribute.
b. change the css file path.
c. apply the css class to an element.
d. change the inline style attribute of an element.
Answer: d. change the inline style attribute of an element.


Question: 57
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
Answer: e. None of the above


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


Question: 59
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.
Answer: a. Yes.


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


a. email=
b. email=&text1=default
c. text1=&text2=
d. Nothing in the alert box.
Answer: a. email=


Question: 61
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
Answer: e. b and c


Question: 62
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. 
Answer: a. $.ajax offers error callback option.


Question: 63
Consider the following code snippet:
 

$('#table1').find('tr').hide().slice(10, 20).show();

What is the result of this code snippet?


a. Showing table1's rows from 11th to 20th.
b. Showing table1's 20 rows from 10th.
c. Deleting rows of table1 from 10th to 20th.
d. Deleting 20 rows of table1 from 10th onward. 
Answer: a. Showing table1's rows from 11th to 20th.


Question: 64
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.
Answer: a. Replacing "bad" word in the inner html of div1.


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

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


Question: 66
Consider the following code snippet:
 

$('#table1 tr:odd').addClass('oddRow');
$('#table1 tr:even').addClass('evenRow');

The result of the above code snippet is ----------?


a. the odd rows of table1 have evenRow class, while the even rows have oddRow class
b. the odd rows of table1 have oddRow class, while the even rows have evenRow class
c. all rows of table1 have evenRow class
d. None of the above.
Answer: a. the odd rows of table1 have evenRow class, while the even rows have oddRow class


Question:67
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.
Answer: c. any ajax request starts and there is no active ajax request.


Question: 68
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
Answer: a. top and left


Question: 69
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');
Answer: a. $('div').append('<div class="footer">footer</div>');


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


a. the rows of table1 at order 3n + 1 (n = 0, 1, 2,...) have class firstRowClass
b. the rows of table1 at order 3n (n = 1, 2,...) have class firstRowClass
c. all rows of table1 have class firstRowClass
d. no row of table1 has class firstRowClass 
Answer: a. the rows of table1 at order 3n + 1 (n = 0, 1, 2,...) have class firstRowClass


Question: 71
$.merge(array1, array2);

The above function merges ----------?


a. array1 into array2.
b. array2 into array1.
c. array1 with array2 and returns the result.
d. The statement is invalid. The correct one is array1.merge(array2);
Answer: b. array2 into array1.


Question: 72
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: e. b and c


Question: 73
$.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.
Answer: a. Extends the object0 by merging object1 and object2 with object0.


Question: 74
Consider the following code snippet:
 

function function1() {
    alert(arguments.length);
  }

Which of the following is true when you run function1();?


a. An error occurs because arguments variable is undefined.
b. An error occurs because you call function1 with no arguments.
c. The alert box displays "undefined".
d. The alert box displays 0.
Answer: d. The alert box displays 0.


Question: 75
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.
Answer: a. A set of the fourth rows of the tables.


Question: 76
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.
Answer:  b. No.


Question: 77
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();
Answer: a. $("#id1").dialog();


Question: 78
Which of the following seems to be correct for ajaxStart(function()) method as shown in the below Code snippet?

$("#div1").ajaxStart(function())


a. Method Attaches a function to be executed before an Ajax request is sent.
b. Method Attaches a function to be executed whenever an Ajax request completes successfully.
c. Method Attaches a function to be executed whenever an AJAX request begins and there is none already activated.
d. None of the above.
Answer: c. Method Attaches a function to be executed whenever an AJAX request begins and there is none already activated.


Question: 79
How can an Ajax Request that has not yet received the response, be canceled or aborted?

a. //xhr is ajax variable
    xhr.abort()
b. //xhr is ajax variable
    xhr.cancel()
c. //xhr is ajax variable
    xhr.die()
d. //xhr is ajax variable
    xhr.destroy()
Answer: a. //xhr is ajax variable
    xhr.abort()



Question: 80
Which of the following is the correct way to get a Value of selected dropdownlist in jQuery without using the selected value?

a. $("#yourdropdownid option:selected").text();
b. $("[id*='MyDropDownId'] :selected");
c. $("option:selected", myVar).text()
d. $('select[name="thegivenname"] option:selected').val();
Answer: a. $("#yourdropdownid option:selected").text();


Question: 81
Which of the following is the correct way to get the current URL in jQuery?

a. var pathname = window.location.pathname;
b. $(location).attr('href');
c. $(location).value('href');
d. var pathname = window.location.routename;
Answer: b. $(location).attr('href');


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

a. this.$OuterDiv = $('
    ')
    .hide()
    .append($('
    ‘)

    .attr({ cellSpacing : 0 })
    .addClass("text")
    );
b. var t = $("

    ");
    $.append(t);
c. $('
    ',{
    text: 'Div text',
    'class': 'className'
    }).appendTo('#parentDiv');
d. var userInput = window.prompt("please enter selector");
    $(userInput).hide();
Answer: a. this.$OuterDiv = $('
    ')
    .hide()
    .append($('
    ‘)

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


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

a. $('.a.b')
b. $('.a, .b')
c. $(".a").filter(".b")
d. a.b
    {
    style properties
    }
Answer: a. $('.a.b')


Question: 84
Which of the following is the correct way to Hide menu div by clicking outside the menu div?

a. $('html').click(function() {
    //Hide the menus if visible
    });

    $('#menucontainer').click(function(event){
    event.stopPropagation();
    });
b. $('#menucontainer').click(function(event) {
    $('body').one('click',function() {
    // Hide the menus
    });

    event.stopPropagation();
    });
c. $(document).click(function(event) {
    if($(event.target).parents().index($('#menucontainer')) == -1) {
    if($('#menucontainer').is(":visible")) {
    $('#menucontainer').hide()
    }
    }
    })
d. 4 down vote
    $(document).click(function() {
    $(".overlay-window").hide();
    });
    $(".overlay-window").click(function() {
    return false;
    });
Answer: c. $(document).click(function(event) {
    if($(event.target).parents().index($('#menucontainer')) == -1) {
    if($('#menucontainer').is(":visible")) {
    $('#menucontainer').hide()
    }
    }
    })


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

Don't Miss A Single Updates

Remember to check your email account to confirm your subscription.

Blogger
Disqus
Post a comment ➜

No Comment