News:

SQL Table To C# Entity Model ConverterEntity Model (Class Properties) to SQL Table ConverterIf you encounter any trouble visiting our site, please contact us.

Mcq Answers for Jquery

<span id="ref"> <a name=Reference>Check out</a> the FAQ on <a href="http://www.contoso.com"> Contoso</a>'s web site for more information: <a href="http://www.contoso.com/faq">FAQ</a>. </span> 
<a href="http://www.contoso.com/home">Home</a>

You need to write a JavaScript function that will dynamically format in boldface all of the hyperlinks in the ref span. Which code segment should you use?

  1. $("#ref").filter("a[href]").bold();
  2. $("ref").filter("a").css("bold");
  3. $("a").css({fontWeight:"bold"});
    
  4. $("#ref a[href]").css({fontWeight:"bold"});
    
Answer: Answer is d

<div id="target"> </div>

You have a JavaScript array named imageurls that contains a list of image URLs. You need to write a JavaScript function that will insert images from the URLs into target. Which code segment should you use?

  1. $(imageurls).each(function(i,url){
    $("<img/>", url).append("#target");
    });
  2. $(imageurls).each(function(i,url){
    $("#target") += $("<img/>").attr("src", url);
    });
  3. $.each(imageurls, function(i,url){
    $("<img/>").attr("src", url).appendTo("#target");
    });
  4. $.each(imageurls, function(i,url){
    $("#target").append("<img/>").src = url;
    });
Answer: Answer is c

<script type="text/javascript">
var lastId = 0;
</script>
<div class="File">
Choose a file to upload:
<input id="File0" name="File0" type="file" />
</div>
<input id="AddFile" type="button" value="Add a File" />
<input id="Submit" type="submit" value="Upload" />

You need to provide the following implementation. ?Each time the AddFile button is clicked, a new div element is created. ?The new div element is appended after the other file upload div elements and before the AddFile span. ?Each new element has a unique identifier. Which code segment should you use?

  1. $("#AddFile").click(function () {
    var id = "File" + ++lastId;
    var item = $(".File:first").clone(true); $("input:file", item).attr({ id: id, name: id }); item.insertBefore("#AddFile"); });
  2. $("#AddFile").click(function () {
    var id = "File" + ++lastId;
    $(".File:first").clone(true) .attr({ id: id, name: id }) .insertBefore("#AddFile"); });
  3. $("#AddFile").click(function () {
    var id = "File" + ++lastId;
    });
  4. $("#AddFile").click(function () {
    var id = "File" + ++lastId;
    var item = $(".File:first").clone(true)
    $("input:file", item).attr({ id: id, name: id });
    item.insertAfter("input[type=file]");
    });
Answer: Answer is a

  1. $('.Results input:checked').onrowselected = function (e, sender) { ...
    };
  2. $('.Results input:checked').bind('onrowselected', function (e, sender) {
    ...
    });
    
  3. $('.Results').bind('onrowselected', function (e, sender) { ...
    }).click(function (e) {
    if ($(e.target).is('input:checked')) {
    $('.Results').trigger('onrowselected', [$(e.target)]);
    }
    });
  4. $('.Results').onrowselected($.proxy($(this)
    .find('input:checked'), function (e, sender) {
    ...
    }));
Answer: Answer is c

01<script>
02function changeColor(c) {
03message.style.color=c;
04}
05</script>
07<p id="message">Welcome!</p>
08<ul id="color">
09<li>Black</li>
10<li>Red</li>
11</ul>

You need to ensure that when the user clicks an item in the list, the text color of the "Welcome!" message will change. Which declaration should you use?

  1. <ul id="color">
    <li onclick="changeColor(this.innerText);">Black</li>
    <li onclick="changeColor(this.innerText);">Red</li>
    </ul>
  2. <ul id="color">
    <li onclick="changeColor(this.style.color);">Black</li>
    <li onclick="changeColor(this.style.color);">Red</li>
    </ul>
    
  3. <ul id="color">
    <li><a onfocus="changeColor(this.innerText);">Red</a></li> <li><a onfocus="changeColor(this.innerText);">Black</a></li>
    </ul> </ul>
  4. <ul id="color">
    <li onclick="changeColor(this.style.color);">Black</li>
    <li onclick="changeColor(this.style.color);">Red</li>
    </ul>
  5. <ul id="color">
    <li><a
    onfocus="changeColor(this.innerText);">Red</a></li>
    <li><a
    onfocus="changeColor(this.innerText);">Black</a></li>
    </ul>

Answer: Answer is a

