PrepAway - Latest Free Exam Questions & Answers

Category: 70-516 (v.2)

Exam 70-516: TS: Accessing Data with Microsoft .NET Framework 4 (update October 26th, 2015)

You need to define the connection life cycle of the DataAccessLayer class

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application contains the following code segment. (Line numbers are included for reference only.)
01 class DataAccessLayer
02 {
03 private static string connString;
04
05 …
06 public static DataTable GetDataTable(string command){
07
08 …
09 }
10 }
You need to define the connection life cycle of the DataAccessLayer class. You also need to ensure
that the application uses the minimum number of connections to the database. What should you
do?
Insert the following code segment at line 04.
private static SqlConnection conn = new SqlConnection(connString);
public static void Open(){
conn.Open();
}
public static void Close(){
conn.Close();
}

Which header and request type should you use in the application?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows
Communication Foundation (WCF) Data Services service. You discover that when an application
submits a PUT or DELETE request to the Data Services service, it receives an error. You need to
ensure that the application can access the service. Which header and request type should you use in
the application?

You need to ensure that you can update and delete entities on the production server

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows
Communication Foundation (WCF) Data Services service. The service connects to a Microsoft SQL
Server 2008 database. The service is hosted by an Internet Information Services (IIS) 6.0 Web server.
The application works correctly in the development environment. However, when you connect to
the service on the production server, attempting to update or delete an entity results in an error.
You need to ensure that you can update and delete entities on the production server. What should
you do?

What should you add to the connection string?

You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL
Server 2008 database by using SQL Server 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 the Open method is called. What should you add to the connection string?

Which method should you call on the ObjectContext?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application connects to a Microsoft SQL Server database. The application uses the ADO.NET Entity
Framework to manage order data. The application makes a Web service call to obtain orders from an
order-tracking system. You need to ensure that the orders are added to the local data store. Which
method should you call on the ObjectContext?

Which code segment should you insert at line 02?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application connects to a Microsoft SQL Server database. The application uses the ADO.NET Entity
Framework to model entities. The database includes objects based on the exhibit. (Click the Exhibit
button.)

The application includes the following code segment. (Line numbers are included for reference only.)
01 using (AdventureWorksEntities advWorksContext = new AdventureWorksEntities()){
02
03 }
You need to retrieve a list of all Products from todays sales orders for a specified customer. You also
need to ensure that the application uses the minimum amount of memory when retrieving the list.
Which code segment should you insert at line 02?

Which connection string should you add to the Web.config file?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Microsoft
ASP.NET application. You want to connect the application to a Microsoft SQL Server Express 2008
database named MyDatabase. The primary database file is named MyDatabase.mdf and it is stored
in the App_Data folder. You need to define the connection string. Which connection string should
you add to the Web.config file?

Which code segment should you insert at line 04?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You
use the ADO.NET Entity Framework to model entities. You write the following code segment. (Line
numbers are included for reference only.)
01 AdventureWorks Entities context = new AdventureWorksEntities (
02 ” http://localhost:1234/AdventureWorks.svc “
03 );
04
05 var q = from c in context.Customers
06 where c.City == “London”
07 orderby c.CompanyName
08 select c;
You need to ensure that the application meets the following requirements:
• Compares the current values of unmodified properties with values returned from the data source.
• Marks the property as modified when the properties are not the same
Which code segment should you insert at line 04?

Which line of code should you use?

You use Microsoft .NET Framework 4 to develop an application. The configuration file contains the
following code segment.
<configuration>
<connectionStrings>
<add name=”AdventureWorksLT”
connectionString=”Data Source=SQL01;
Initial Catalog=AdventureWorksLT;
Integrated Security=True;”
providerName=”System.Data.SqlClient”/>
</connectionStrings>
</configuration>
You need to retrieve the connection string named AdventureWorksLT from the configuration file.
Which line of code should you use?

Which code segment should you use?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application
that connects to a Microsoft SQL Server 2008 database. The application includes a SqlConnection
named conn and a SqlCommand named cmd. You need to create a transaction so that database
changes will be reverted in the event that an exception is thrown. Which code segment should you
use?


Page 1 of 3112345...102030...Last »