Microsoft
70-516 · Question #110
70-516 Question #110: Real Exam Question with Answer & Explanation
Sign in or unlock 70-516 to reveal the answer and full explanation for question #110. The question stem and answer options stay visible for context.
Question
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.)
Options
- AInsert the following code at line 09.
- BInsert the following code at line 09.
- CInsert the following code at line 11.
- DInsert the following code at line 11.
Unlock 70-516 to see the answer
You've previewed enough free 70-516 questions. Unlock 70-516 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.