[Free] New Updated (October) Microsoft 70-516 Real Exam 171-180

Ensurepass

 

QUESTION 171

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You use a TableAdapter object to load a DataTable object. The DataTable object is used as the data source for a GridView control to display a table of customer information on a Web page.

 

You need to ensure that the application meets the following requirements:

 

clip_image002Load only new customer records each time the page refreshes.

clip_image002[1]Preserve existing customer records.

 

What should you do?

 

A.

Set the ClearBeforeFill property of the TableAdapter to false. Use the Fill method of the TableAdapter to load additional customers.

B.

Set the ClearBeforeFill property of the TableAdapter to false. Use the GetData method of the TableAdapter to create a new DataTable.

C.

Set the ClearBeforeFill property of the TableAdapter to true. Use the Fill method of the TableAdapter to load additional customers.

D.

Set the ClearBeforeFill property of the TableAdapter to true. Use the GetData method of the TableAdapter to create a new DataTable.

Correct Answer: A

Explanation:

TableAdapter.Fill Populates the TableAdapter’s associated data table with the results of the TableAdapter’s SELECT command.

TableAdapter.Update Sends changes back to the database. For more information, see How to:

Update Data Using a TableAdapter.

TableAdapter.GetData Returns a new DataTable filled with data. TableAdapter.Insert Creates a new row in the data table. For more information, see How to: Add Rows to a DataTable.

TableAdapter.ClearBeforeFill Determines whether a data table is emptied before you call one of the Fill methods.

Table Adapter Overview

http://msdn.microsoft.com/en-us/library/bz9tthwx(v=vs.80).aspx

 

 

QUESTION 172

You use microsoft visual studio 2010 and microsoft .net framework 4 to create an application that connects to a database by using the entity framework. you create an entity data model (edm) by using the generate from database wizard for the following tables.

 

clip_image003

 

You need to ensure that the edm contains an entity type named employee that contains all of the data from both tables.

 

What should you do?

 

A.

Delete the employeeaccess entity, create a new property named canaccessbuildings on the employee entity, and add a mapping for the new property.

B.

Create an inheritance relationship between the employee and employeeaccess entities, and use canaccessbuildings as an inheritance condition.

C.

Modify the .edmx file to include the following line of code. <novigationpropecty name”type” FromRole” “EmployeeAccess” ToRole=”Employee” />

D.

Create a one-to-one association named AcanAccessBuildingsAssociation between the EmployeeAccess entity and the employee entity.

 

Correct Answer: A

 

 

QUESTION 173

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application that uses the Entity Framework.

 

You need to execute custom logic when an entity is attached to the ObjectContext.

 

What should you do?

 

A.

Create a partial method named OnStateChanged in the partial class for the entity.

B.

Create a partial method named OnAttached in the partial class for the entity.

C.

Create an event handler to handle the ObjectStateManagerChanged event.

D.

Create an event handler to handle the ObjectMaterialized event.

 

Correct Answer: C

Explanation:

ObjectStateManagerChanged Occurs when entities are added to or removed from the state manager.

ObjectMaterialized Occurs when a new entity object is created from data in the data source as part of a query or load operation.

ObjectStateManagerChanged Event

http://msdn.microsoft.com/en-us/library/system.data.objects.objectstatemanager.objectstatemanagerchanged.aspx

ObjectMaterialized Event

http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.objectmaterialized.aspx

 

 

QUESTION 174

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application. Vou use the ADO.NET Entity Framework Designer to model entities.

 

You need to ensure that the entities are self-tracking.

 

What should you do in the ADO.NET Entity Framework Designer?

 

A.

Add an ADO.NET EntityObjecl Generator to the model.

B.

Change the Transform Related Text Templates On Save option to False.

C.

Change the Code Generation Strategy option from Default to None.

D.

Add an ADO.NET Self-Tracking Entity Generator to the model.

 

Correct Answer: D

Explanation:

The ADO.NET Self-Tracking Entity Generator text template generates the object-layer code that consists of a custom typed ObjectContext and entity classes that contain self- tracking state logic so that the entities themselves keep track of their state instead of ObjectContext doing so.

Probably the best usage of self-tracking entities is when working with N-tier applications.

CHAPTER 6 ADO.NET Entity Framework

Lesson 1: What Is the ADO.NET Entity Framework?

