Latest 70-515 Real Exam Download 21-30

Ensurepass

QUESTION 21

You use the ASP.NET Web Site template to create a Web site that will be deployed to multiple locations. Each location will specify its SMTP configuration settings in a separate file named smtp.config in the root folder of the Web site.

You need to ensure that the configuration settings that are specified in the smtp.config file will be applied to the Web site.

Which configuration should you use in web.config?

A. <configuration>

<system.net>

<mailSettings>

<smtp configSource="smtp.config" allowOverride="true">

<network host="127.0.0.1" port="25"/>

</smtp>

</mailSettings>

</system.net>

</configuration>

B. <configuration>

<system.net>

<mailSettings>

<smtp configSource="smtp.config" />

</mailSettings>

</system.net>

</configuration>

C. <configuration xmlns:xdt="http://schemas.microsoft.com/XML- Document- Transform">

<location path="smtp.config" xdt:Transform="Replace" xdt:Locator="Match (path)">

<system.net />

</location>

</configuration>

D. <configuration>

<location path="smtp.config">

<system.net>

<mailSettings>

<smtp Devilery Method="Network" >

<Network Host = "127.0.0.1" Port="25"/>

</smtp>

</mailSettings>

</system.net>

</location>

</configuration>

Answer: B


QUESTION 22

You deploy an ASP.NET application to an IIS server.

You need to log health-monitoring events with severity level of error to the Windows application event log. What should you do?

A. Run the aspnet_regiis.exe command.

B. Set the Treat warnings as errors option to All in the project properties and recompile.

C. Add the following rule to the <healthMonitoring/> section of the web.config file.

<rules>

<add name="Failures" eventName="Failure Audits"

provider="EventLogProvider" />

</rules>

D. Add the following rule to the <healthMonitoring/> section of the web.config file.

<rules>

<add name="Errors" eventName="All Errors" provider="EventLogProvider" />

</rules>

Answer: D


QUESTION 23

You are implementing an ASP.NET page.

The page includes a method named GetCustomerOrderDataSet that returns a DataSet. The DataSet includes a DataTable named CustomerDetailsTable and a DataTable named OrderDetailsTable.

You need to display the data in OrderDetailsTable in a DetailsView control named dtlView. Which code segment should you use?

A. dtlView.DataSource = GetCustomerOrderDataSet(); dtlView.DataMember = "OrderDetailsTable"; dtlView.DataBind();

B. dtlView.DataSource = GetCustomerOrderDataSet(); dtlView.DataSourceID = "OrderDetailsTable"; dtlView.DataBind();

C. dtlView.DataSource = GetCustomerOrderDataSet(); dtlView.DataKeyNames = new string [] { "OrderDetailsTable"}; dtlView.DataBind();

D. DataSet dataSet = GetCustomerOrderDataSet();

dtlView.DataSource = new DataTable("dataSet", "OrderDetailsTable");

dtlView.DataBind();

Answer: A


QUESTION 24

You are implementing an ASP.NET page.

You add and configure the following ObjectDataSource.

<asp:ObjectDataSource SelectMethod="GetProductByProductId" ID="odc" runat="server" TypeName="ProductDAL">

<SelectParameters>

<asp:Parameter Name="productId" Type="Int32" />

</SelectParameters>

</asp:ObjectDataSource>

The page will be called with a query string field named pid.

You need to configure the ObjectDataSource control to pass the value of the pid field to GetProductsByProductId method.

What should you do?

A. Replace the asp:QueryStringParameter with the following declaration.

<asp:QueryStringParameter DefaultValue="pid" Name="productId" Type="Int32" /

>

B. Replace the asp:QueryStringParameter with the following declaration.

<asp:QueryStringParameter QueryStringField="pid" Name="productId" Type="Int32" />

C. Add the following event handler to the Selecting event of the ObjectDataSource control.

protected void odc_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)

{

InputParameters["pid"] = Request.QueryString["productId"];

}

D. Add the following code segment to the page’s code-behind.

protected void Page_Load(object sender, EventArgs e)

{

odc.SelectParameters.Add("productId", Request.QueryString["pid"]);

}

Answer: B


QUESTION 25

You are implementing an ASP.NET Web application that retrieves data from a Microsoft SQL Server database.

You add a page that includes the following data source control.

<asp:SqlDataSource id="sqlds" runat="server" ConnectionString="<%$ ConnectionStrings:MyDB %>" SelectCommand="SELECT * FROM Companies" />

The page is accessed frequently, but the data in the database rarely changes.

You need to cache the retrieved data so that the database is not queried each time the Web page is accessed.

What should you do?

A. Add the following attributes to the SqlDataSource control.

DataSourceMode="DataSet" EnableCaching="True" CacheDuration="120"

B. Add the following attributes to the SqlDataSource control.

DataSourceMode="DataReader" EnableCaching="True" CacheDuration="120"

C. Add the following configuration to the <system.web/> section of the web.config file.

<caching>

<sqlCacheDependency enabled="true">

