Latest 70-515 Real Exam Download 171-180

Ensurepass

QUESTION 171

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: C


QUESTION 172

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 173

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 174

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="John.Doe@contoso.com"/>

<Address AlternativeEmail="John.Doe@contoso.com"/>

<Address MSNInstanceMessenger="John.Doe@contoso.com"/>

</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), from addr 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), from addr 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), from addr in person.Addresses

select new XElement("Address", newXAttribute(addr.AddressType, addr.AddressValue)))));

Answer: D


QUESTION 175

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 176

You are creating an ASP.NET web page that contains several FileUpload controls.

The page will be posted to the server after one or more image files are selected for upload.

You need to ensure that all uploaded files are saved to the server within one call to a single event handler.

What should you do?

A. Read the HttpRequest.Files property and call the HttpPostedFile.SaveAs method for each file.

B. Read the HttpRequest.inputStream property and call the System.Io.File.WriteLines method or each file.

C. Read the HttpRequest.inputStream property and call the HttpResponse.WriteLine method for each file.

D. Read the HttpRequest.Files property and call the System.Io.File.WriteLines method for each file.

Answer: A


QUESTION 177

You are developing an ASP.NET web page that includes a textbox control that has ID txtDate. You need to ensure that the user enters a valid date in the text box.

Which markup should you use?

A. <asp:CompareValidator ID="valDate" runat="server" Type="Date" ControlToCompare="txtDate" Operator="Equal"/>

B. <asp:CompareValidator ID="valDate" runat="server" Type="Date" ControlToCompare="txtDate" Operator="DataTypeCheck"/>

C. <asp:CompareValidator ID="valDate" runat="server" Type="Date" ControlToValidate="txtDate" Operator="DataTypeCheck"/>

D. <asp:CompareValidator ID="valDate" runat="server" Type="Date" ControlToValidate="txtDate" Operator="Equal"/>

Answer: C


QUESTION 178

You are developing an ASP.NET MVC 2 Web Application that displays daily blog posts.

Visitors access a blog post page by using a Web address to pass in the year, month, and day -for example, contoso.com/2010/07/20.

The application must register the appropriate route to use the Display action of the blog controller. Only page visits with a four digit year, two-digit month and two-digit dat can be passed to the action. You need to ensure that the route is registered correctly,

Which code segment should you add?

A. routes.MapRoute("DailyBlogPosts", "{year}/{month}/{day}", new {

controller="Blog", action="Display", year=@"d{4}",

month=@"d{2}",

day=@"d{2}"

});

B. routes.MapRoute("DailyBlogPosts", "{year}/{month}/{day}", new {

controller="Blog",

action="Display",

}

new {

year=@"d{4}",

month=@"d{2}",

day=@"d{2}"

});

C. routes.MapRoute("DailyBlogPosts", "{year}/{month}/{day}", new {

controller="Blog", action="Display",

}

new { year="yyyy", month="mm", day="dd"

});

D. routes.MapRoute("DailyBlogPosts", "{year}/{month}/{day}", new {

controller="Blog", action="Display", year="yyyy", month="mm", day="dd"

});

Answer: B


QUESTION 179

You are developing an ASP.NET MVC 2 application. You create a login user control named login.ascx. You need to display Login.ascx in a view.

What should you do?

A. Use an HTML server-side include.

B. Use the HTML.Display method

C. Use the HTML.Partial method.

D. Use the @Import directive

Answer: C


QUESTION 180

You are developing an ASP.NET web application.

The application includes a class library named Contoso.dll that will be used by other ASP.Net applications on the same server.

You need to ensure that only one copy of the class library exists on the server.

What should you do?

A. Add the following code segment to the top of each web page.

<%@ Register TagPrefix="cc" NameSpace="contoso" Assembly="contoso" %>

B. Install the class library into the Global Assembly Cache on the server.

C. Deploy the class library on the App_Code folder

D. Add the following assembly attribute to the Contoso class library┬┤s AssemblyInfo.cs file. [assembly: AssemblyConfiguration("Shared")]

Answer: B


Download Latest 70-515 Real Free Tests , help you to pass exam 100%.