The Self-Tracking Entity Generator (page 405)

ADO.NET Self-Tracking Entity Generator Template

http://msdn.microsoft.com/en-us/library/ff477604.aspx

 

 

 

 

 

 

 

 

 

 

 

 

 

 

QUESTION 175

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application. You use the Entity Framework Designer to create the following Entity Data Model.

 

clip_image004

 

The application contains a class as shown in the following code segment.

 

Public Class MyBaseClass Inherits EntityObject

 

End Class

 

You need to ensure that all generated entities inherit from MyBaseClass.

 

What should you do?

 

A.

Use the ADO.NET EntityObject Generator template to configure all entities to inherit from MyBaseClass.

B.

Modify the generated code file so that all entities inherit from MyBaseClass.

C.

Create a new ObjectQuery that uses MyBaseClass as the type parameter.

D.

Change MyBaseClass to inherit from ObjectContext.

 

Correct Answer: A

Explanation:

You can use the Text Template Transformation Toolkit (T4) to generate

your entity classes, and Visual Studio.

NET provides the T4 EntityObject Generator template by which you can control the entity object generation.

Visual Studio .NET also provides the T4 SelfTracking Entity Generator template by which you can create and control the Add an EntityObject Generator to your project and add the new modification to the text template.self-tracking entity classes. Add an EntityObject Generator to your project and add the new modification to the text template.

CHAPTER 6 ADO.NET Entity Framework

Lesson 1: What Is the ADO.NET Entity Framework?

The EntityObject Generator (page 403-404)

http://blogs.msdn.com/b/efdesign/archive/2009/01/22/customizing-entity-classes-with-t4.aspx

 

 

 

 

QUESTION 176

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. You use Entity SQL to retrieve data from the database.

 

You need to enable query plan caching.

 

Which object should you use?

 

A.

EntityCommand

B.

EntityConnection

C.

EntityTransaction

D.

EntityDataReader

 

Correct Answer: A

Explanation:

Whenever an attempt to execute a query is made, the query pipeline looks up its query plan cache to see whether the exact query is already compiled and available. If so, it reuses the cached plan rather than building a new one. If a match is not found in the query plan cache, the query is compiled and cached. A query is identified by its Entity SQL text and parameter collection (names and types). All text comparisons are case-sensitive.

Query plan caching is configurable through the EntityCommand. To enable or disable query plan caching through System.Data.EntityClient.EntityCommand. EnablePlanCaching, set this property to true or false. Disabling plan caching for individual dynamic queries that are unlikely to be used more then once improves performance.

You can enable query plan caching through EnablePlanCaching.

Query Plan Caching

http://msdn.microsoft.com/en-us/library/bb738562.aspx

 

 

QUESTION 177

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You create stored procedures by using the f

ollowing signatures:

 

CREATE procedure [dbo].[Product_Insert] (@name varchar (50) / 6pri.ce float)

 

