Microsoft TS: Accessing Data with Microsoft .NET Framework 4 - 70-516 Exam Practice Test

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application that uses
the Entity Framework.
The application has the entity model shown in the following diagram.

The application must create a projection of the unique set of names and year-to-date sales for territories
where at least one sales person had sales last year of more than $100,000.
The projection must consist of properties named Sales and Name. You need to write a query that will
generate the required projection.
Which code segment should you use?
Correct Answer: C
There are Entities - States Class, Cities class. Deleting of state id raises exception. Which of the following?
Correct Answer: D
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application.
You use the ADO.NET Entity Framework Designer to model entities. You retrieve an entity from an object
context.
A different application updates the database. You need to update the entity instance to reflect updated
values in the database.
Which line of code should you use?
Correct Answer: B
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You use the ADO.NET Entity Framework to model your entities.
You use Plain Old CLR Objects (POCO) entities along with snapshot-based change tracking. The code
accesses the POCO entities directly.
You need to ensure that the state manager synchronizes when changes are made to the object graph.
Which ObjectContext method should you call?
Correct Answer: C
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server 2008 database.
You create classes by using LINQ to SQL based on the records shown in the exhibit:

You need to create a LINQ query to retrieve a list of objects that contains the OrderID and CustomerID
properties.
You need to retrieve the total price amount of each Order record. What are two possible ways to achieve
this goal?
(Each correct answer presents a complete solution. Choose two.)
Correct Answer: C,D
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application.
You use the ADO.NET Entity Framework Designer to model entities. You retrieve an entity from an object context.
A different application updates the database. You need to update the entity instance to reflect updated
values in the database.
Which line of code should you use?
Correct Answer: C
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You deploy a Windows Communication Foundation (WCF) Data Service to a production server.
The application is hosted by Internet Information Services (IIS).
After deployment, applications that connect to the service receive the following error message:
"The server encountered an error processing the request. See server logs for more details."
You need to ensure that the actual exception data is provided to client computers. What should you do?
Correct Answer: A
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
You have been assigned the task of writing code that executes an Entity SQL query that returns entity type
objects that contain a property of a complex type.
(Line numbers are included for reference only.)
01 using (EntityCommand cmd = conn.CreateCommand())
02 {
03 cmd.CommandText = esqlQuery;
04 EntityParameter param = new EntityParameter();
05 param.ParameterName = "id";
06 param.Value = 3;
07 cmd.Parameters.Add(param);
08 using (EntityDataReader rdr = cmd.ExecuteReader
(CommandBehavior.SequentialAccess))
09 {
10 while (rdr.Read())
11 {
12 ...
13 Console.WriteLine("Email and Phone Info:");
14 for (int i = 0; i < nestedRecord.FieldCount; i++)
15 {
16 Console.WriteLine(" " + nestedRecord.GetName(i) + ": " +
nestedRecord.GetValue(i));
17 }
18 }
19 }
20 }
Which code segment should you insert at line 12?
Correct Answer: B
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
You use Microsoft .NET Framework 4.0 to develop an application. You use the XmlReader class to load
XML from a location that you do not control.
You need to ensure that loading the XML will not load external resources that are referenced in the XML.
Which code segment should you use?
Correct Answer: A
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application.
You use the ADO.NET Entity Framework Designer to model entities.
You need to create a Plain Old CLR Object (POCO) class that can be used with the
ObjectContext.CreateObject method to create a proxy.
What should you do?
Correct Answer: D
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
You use Microsoft .NET framework 4.0 to develop an application that connects to a Microsoft SQL Server
2008 database named AdventureWorksLT.
The database resides on an instance named INSTA on a server named SQL01.
You need to configure the application to connect to the database. Which connection string should you add
to the .config file?
Correct Answer: B
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
0
0
0
0