Web Developer Framework 4.0 Sample Questions – 7

Question: You are implementing an ASP.NET AJAX page that contains two div elements. You need to ensure that the content of each div element can be refreshed individually, without requiring a page refresh. What should you do?

  1. Add a form, an update panel, and a script manager to the page. Add a content template to the update panel. Move the div elements into the content template.
  2. Add two forms to the page. Add a script manager and an update panel to each form. Add a content template to each update panel, and move each div element into a content template.
  3. Add a form and two update panels to the page. Add a script manager to the form. Add a content template to each update panel, and move a div element into each content template.
  4. Add a form and two update panels to the page. Add two script managers to the form, one for each update panel. Add a content template to each update panel, and move each div element into a content template.

Correct Answer: 3


Question: You create an ASP.NET page. The page uses the jQuery $.ajax function to make calls back to the server in several places. You add the following div element to the page.
<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>”); }); E. Add the following option to each $.ajax function call: global: true

Correct Answer: 2


Question: You create a Web page that contains the span shown in the following line of code.
<span id=”span1″>Text</span>
You need to 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);}});

Correct Answer: 4


Question: A Web service returns a list of system users in the following format. <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>second @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”);});}});

Correct Answer: 3


Question: You are creating an ASP.NET Web site. The site contains pages that are available to anonymous users. The site also contains a page named Premium.aspx that provides premium content to only members of a group named Subscribers. You need to modify the web.config file to ensure that Premium.aspx can be accessed by only members of the Subscribers group. Which configuration should you use?

  1. <location path=”Premium.aspx”><system.web><authorization><allow users=”Subscribers”/><deny users=”*”/></authorization></system.web> </location>
  2. <location path=”Premium.aspx”><system.web><authorization><allow roles=”Subscribers”/><deny users=”*”/></authorization></system.web> </location>
  3. <location path=”Premium.aspx”><system.web><authorization><allow roles=”Subscribers”/><deny users=””/></authorization></system.web> </location>
  4. <location path=”Premium.aspx”><system.web><authorization><deny users=”*”/><allow roles=”Subscribers”/></authorization></system.web> </location>

Correct Answer: 2

Tagged . Bookmark the permalink.

Leave a Reply