<databases>

<add name="MyDBCache" connectionStringName="MyDB" pollTime="120"

/>

</databases>

</sqlCacheDependency>

</caching>

D. Add the following configuration to the <system.web/> section of the web.config file.

<caching>

<sqlCacheDependency enabled="true" pollTime="120">

<databases>

<add name="MyDBCache" connectionStringName="MyDB" />

</databases>

</sqlCacheDependency>

</caching>

Answer: A


QUESTION 26

You are implementing an ASP.NET page. Client-side script requires data.

Your application includes a class named Person with a Name property of type string. The code-behind file of the page includes the following code segment.

public string JsonValue;

List<Person> people = GetPeopleList();

JavaScriptSerializer json = new JavaScriptSerializer();

You need to use the JavaScriptSerializer class to serialize only the Name property of each item in the people list.

Which code segment should you use?

A. JsonValue = json.Serialize(people.Select(p => p.Name));

B. var names = from person in people

select person;

JsonValue = "{" + json.Serialize(names) + "}";

C. JsonValue = json.Serialize(people.SelectMany( p =>Name.AsEnumerable()));

D. var names = from person in people

select person;

JsonValue = json.Serialize(names);

Answer: A


QUESTION 27

You are implementing an ASP.NET application that uses LINQ to Entities to access and update the database.

The application includes the following method to update a detached entity of type Person.

private NorthwindContext _entities;

public void UpdatePerson(Person personToEdit)

{

}

You need to implement the UpdatePerson method to update the database row that corresponds to the personToEdit object.

Which code segment should you use?

A. _entities.People.Attach(personToEdit);

_entities.ObjectStateManager.ChangeObjectState(personToEdit, EntityState.

Modified);

_entities.SaveChanges();

B. _entities.ObjectStateManager.ChangeObjectState(personToEdit, EntityState.

Added);

_entities.SaveChanges();

C. _entities.People.ApplyCurrentValues(personToEdit);

_entities.SaveChanges();

D. _entities.People.Attach(new Person() { Id = personToEdit.Id });

_entities.ObjectStateManager.ChangeObjectState(personToEdit, EntityState.

Modified);

_entities.SaveChanges();

Answer: A


QUESTION 28

You are implementing an ASP.NET application. You add the following code segment.

public List<Person> GetNonSecretUsers()

{

string[] secretUsers = {"@secretUser", "@admin", "@root"};

List<Person> allpeople = GetAllPeople();

}

You need to add code to return a list of all Person objects except those with a UserId that is contained in the secretUsers list.

The resulting list must not contain duplicates. Which code segment should you use?

A. var secretPeople = (from p in allPeople from u in secretUsers

where p.UserId == u select p).Distinct();

return allPeople.Except(secretPeople);

B. return from p in allPeople from u in secretUsers where p.UserId != u select p;

C. return (from p in allPeople from u in secretUsers where p.UserId != u select p).Distinct();

D. List<Person> people = new List<Person>( from p in allPeople

from u in secretUsers where p.UserId != u select p);

return people.Distinct();

Answer: A


QUESTION 29

You are implementing an ASP.NET Web site.

The Web site contains a Web service named CustomerService.

The code-behind file for the CustomerService class contains the following code segment.

public class ProductService : System.Web.Services.WebService

{

public List<Product> GetProducts(int categoryID)

{

return GetProductsFromDatabase(categoryID);

}

}

You need to ensure that the GetProducts method can be called by using AJAX.

Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. Apply the WebService attribute to the ProductService class.

B. Apply the ScriptService attribute to the ProductService class.

C. Apply the WebMethod attribute to the GetProducts method.

D. Apply the ScriptMethod attribute to the GetProducts method.

Answer: BC


QUESTION 30

You are implementing a WCF service library.

You add a new code file that contains the following code segment.

namespace ContosoWCF

{

[ServiceContract]

public interface IRateService

{

[OperationContract]

decimal GetCurrentRate();

}

public partial class RateService : IRateService

{

public decimal GetCurrentRate()

{

decimal currentRate = GetRateFromDatabase();

return currentRate;

}

}

}

You build the service library and deploy its assembly to an IIS application.

You need to ensure that the GetCurrentRate method can be called from JavaScript. What should you do?

A. Add a file named Service.svc to the IIS application.

Add the following code segment to the file.

<%@ ServiceHost Service="ContosoWCF.IRateService" Factory="System. ServiceModel.Activation.WebScriptServiceHostFactory" %>

B. Add a file named Service.svc to the IIS application.

Add the following code segment to the file.

<%@ ServiceHost Service="ContosoWCF.RateService" Factory="System. ServiceModel.Activation.WebScriptServiceHostFactory" %>

C. Apply the script service attribute to rate serice class Rebulid the WCF servicelibrary, and redploy the assembly to the IIS application.

D. Apply the Web get attibute to the Get Currant rate interface Method.Rebuild the WCF servicelibrary, and redploy the assembly to the IIS application.

Answer: B

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