PrepAway - Latest Free Exam Questions & Answers

Category: 70-516

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

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 @NumEnrolled = COUNT(StudentID)
FROM ClassStudent
WHERE (ClassID = @ClassID)
END

You write the following code. (Line numbers are included for reference only.)

01 private int GetNumberEnrolled(string classID)
02 {
03 using (SqlConnection conn = new SqlConnection(GetConnectionString())
04 {
05 SqlCommand cmd = new SqlCommand(“GetNumEnrolled”, conn);
06 cmd.CommandType = CommandType.StoredProcedure;
07 SqlParameter parClass = cmd.Parameters.Add(“@ClassID”, SqlDbType.Int, 4, “classID”);
08 SqlParameter parNum = cmd.Parameters.Add(“@NumEnrolled”, SqlDbType.Int);
09 …
10 conn.Open()
11 …
12 }
13 }

You need to ensure that the GetNumberEnrolled 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 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 [dbo].[InsertTag]
@Name nvarchar (15)
AS
INSERT INTO [dbo].[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 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?

What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application. A file named books.xml contains the following XML.

<bib>
<book title=”Programming in Unix” year=”1992″>
<author>Author1</author>
<author>Author2</author>
<author> Author 3 </author>
</book>
</bib>

The application must generate an XML result that contains an XML element named BookTitle for each book. The text content of the element must contain the title of the book.
You need to create a query that generates the new XML result. What should you do?

Which two actions should you perform?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 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.)

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.
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?

Which code segment should you use?

You use Microsoft .NET Framework 4.0 and the Entity Framework to develop an application.
You create an Entity Data Model that has an entity named Customer. You set the optimistic concurrency option for Customer.
You load and modify an instance of Customer named loadedCustomer, which is attached to an ObjectContext named context.

You need to ensure that if a concurrency conflict occurs during a save, the application will load up-to-date values from
the database while preserving local changes. Which code segment should you use?


Page 1 of 1912345...10...Last »