web analytics

New Microsoft 70-515 Exam Questions and Best 70-515 Dumps Download (51-60)

QUESTION 51
You are implementing an ASP.NET page that hosts a user control named CachedControl. You need to ensure that the content of the user control is cached for 10 seconds and that it is regenerated when fetched after the 10 seconds elapse. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A.    Modify the hosting page’s caching directive as follows.
<%@ OutputCache Duration=”10″ VaryByParam=”None” %>
B.    Add the following meta tag to the Head section of the hosting page.
<meta http-equiv=”refresh” content=”10″>
C.    Add the following caching directive to the hosted control.
<%@ OutputCache Duration=”10″ VaryByParam=”None” %>
D.    Add the following caching directive to the hosted control.
<%@ OutputCache Duration=”10″ VaryByControl=”None” %>

Answer: AC

QUESTION 52
You have created an ASP.NET server control named ShoppingCart for use by other developers.
Some developers report that the ShoppingCart control does not function properly with ViewState disabled.
You want to ensure that all instances of the ShoppingCart control work even if ViewState is disabled.
What should you do?

A.    Require developers to set EnableViewStateMac to true.
B.    Store state in ControlState instead of ViewState.
C.    Serialize the state into an Application state entry called “MyControl”
D.    Require developers to change the session state mode to SQL Server.

Answer: B

QUESTION 53
You are troubleshooting an ASP.NET Web application.
System administrators have recently expanded your web farm from one to two servers.
Users are periodically reporting an error message about invalid view state.
You need to fix the problem.
What should you do?

A.    Set viewStateEncryptionMode to Auto in web.config on both servers.
B.    Set the machineKey in machine.config to the same value on both servers.
C.    Change the session state mode to SQL Server on both servers and ensure both servers use the same connection string.
D.    Override the SavePageStateToPersistenceMedium and LoadPageStateFromPersistenceMedium methods in the page base class to serialize the view state to a local web server file.

Answer: B

QUESTION 54
You are developing a Web page.
The user types a credit card number into an input control named cc and clicks a button named submit.
The submit button sends the credit card number to the server.
A JavaScript library includes a CheckCreditCard function that returns a value of true if the credit card appears to be valid, based on its checksum.
You need to ensure that the form cannot be used to submit invalid credit card numbers to the server.
What should you do?

A.    Configure the input control to run on the server. On the submit button, add a server-side OnClick handler that calls CheckCreditCard and rejects the form submission if the input is invalid.
B.    On the input control, add an onChange handler that calls CheckCreditCard and cancels the form submission when the input is invalid.
C.    Configure the input control and the submit button to run on the server. Add a submit_OnClick handler that calls CheckCreditCard and rejects the form submission if the input is invalid.
D.    On the form, add an onSubmit handler that calls CheckCreditCard and cancels the form submission if the input is invalid.

Answer: D

QUESTION 55
You are developing an ASP.Net MVC 2 view and controller. The controller includes an action method that retrieves rows from a Product table in Microsoft SQL Server database. You need to cache the data that the action method returns. What should you do?

A.    Add the following <outputCacheSettings> section to the web.config file.
<system.web>
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name=”ProductView” duration=”60″
varyByParam=”*”/>
</outputCacheProfiles>
</outputCacheSettings>
</caching>
</system.web>
B.    Add the following line of code to the controller.
Cache.insert(“key”, “ProductView”, null, DateTime.Now.AddMinutes(60),TimeSpan.Zero);
C.    Add the following attribute to the action method
[OutputCache(Duration=60)];
D.    Add the following directive to the top of the view
<%@ OutPutCache Duration=”60″ VaryByParam=”*” %>

Answer: A

QUESTION 56
You are developing an ASP.NET Web application.The application includes a Icomparer<string> implementation named CaseInsensitiveComparer that compares strings without case sensitivity.
You add the following method.(Line numbers are included for reference only.)
01 public IEnumerable<string>SortWords(string[] words)
02 {
03
04 }
You need to sort the array by word length and then by alphabetic order, ignoring case.Which code segment should you add at line 03?

A.    return words.Orderby(a  => a, new CaseInsensitiveComparer()).ThenBy(a =>a.Length);
B.    return words.Orderby(a =>a.Length).Orderby(a => a,new CaseInSensitiveComparer());
C.    return words.Orderby(a =>a.Length).ThenBy(a=> a, new CaseInSensitiveComparer());
D.    return words.Orderby(a =>a.Length.toString(), new CaseInSensitiveComparer());

Answer: C

