PrepAway - Latest Free Exam Questions & Answers

Author: seenagape

Which line of code should you use?

You develop a Microsoft .NET application that uses Entity Framework to store entities in a Microsft SQL Server 2008 database.
While the application is disconnected from the database, entities that are modified, are serialized to a local file.

The next time the application connects to the database, it retrieves the identity from the database by using an object context
named context and stores the entity in a variable named remoteCustomer.
The application then serializes the Customer entity from the local file and stores the entity in a variable named localCustomer.
The remoteCustomer and the localCustomer variables have the same entity key.

You need to ensure that the offline changes to the Customer entity is persisted in the database when the ObjectContext.SaveChanges() method is called.
Which line of code should you use?

Which code segment should you use?

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

You add the following code fragment:

using(var context = new AdventureWorksLTEntities())
{
Customer cust = context.Customers.First();
cust.CompanyName = “Contoso”;
int count = 0;
}

The changes to the cust entity must be saved. If an exception is thrown, the application will attempt to save up to 3 times.
If not, an exception is thrown. Which code segment should you use?

What should you do?

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 as shown in the following diagram.

You create an ObjectContext instance named objectContext1 and use it to create a SalesPerson instance named person1.
You create an ObjectContext instance named objectContext2 and use it to create a SalesTerritory instance named territory1.
You need to create and persist a relationship between person1 and terrotory1. What should you do?

What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application.
You use the Entity Framework Designer to create an Entity Data Model using model-first development.

The database has the following requirements:
* each table must have a datetime column named time_modified
* each table requires a trigger that updates the value of the time_modified column when a row is inserted or updated

You need to ensure that the database script that is created by using the Generate Database From Model option meets the requirements.
What should you do?

What should you recommend?

You are designing an ASP.NET Web application that has common navigation and layout elements on all pages.
You have the following requirements:
– Maintain common elements in a single location.
– Ensure that common elements can be modified and nested without redeploying the Web application.
– Allow developers to customize the object model from individual pages.
You need to recommend a solution that can be specified at the application, folder, or page level.
What should you recommend?

What should you add to the connection string?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that connects
to a MS SQL server 2008 database by User Authentication. The application contains the following connection string:

SERVER=DBSERVER-01; DATABASE=pubs; uid=sa; pwd=secret;

You need to ensure that the password value in the connection string property of a SqlConnection object does not exist after is called.
What should you add to the connection string?

Which two approaches could you recommend?

You are designing an ASP NET Web application that displays daily sales information.
The sales information is stored in a large Microsoft SQL Seiver database.
The database information is updated each night during the day.
People use the Web application to display a set of standard sales reports based on the latest database information.
The SQL queries that are required to retrieve and display the database information can take from 20 to 30 seconds to execute.
You need to design the application to ensure that pages usually load in no more than 5 seconds.
Which two approaches could you recommend?
(Each correct answer presents a complete solution Choose two.)