PrepAway - Latest Free Exam Questions & Answers

Author: seenagape

Which code segment should you insert at line 04?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server database.
The application uses the following object query to load a product from the database.
(Line numbers are included for reference only.)

01 using (AdventureWorksEntities advWorksContext = new AdventureWorksEntities())
02 {
03 ObjectQuery <Product> productQuery = advWorksContext.Product.Where(“it.ProductID = 900”);
04 …
05 }

You need to log the command that the query executes against the data source. Which code segment should you insert at line 04?

What should you do?

You are designing an n-tier Windows application by using Microsoft .NET Framework 4, Microsoft Visual Studio 2010, and Microsoft SQL Server 2008. The application will replace an existing client/server application. The existing application was created by using Microsoft Visual Basic 6.0 and consists of a series of COM components that access a SQL Server database.
You plan to move the existing COM components into a Windows Communication Foundation (WCF) tier. You need to ensure that the COM components can be replaced without impacting the existing user interface (UI) tier.
You also need to ensure that the COM components can be replaced separately.
What should you do?

Which two action should you perform?

You develop a Windows Communication Foundation (WCF) service that employees use to access bonus information.
You define the following service contract. (Line numbers are included for reference only.)

01 [ServiceContract(SessionMode = SessionMode.Required)]
02 public interface IFinancialService
03 {
04 [OperationContract]
05 string Login(int employeeID, string passwordHash);
06
07 [OperationContract]
08 double GetBonus(int month);
09
10 [OperationContract(IsTerminating = true)]
11 void Logout();
12 }

Client application can invoke methods without logging in. You need to ensure that the client applications invoke Login before
invoking any other method. You also need to ensure that client applications cannot consume the service after invoking Logout.
Which two action should you perform? (Each correct answer presents part of the solution. Choose two.)

Which code segment should you insert at line 11?

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 entities. The application connects to a Microsoft SQL Server database named AdventureWorks.
The application includes the following code segment. (Line numbers are included for reference only.)

01 using (AdventureWorksEntities context = new AdventureWorksEntities())
02 {
03 ObjectQuery <SalesOrderHeader> orders = context.SalesOrderHeader.
Where(“it.CreditCardApprovalCode IS NULL”).Top(“100”);
04 foreach (SalesOrderHeader order in orders){
05 order.Status = 4;
06 }
07 try {
08 context.SaveChanges();
09 }
10 catch (OptimisticConcurrencyException){
11 …
12 }
13 }

You need to resolve any concurrency conflict that can occur. You also need to ensure that local changes are persisted to the database.
Which code segment should you insert at line 11?

What should you do next?

You are creating a Windows application by using Microsoft NET Framework 4 and Microsoft Visual Studio 2010
The business logic layer of the application is implemented by using Windows Communication Foundation (WCF).
You create a WCF service that contains a single operation to upload large binary data files You configure the binding of the WCF service to enable data streaming You need to ensure that the WCF service operation receives binary data files along with a string parameter that contains the description of each file
You create a service operation that receives a single parameter.
What should you do next?

What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application uses the ADO.NET Entity Framework to model entities.
The application includes a Customer entity along with a CustomerKey property of the Guid type as shown in the following exhibit:

You discover that when the application adds a new instance of a Customer, calling the SaveChanges method
results in the following error message: “Server generated keys are only supported for identity columns.”
You need to ensure that the application can add new Customer entities. What should you do?

What should you do?

You are upgrading a stand-alone Windows Presentation Foundation (WPF) application and an XAML browser application (XBAP) to Microsoft NET Framework 4 You plan to add NET 4 types and members to both applications. Both applications consume a common utility assembly that modifies files on a local file system.
The utility assembly requires full trust.
You need to ensure that both applications can use the common utility assembly without any security-related exceptions.
What should you do?