QUESTION 57
You are implementing an ASP.Net web page that includes a Treeview control. You need to ensure that the TreeView control nodes are populated only when they are first expanded. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A.    Set the PopulateNodesFromClient property of the TreeView control to true.
B.    Add an event handler to the TreeNodeDataBound event that includes code to populate the node.
C.    Set the PopulateOnDemand property of the TreeNode control to true.
D.    Add an event handler to the TreeNodePopulate event than includes code to populate the node.

Answer: CD

QUESTION 58
You are implementing an ASP.NET web application.The application defines the following classes.
public class Person
  {
public String Name{get; set;}
publicIList<Address> Addresses{get;set;}
  }
public class Address
  {
public String AddressType{get; set;}
public string AddressValue{get;set;}
  }
The applicaction must generate XML from personList, wich is a collection of Person instances.The following XML is an example of the schema than the generated XML must use.
<Persons>
<Person Name=”John Doe”>
<Address Email=”[email protected]”/>
<Address AlternativeEmail=”[email protected]”/>
<Address MSNInstanceMessenger=”[email protected]”/>
</Person>
…..
</Persons>
You need to generate the XML. Wich code segment should you use?

A.    var XML= new XElement(“Persons”,
from person in personList
      Select (new XElement(“Persons”,
newXElement(“Name”, person.Name),
fromaddr in person.Addresses
select new XElement(“Address”,
newXElement(addr.AddressType,
addr.AddressValue)))));
B.    var XML= new XAttribute(“Persons”,
from person in personList
     Select (new XElement(“Persons”,
newXAttribute(“Name”, person.Name),
fromaddr in person.Addresses
select new XAttribute(“Address”,
newXAttribute(addr.AddressType,
addr.AddressValue)))));
C.    var XML= new XElement(“Persons”,
from person in personList
      Select (new XElement(“Persons”,
newXAttribute(“Name”, person.Name))));
D.    var XML= new XElement(“Persons”,
from person in personList
     Select (new XElement(“Person”,
newXAttribute(“Name”, person.Name),
fromaddr in person.Addresses
select new XElement(“Address”,
newXAttribute(addr.AddressType,
addr.AddressValue)))));

Answer: D

QUESTION 59
You are developing an ASP.NET web page.The page must display data from XML file named Inventory.xml. Inventory.xml contains data in the following format.
<?xml version=”1.0″ standalone=”yes”?>
<inventory>
<vehicle Make=”BMW” Model=”M3″ Year=”2005″ Price=”30000″
instock=”Yes”>
<Ratings>….</Ratings>
</Vechicle>
….
</Inventory>
You need to display Vehicle elements that have the inStock attribute set to YES. Wich two controls should you add to the page? (Each control presents part of the solution.Choose two.)

A.    <asp:GridView ID=”GridView1″ runat=”server”
AutoGenerateColumns=”True”
DataSource=”inventoryXMLDataSource”>
….
</asp:GridView>
B.    <asp:GridView ID=”GridView1″ runat=”server”
AutoGenerateColumns=”True”
DataSourceID=”inventoryXMLDataSource”>
….
</asp:GridView>
C.    <asp:XMLDataSource ID=”InventoryXMLDataSource”
runat=”server” DataFile=”Inventory.xml”
XPath=”/Inventory/Car[@InStock=’Yes’]”>
</asp:XMLDataSource>
D.    <asp:XMLDataSource ID=”InventoryXMLDataSource”
runat=”server” DataFile=”Inventory.xml”
XPath=”/Inventory/Car/InStock=’Yes'”>
<Data>Inventory.xml</Data>
</asp:XMLDataSource>

Answer: AC

QUESTION 60
You are implementing an ASP.NET page that includes a text box.
You need to validate values that are typed by users to ensure that only numeric values are submitted.
Which control markup should you use?

A.    <asp:TextBox ID=”txt1″ runat=”server” CausesValidation=”true” ValidationGroup=
“Numeric” />
B.    <asp:TextBox ID=”txt1″ runat=”server” EnableClientScript=”true” ValidationGroup=
“Numeric” />
C.    <asp:TextBox ID=”txt1″ runat=”server” />
<asp:RegularExpressionValidator ID=”val1″ runat=”server” ControlToValidate=”txt1″
ValidationExpression=”[0-9]*” ErrorMessage=”Invalid input value” />
D.    <asp:TextBox ID=”txt1″ runat=”server” />
<asp:RegularExpressionValidator ID=”val1″ EnableClientScript=”true”
ControlToValidate=”txt1″ ValidationExpression=”[0-9]*” ErrorMessage=”Invalid
input value” />

Answer: C

New Microsoft 70-515 Exam Questions and Best 70-515 Dumps Download