<div id="errorInfo"> </div>

You need to implement a single error handler that will add error information from all page $.ajax calls to the div named errorInfo. What should you do?

  1. Add the following options to each $.ajax function call:

     global: true, 
    error: function (XMLHttpRequest, textStatus, errorThrown){ $("#errorInfo").text("<li>Error information is: " + textStatus + "</li>");
  2. Add the following code to the $(document).ready function on the page:

     $("#errorInfo").ajaxError(function(event, request, settings){ $(this).append("<li>Error requesting page " +settings.url + "</li>"); });
  3. Add the following option to each $.ajax function call:

    error: function (XMLHttpRequest, textStatus, errorThrown){ $("#errorInfo").text("<li>Error information is: " + textStatus + "</li>"); }
  4. Add the following code to the $(document).ready function on the page:

    $.ajaxError(function(event, request, settings){
    $(this).append("<li>Error requesting page " + settings.url + "</li>");});
    Add the following option to each $.ajax function call:
    global: true
Answer: Answer is b

<span id="span1">Text</span>

You need replace the contents of the span with HTML that you download from a URL specified by a global variable named localURL. Which code segment should you use?

  1. $.ajax({
    type: "GET",
    url: localURL,
    dataType: "jsonp",
    success: function(htmlText) {
    $("#span1").text(htmlText);
    }
    });
  2. $.ajax(localURL, {},
    function(htmlText) {
    $("#span1").html(htmlText);
    },
    "html");
  3. $.ajax({
    type: "GET",
    url: localURL,
    dataType: "html",
    success: function(htmlText) {
    $("#span1").innerHTML = htmlText;
    }
    });
  4. $.ajax({
    type: "GET",
    url: localURL,
    success: function(htmlText) {
    $("#span1").html(htmlText);
    }
    });
Answer: Answer is d

<xml version="1.0" >
<users>
<user id="first">
<name>Name of first user</name>
<email>first@contoso.com</email>
</user>
<user id="second">
<name>Name of second user</name>
<email>first@contoso.com</email>
</user>
</users>

You need to populate a drop-down menu with the IDs and names of the users from the Web service, in the order provided by the service. Which code segment should you use?

  1. $.ajax({
    type: "GET",
    url: serviceURL,
    success: function(xml) {
    $.each($(xml), function(i, item) {
    $("<option>").attr("value", id)
    .text(tx).appendTo("#dropdown");
    });
    }
    });
  2. $.ajax({
    type: "GET",
    url: serviceURL,
    success: function(xml) {
    $(xml).find("user").each(function() {
    var id = $(this).id;
    var tx = $(this).name.text
    $("<option>").attr("value", id)
    .text(tx).appendTo("#dropdown");
    });
    }
    });
  3. $.ajax({
    type: "GET",
    url: serviceURL,
    success: function(xml) {
    $(xml).find("user").each(function() {
    var id = $(this).attr("id");
    var tx = $(this).find("name").text();
    $("<option>").attr("value", id)
    .text(tx).appendTo("#dropdown");
    });
    }
    });
  4. $.ajax({
    type: "GET",
    url: serviceURL,
    success: function(xml) {
    xml.find("user").each(function(node) {
    var id = $(node).attr("id");
    var tx = $(node).find("name").text();
    $("<option>").attr("value", id)
    .text(tx).appendTo("#dropdown");
    });
    }
    });
Answer: Answer is c

[ServiceContract]
public interface ICatalog
{
[OperationContract]
[WebGet(UriTemplate="/Catalog/Items/{id}", ResponseFormat=WebMessageFormat.
Json)]
string RetrieveItemDescription(int id);
}

The service is hosted at Catalogsvc.

You need to call the service using jQuery to retrieve the description of an item as indicated by a variable named itemld. Which code segment should you use?

  1. $get(String.format("/Catalogsvc/Catalog/Items/id{0}", itemId) null, function (data) { }, javascript");
  2. $get(String.format("/Catalogsvc/Catalog/Items/{0}", itemId), null, function (data) { }, "json");
  3. $get(String.format("/Catalogsvc/Catalog/Items/{0}", itemld), null, function (data) { }, "xml");
  4. $get(String.format("/Catalogsvc/Catalog/Items/id{0}", itemld), null, function (data) { }, "json");
Answer: Answer is b

Advertisement

BCS Preparation now even more easy. ReadBD is the place where you can find all kind of resources to be successful in BCS,Bank,Islami Bank exam and interview.

Looking for job. Try JobLoader- First ever job search engine in Bangladesh. All open bd jobs now a single mouse click away.

;