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)

Which two actions should you perform?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an ASP.NET Web
application that uses the Entity Framework. The build configuration is set to Release. The application
must be published by using Microsoft Visual Studio 2010, with the following requirements:
• The database schema must be created on the destination database server.
• The Entity Framework connection string must be updated so that it refers to the destination
database server.
You need to configure the application to meet the requirements.
Which two actions should you perform?(Each correct answer presents part of the solution. Choose
two.)

Which code segment should you use?

You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL
Server 2008 database. You add the following stored procedure to the database.
CREATE PROCEDURE dtao.InsertTag
BName nvarchar (15)
AS
INSERT INTO Tags (Name) VALUES(@Name)
RETURN @@ROWCOUNT
You need to invoke the stored procedure by using an open SqlConnection named conn. Which code
segment should you use?

Which code segment should you use?

You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL
Server 2008 database. The application includes a table adapter named taStore, which has the
following DataTable.

There is a row in the database that has a ProductID of 680. You need to change the Name column in
the row to “New Product Name”. Which code segment should you use?

Which two actions should you perform?

You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL
Server 2008 database. The database contains a ClassStudent table that contains the StudentID for
students who are enrolled in the classes. You add the following stored procedure to the database.
CREATE PROCEDURE dbo.GetNumEnrolled
@ClassID INT,
@NumEnrolled INT OUTPUT
AS
BEGIN

SET NOCOUNT ON
SELECT GNumEnrolled = COUNT(StudentID)
FROM ClassStudent
WHERE (ClassID = @ClassID)
END
You write the following code. (Line numbers are included for reference only.)
01 Private Function GetNumberEnrolled(
ByVal classID As String) As Integer 02
03 Using conn As New SqlConnection(GetConnectionString())
04
05 Dim cmd As SqlCommand = New SqlCommand(
“GetNumEnro1led”, conn)
06 cmd.CommandType = CommandType.StoredProcedure
07 Dim parClass As SqlParameter – cmd.Parameters.Add(
“8ClassID”, SqlDbType.Int, 4, classID)
08 Dim parNum As SqlParameter = cmd.Parameters.Add(
“@NumEnrolled”, SqlDbType.Int)
09
10 conn.Open()
11
12 End Using
11 End Function
You need to ensure that the GetlMumberEnrolled method returns the number of students who are
enrolled for a specific class. Which two actions should you perform? (Each correct answer presents
part of the solution. Choose two.)

Which code segment should you place in the entity’s partial class?

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.

You write a method named ValidatePostalCode to validate the postal code for the application. You
need to ensure that the ValidatePostalCode method is called before the PostalCode property set
method is completed and before the underlying value has changed. Which code segment should you
place in the entity’s partial class?

Which line of code should you use?

You develop a Microsoft .NET Framework 4 application that uses the Entity Framework to store
entities in a Microsoft SQL Server 2008 database. While the application is disconnected from the
database, entities that are added or modified are serialized to a local file. The next time the
application connects to the database, it retrieves a Customer entity from the database by using an
object context named context and stores the entity in a variable named remoteCustomer. The
application then deserializes 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 are persisted in the
database when the ObjectContext.SaveChanges() method is called. Which line of code should you
use?

Which cryptography provider should you use?

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 stores encrypted credit
card numbers in the database. You need to ensure that credit card numbers can be extracted from
the database. Which cryptography provider should you use?

Which method should you call before persisting changes?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application uses the ADO.NET Entity Framework to model persistence-ignorant entities. The
application operates in a disconnected mode. You need to ensure that changes made to local
entities while the application is in the disconnected mode are correctly persisted. Which method
should you call before persisting changes?

You need to ensure that the application meets the following requirements: • There is a SqlConnection named c

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application connects to two different Microsoft SQL Server 2008 database servers named Serverl
and Server2. A string named sqllcontains a connection string to Serverl. A string named sql2contains
a connection string to Server2.
01 Using scope As New 02
03 Using cnl As New SqlConnection(sqll)
04 Try 05
06 Catch ex As Exception
07 End Try
08 End Using
09 scope.Complete()
10 End Using
You need to ensure that the application meets the following requirements:
• There is a SqlConnection named cn2 that uses sql2.
• The commands that use cnl are initially enlisted as a lightweight transaction.
• The cn2 SqlConnection is enlisted in the same TransactionScope only if commands executed
by cnl do not throw an exception.
What should you do?


Page 29 of 31« First...1020...2728293031