PrepAway - Latest Free Exam Questions & Answers

Author: seenagape

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

What should you do?

You are designing a Windows application by using Microsoft .NET Framework 4 and Microsoft Visual Studio 2010. You plan to implement control caching to improve the loading time of a control. It is not required to refresh the content of the control after the application loads. The application will be compiled by using the .NET 4 client profile. You need to ensure that the following requirements are met:
* The control is reusable in multiple forms.
* Data in the control is cached when the application is loaded.
What should you do?

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?

A Web service returns a list of system users in the following format.

<xml version=”1.0″ >
<users>
<user id=”first”>
<name>Name of first user</name>
<email>first@contoso.com</email>
</user>
<user id=”second”>
<name>Name of second user</name>
<email>first@contoso.com</email>
</user>
</users>

You need to populate a drop-down menu with the IDs and names of the users from the Web service, in the order provided by the service.
Which code segment should you use?

What should you do?

You are developing an application by using Microsoft .NET Framework 4 and Microsoft Visual Studio 2010. The application contains a grid that displays customer data stored in a database table. Users report that the grid takes a long time to display. You plan to implement data caching to improve loading time for the grid. You need to ensure that the cached data expires when the customer data is updated. What should you do?

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?