Web Developer Framework 4.0 Sample Questions – 6

Question: A Web page includes the HTML shown in the following code segment.
<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 jQuery statement 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"});

Correct Answer: 4


Question: You create a Web page that contains the following div.
<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 ; });

Correct Answer: 3


Question3: You are building an ASP.NET control. The control displays data by using a table element with a class attribute value of Results. The control should expose a client-side event named onrowselected that fires when a check box in a table row is selected. You need to implement this client-side event. What should you do?

  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) {& }));

Correct Answer: 3


Question4: You create a Web page that contains the following code. (Line numbers are included for reference only.)
01 <script>
02 function changeColor(c) {
03 document.getElementById(“message”).style.color=c;
04}
05 </script>
06
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>
  4. <ul id=”color”><li><a onfocus=”changeColor(this.style.color);”>Red</a></li><li><a onfocus=”changeColor(this.style.color);”>Black</a></li> </ul>

Correct Answer: 1


Question5: You are implementing an ASP.NET AJAX page. You add two UpdatePanel controls named pnlA and pnlB. pnlA contains an UpdatePanel control named pnlAInner in its content template. You have the following requirements. Update panels pnlA and pnlB must refresh their content only when controls that they contain cause a postback. Update panel pnlAInner must refresh its content when controls in either pnlA or pnlB or pnlAInner cause a postback. You need to configure the panels to meet the requirements. What should you do?

  1. Set the UpdateMode of pnlA and pnlB to Conditional. Set the UpdateMode of pnlAInner to Always.
  2. Set the UpdateMode of pnlA and pnlB to Conditional. Set the UpdateMode of pnlAInner to Conditional, and add AsyncPostBackTrigger elements to its Triggers element for every control in pnlA.
  3. Set the UpdateMode of pnlA and pnlB to Always. Set the UpdateMode of pnlAInner to Conditional.
  4. Set the UpdateMode of pnlA and pnlB to Always. Set the UpdateMode of pnlAInner to Always, and add AsyncPostBackTrigger elements to its Triggers element for every control in pnlB.

Correct Answer: 1

Tagged . Bookmark the permalink.

Leave a Reply