CREATE procedure [dbo].[Product_Updatej (@id int, Bname varchar(50), @price float)

 

CREATE procedure [dbo].[Product_Delete] (@ id int)

 

CREATE procedure [dbo] .[Order_Insert] (@productld int, @quantity int)

 

CREATE procedure [dbo] .[Order_Update] (@id int, Gquantity int,@originalTimestamp tlmestamp)

 

CREATE procedure [dbo].[Order_Delete](@id int)

 

You create a Microsoft ADO.NET Entity Data Model (EDM) by using the Product and Order entities as shown in the exhibit. (Click the Exhibit button.)

 

clip_image005

 

You need to map the Product and Order entities to the stored procedures.

 

To which two procedures should you add the Qproductld parameter? (Each correct answer presents part of the solution. Choose two.)

 

A.

Order_Update

B.

Order_Delete

C.

Product_Delete

D.

Product_Update

 

Correct Answer: AB

Explanation:

@productId parameter resides in the order table…

 

 

QUESTION 178

DRAG DROP

You develop a method named doOnelnsert that has the following signature:

 

Private Sub doOnelnsert(name As String, id As String)

 

You discover that when you execute doOnelnsert, you sometimes receive the following message: “SQLException was unhandled Violation of PRIMARY KEY constraint.”

 

You need to develop a method named functionl that will call doOnelnsert and will log the exception by using a class named SQLLoger. The function must only log exceptions thrown by Microsoft SQL Server.

 

What should you do? (Develop the solution by selecting and ordering the required code snippets. You may not need all of the code snippets.)

 

clip_image007

 

Correct Answer:

clip_image009

 

 

QUESTION 179

You use Microsoft .NET Framework 4 to develop an application. You write the following code to update data in a Microsoft SQL Server 2008 database. (Line numbers are included for reference only,)

 

01 Private Sub ExecuteUpdate(ByVal cmd As SqlCommand, ByVal connString As String, ByVal updateStrat As String)

 

02

 

03 End Sub

 

You need to ensure that the update statement executes and that the application avoids connection leaks.

 

Which code segment should you insert at line 02?

 

A.

Dim conn As SqlConnection = New SqlConnection(connString)

conn.Open()

cmd.Connection = conn

cmd.CommondText = updateStmt

cmd. ExecuteNonQuery ()

cmd.Connect ion.Close()

B.

Using conn As New SqlConnection(connString)

cmd.Connection = conn

cmd.CommandText = updateStmt

cmd.ExecuteNonQuery()

cmd.Connection.Close()

End Using

C.

Using conn As New SqlConnection(connString)

conn.Open() cmd.Connection = conn

cmd.CommandText = updateStmt

cmd.ExecuteNonQuery()

End Using

D.

Dim conn As SqlConnection = Nera SqlConnection(connStcing) conn.Open()

cmd.Connection = conn

cmd.CommandText = updateStmt

cmd.ExecuteNonQuery()

 

Correct Answer: C

Explanation:

http://www.w3enterprises.com/articles/using.aspx

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.aspx

 

 

QUESTION 180

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Communication Foundation (WCF) Data Services service. You deploy the data service to the following URL: http://contoso.com/Northwind.svc.

 

You need to update the City property of the Customer record that has its ID value as 123.

 

You also need to preserve the current values of the remaining properties.

 

Which HTTP request should you use?

 

A.

PUT /Northwind.svc/Customers(123)

Host: contoso.com

Content-Type: application/json

{

City: ‘Seattle’

}

B.

PUT /Northwind.svc/Customers(123)

Host: contoso.com

Accept: application/json

{

City: ‘Seattle’

}

C.

MERGE /Northwind.svc/Customers(123)

Host: contoso.com

Content-Type: application/json

{

City: ‘Seattle’

}

D.

MERGE /Northwind.svc/Customers(123)

Host: contoso.com

Accept: application/json

{

City: ‘Seattle’

}

 

Correct Answer: C

Explanation:

HTTP Actions

OData supports the following HTTP actions to perform create, read, update, and delete operations on the entity data that the addressed resource represents:

HTTP GET – This is the default action when a resource is accessed from a browser. No payload is supplied in the request message, and a response method with a payload that contains the requested data is returned.

HTTP POST – Inserts new entity data into the supplied resource. Data to be inserted is supplied in the payload of the request message.

The payload of the response message contains the data for the newly created entity. This includes any autogenerated key values.

The header also contains the URI that addresses the new entity resource.

HTTP DELETE – Deletes the entity data that the specified resource represents. A payload is not present in the request or response messages.

HTTP PUT – Replaces existing entity data at the requested resource with new data that is supplied in the payload of the request message.

HTTP MERGE – Because of inefficiencies in executing a delete followed by an insert in the data source just to change entity data, OData introduces a new HTTP MERGE action. The payload of the request message contains the properties that must be changed on the addressed entity resource. Because HTTP MERGE is not defined in the HTTP specification, it may require additional processing to route a HTTP MERGE request through non-OData aware servers.

Accessing and Changing Data Using REST Semantics

http://msdn.microsoft.com/en-us/library/dd728282.aspx

HTTP header fields

http://en.wikipedia.org/wiki/List_of_HTTP_header_fields

Accept Content-Types that are acceptable

Content-Type The mime type of the body of the request (used with POST and PUT requests)

A Guide to Designing and Building RESTful WebServices with WCF 3.5

http://msdn.microsoft.com/en-us/library/dd203052.aspx

Free VCE & PDF File for Microsoft 70-516 Real Exam

Instant Access to Free VCE Files: MCSE|MCSA|MCITP…
Instant Access to Free PDF Files: MCSE|MCSA|MCITP…