MICROSOFT NEWS: 70-516 Exam Questions has been Updated Today! Get Latest 70-516 VCE and 70-516PDF Instantly! Welcome to Download the Newest Braindump2go 70-516 VE&70-516 PDF Dumps: http://www.braindump2go.com/70-516.html (286 Q&As)
70-516 Exam Dumps Free Shared By Braindump2go For Instant Download Now! Download Latest 70-516 Exam Questions and pass 70-516 one time easily! Do you want to be a winner?
Exam Code: 70-516
Exam Name: TS: Accessing Data with Microsoft .NET Framework 4
Certification Provider: Microsoft
Corresponding Certifications: MCPD, MCPD: Web Developer 4, MCPD: Windows Developer 4, MCTS, MCTS: Microsoft .NET Framework 4, Data Access
70-516 Dumps,70-516 Dumps PDF,70-516 Exam PDF,70-516 Book,70-516 Study Guide,70-516 eBook,70-516 eBook PDF,70-516 Exam Questions,70-516 Training Kit,70-516 PDF,70-516 Microsoft Exam,70-516 VCE,70-516 Braindump,70-516 Braindumps PDF,70-516 Braindumps Free,70-516 Practice Test,70-516 Practice Exam,70-516 Preparation,70-516 Preparation Materials,70-516 Practice Questions
C# Scenario
Background
You are updating an existing Microsoft .NET Framework 4 application that includes a data layer built with ADO.NET Entity Framework 4.
The application communicates with a Microsoft SQL Server 2008 instance named INST01 on a server named SQL01.
The application stores data in a database named Contoso in the INST01 instance.
You need to update the existing technology and develop new functionality by using Microsoft Visual Studio 2010.
Application and Data Structure
The application tracks bicycle parts as they pass through a factory. Parts are represented by the abstract Part entity and its associated partial classes. Each part has a name stored in the Name field and a unique identifier stored in the Id field.
Parts are either components (represented by the Component class) such as chains, wheels, and frames, or finished products (represented by the Product class) such as completed bicycles. The Component class and the Product class derive from the Part class and may contain additional class-specific properties.
Parts may have a color (represented by the Color class), but not all parts have a color. Parts may be composed of other parts, and those parts may in turn be composed of other parts; any part represents a tree of the parts that are used to build it. The lowest level of the tree consists of components that do not contain other components.
A product is a part that has been completed and is ready to leave the factory. A product typically consists of many components (forming a tree of child parts) but can also be constructed by combining other products and/or components to form a bundled product, such as a bicycle and a helmet that are sold together.
Components and products are stored in a database table named Parts by using a table-per-hierarchy (TPH) mapping. Components have a null ProductType field and a non-null PartType field. Products have a non-null ProductType field and a null PartType field.
The following diagram illustrates the complete Entity data model diagram (EDMX diagram).
The following graphic illustrates details of the Part-Color Association.
The following code segments show relevant portions of the files referenced by the case study items. (Line numbers in the samples below are included for reference only and include a two-character prefix that denotes the specific file to which they belong.)
Extension Method.cs
Model.edmx
Model/Color.cs
Model/component.cs
Model ContosoEntities.cs
Model IName.cs
Model/Product.cs
SP_FindObsolete
QUESTION 21
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application.
You create a stored procedure to insert a new record in the Categories table according to following code segment.
CREATE PROCEDURE dbo.InsertCategory
@CategoryName nvarchar(15),
@Identity int OUT
AS
INSERT INTO Categories (CategoryName) VALUES(@CategoryName)
SET @Identity = SCOPE_IDENTITY()
RETURN @@ROWCOUNT
You write the following code segment. (Line numbers are included for reference only).
1 Private Shared Sub ReturnIdentity(connectionString As String)
2 Using connection As New SqlConnection(connectionString)
3 Dim adapter As New SqlDataAdapter(“SELECT CategoryID, CategoryName FROM dbo.Categories”, connection)
4 adapter.InsertCommand = New SqlCommand(“InsertCategory”, connection)
5 adapter.InsertCommand.CommandType = CommandType.StoredProcedure
6 Dim rowcountParameter As SqlParameter =
adapter.InsertCommand.Parameters.Add(“@RowCount”, SqlDbType.Int)
8 adapter.InsertCommand.Parameters.Add(“@CategoryName”, SqlDbType.NChar, 15, “CategoryName”)
9 Dim identityParameter As SqlParameter =
10 adapter.InsertCommand.Parameters.Add(“@Identity”, SqlDbType.Int, 0, “CategoryID”)
12 Dim categories As New DataTable()
13 adapter.Fill(categories)
14 Dim categoryRow As DataRow = categories.NewRow()
15 categoryRow(“CategoryName”) = “New Beverages”
16 categories.Rows.Add(categoryRow)
17 adapter.Update(categories)
18 Dim rowCount As Int32 =
19 DirectCast(adapter.InsertCommand.Parameters(“@RowCount”).Value, Int32)
20 End Using
21 End Sub
You need to retrieve the identity of the new record.
You also need to retrieve the row count.
What should you do?
A. Insert the following code segment at line 07.
rowcountParameter.Direction = ParameterDirection.ReturnValue
Insert the following code segment at line 11.
identityParameter.Direction = ParameterDirection.ReturnValue
B. Insert the following code segment at line 07.
rowcountParameter.Direction = ParameterDirection.Output
Insert the following code segment at line 11.
identityParameter.Direction = ParameterDirection.Output
C. Insert the following code segment at line 07.
rowcountParameter.Direction = ParameterDirection.ReturnValue
Insert the following code segment at line 11.
identityParameter.Direction = ParameterDirection.Output
D. Insert the following code segment at line 07.
rowcountParameter.Direction = ParameterDirection.Output
Insert the following code segment at line 11.
identityParameter.Direction = ParameterDirection.ReturnValue
Answer: C
Explanation:
Input-The parameter is an input parameter.
InputOutput-The parameter is capable of both input and output.
Output-The parameter is an output parameter.
ReturnValue-The parameter represents a return value from an operation such as a stored procedure, builtin function, or user-defined function.
ParameterDirection Enumeration
(http://msdn.microsoft.com/en-us/library/system.data.parameterdirection(v=vs.71).aspx)
QUESTION 222
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application.
You create a Database Access Layer (DAL) that is database-independent.
The DAL includes the following code segment. (Line numbers are included for reference only.)
01 Shared Sub ExecuteDbCommand(connection As DbConnection)
02 If connection <> Nothing Then
03 Using connection
04 Try
05 connection.Open()
06 Dim command As DbCommand = connection.CreateCommand()
07 command.CommandText = “INSERT INTO Categories (CategoryName) VALUES (‘Low Carb’)”
08 command.ExecuteNonQuery()
10 Catch ex As Exception
11 Trace.WriteLine(“Exception.Message: ” + ex.Message)
12 End Try
13 End Using
14 End If
15 End Sub
You need to log information about any error that occurs during data access.
You also need to log the data provider that accesses the database.
Which code segment should you insert at line 09?
A. Catch ex As OleDbException
Trace.WriteLine(“ExceptionType: ” + ex.Source)
Trace.WriteLine(“Message: ” + ex.Message)
B. Catch ex As OleDbException
Trace.WriteLine(“ExceptionType: ” + ex.InnerException.Source)
Trace.WriteLine(“Message: ” + ex.InnerException.Message)
C. Catch ex As DbException
Trace.WriteLine(“ExceptionType: ” + ex.Source)
Trace.WriteLine(“Message: ” + ex.Message)
D. Catch ex As DbException
Trace.WriteLine(“ExceptionType: ” + ex.InnerException.Source)
Trace.WriteLine(“Message: ” + ex.InnerException.Message)
Answer: C
Explanation:
Exception.InnerException Gets the Exception instance that caused the current exception. Message Gets a message that describes the current exception.
Exception.Source Gets or sets the name of the application or the object that causes the error.
OleDbException catches the exception that is thrown only when the underlying provider returns a warning or error for an OLE DB data source. DbException catches the common exception while accessing data base.
QUESTION 223
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server 2008 database.
The database includes a database table named ProductCatalog as shown in the exhibit. (Click the Exhibit button.)
You add the following code segment to query the first row of the ProductCatalog table. (Line numbers are included for reference only.)
01 Using cnx As var = New SqlConnection(connString)
02 Dim command As var = cnx.CreateCommand()
03 command.CommandType = CommandType.Text
04 command.CommandText = “SELECT TOP 1 * FROM dbo.ProductCatalog”
05 cnx.Open()
06 Dim reader As var = command.ExecuteReader()
07 If reader.Read() Then
08 Dim id As var = reader.GetInt32(0)
10 reader.Close()
11 End If
12 End Using
You need to read the values for the Weight, Price, and Status columns.
Which code segment should you insert at line 09?
A. Dim weight As var = reader.GetDouble(1)
Dim price As var = reader.GetDecimal(2)
Dim status As var = reader.GetBoolean(3)
B. Dim weight As var = reader. GetDecimal (1)
Dim price As var = reader. GetFloat (2)
Dim status As var = reader.GetByte(3)
C. Dim weight As var = reader.GetDouble(1)
Dim price As var = reader.GetFloat(2)
Dim status As var = reader.GetBoolean(3)
D. Dim weight As var = reader.GetFloat(1)
Dim price As var = reader.GetDouble(2)
Dim status As var = reader.GetByte(3)
Answer: A
QUESTION 224
Drag and Drop Question
You have a method named updateCustomers that updates a DataTable.
You need to develop a method that meets the following requirements:
Takes a DataTable as a parameter
Calls updateCustomers by using the DataTable
Returns false if updateCustomers updates one of the rows in the DataTable with a value that contains @) in the FirstName column.
What code should you use? (To answer, drag the appropriate elements to the correct locations. Each element may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Answer:
QUESTION 225
You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL Server 2008 database.
You add the following table to the database.
CREATE TABLE ObjectCache (
Id INT IDENTITY PRIMARY KEY,
SerializedObjectData XML )
You write the following code segment to retrieve records from the ObjectCache table. (Line numbers are included for reference only.)
01Dim s As String = GetConnectStringFromConfigFile(“xmldb”)
02Using conn As New SqlConnection(s)
03Using cmd As New SqlCommand(
04″select * from ObjectCache”, conn))
06conn.Open()
07Dim rdr As SqlDataReader = cmd.ExecuteReader()
08While rdr.Read()
10DeserializeObject(obj)
11End While
12End Using
13End Using
You need to retrieve the data from the SerializedObjectData column and pass it to a method named DeserializeObject.
Which line of code should you insert at line 9?
A. Dim obj As XmlReader = DirectCast(rdr(1), XmlReader)
B. Dim obj As SByte = DirectCast(rdr(1), SByte)
C. Dim obj As String = DirectCast(rdr(1), String)
D. Dim obj As Type = rdr(1).GetType()
Answer: C
QUESTION 226
Drag and Drop Question
You use Microsoft .NET Framework 4 to create a data access layer component.
The component accesses data from a Microsoft SQL Server database named DB1.
The component contains a class named Classl that represents data from a table in DB1 named Tablel.
The following is the definition of Classl:
A database developer creates the following stored procedure to add entries to Table1:
You need to edit the Entity Data Model (EDM) for EDMCIassl to use the uspInsertTablel stored procedure to add data to the database.
What should you do? (Develop the solution by selecting and ordering the required code snippets. You may not need all of the code snippets.)
Answer:
QUESTION 227
Ensure that SSDL can be modified without rebuilding application.
A. res://*/Model.csdl | … (rest of files) copy to output directory
B. .(backslash)Model.csdl | … (rest of files) embeded in output assembly
C. res://*/Model.csdl | … (rest of files) embeded in output assembly
D. .(backslash)Model.csdl | … (rest of files) copy to output directory
Answer: D
QUESTION 228
You use Microsoft .NET Framework 4 to develop an application.
You write the following code to update data in a Microsoft SQL Server 2008 database. (Line numbers are included for reference only,)
01 Private Sub ExecuteUpdate(ByVal cmd As SqlCommand, ByVal connString As String, ByVal updateStrat As String)
03 End Sub
You need to ensure that the update statement executes and that the application avoids connection leaks.
Which code segment should you insert at line 02?
A. Dim conn As SqlConnection =
New SqlConnection(connString) conn.Open()
cmd.Connection = conn
cmd.CommondText = updateStmt
cmd. ExecuteNonQuery ()
cmd.Connect ion.Close()
B. Using conn As New SqlConnection(connString)
cmd.Connection = conn
cmd.CommandText = updateStmt
cmd.ExecuteNonQuery()
cmd.Connection.Close()
End Using
C. Using conn As New SqlConnection(connString)
conn.Open() cmd.Connection = conn
cmd.CommandText = updateStmt
cmd.ExecuteNonQuery()
End Using
D. Dim conn As SqlConnection =
Nera SqlConnection(connStcing) conn.Open()
cmd.Connection = conn
cmd.CommandText = updateStmt
cmd.ExecuteNonQuery()
Answer: C
Explanation:
http://www.w3enterprises.com/articles/using.aspx
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.aspx
QUESTION 229
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Communication Foundation (WCF) Data Services service.
You deploy the data service to the following URL: http://contoso.com/Northwind.svc.
You add the following code segment. (Line numbers are included for reference only.)
01 Dim uri As var = New Uri(“http://contoso.com/Northwind.svc/”)
02 Dim ctx As var = New NorthwindEntities(uri)
03 Dim categories As var = From c In ctx.Categories _
04 Select c
05 For Each c ategory As var In categories
06 PrintCategory(category)
08 For Each product As var In category.Products
10 PrintProduct(product)
11 Next
12 Next
You need to ensure that the Product data for each Category object is lazy-loaded.
What should you do?
A. Add the following code segment at line 07.
ctx.LoadProperty(category, “Products”)
B. Add the following code segment at line 09.
ctx.LoadProperty(product, “*”)
C. Add the following code segment at line 07.
Dim strPrdUri As var =
String.Format(“Categories({0})?$expand=Products”,
category.CategoryID)
Dim productUri As var = New Uri(strPrdUri, UriKind.Relative) ctx.Execute(Of Pr oduct)(productUri)
D. Add the following code segment at line 09.
Dim strPrdUri As var =
String.Format(“Products?$filter=CategoryID eq {0}”,
category.CategoryID)
Dim productUri As var = New Uri(strPrdUri, UriKind.Relative) ctx.Execute(Of Product)(productUri)
Answer: A
Explanation:
LoadProperty(Object, String) Explicitly loads an object related to the supplied object by the specified navigation property and using the default merge option.
UriKind Enumeration
(http://msdn.microsoft.com/en-us/library/system.urikind.aspx)
RelativeOrAbsolute The kind of the Uri is indeterminate.
Absolute The Uri is an absolute Uri.
Relative The Uri is a relative Uri.
QUESTION 230
The application UI displays a list of products in alphabetical order.
To display each product, the UI requires the va of the product Id field and the product Name field.
You need to write a LINO query that returns the product name and unique identifier without retrieving any other database columns.
The query must create an anonymous type with a field named ProductName that contains the product name and a field named Id that contains the unique identifier.
Which query expression should you write?
A. var productNaraes = from produce in context.Pares.OfType<Produet>()
orderby product.Name ascending
select: product;
B. var productNames = from product in context.Parts where product is Product
orderby product.Name ascending
select new {product.Id, ProductName = product.Name};
C. var produceNanes = from preduce in context.Pares orderby product.Name ascending
select new { Id = product.Id, ProductName = product.Name };
D. var productNaraes = from prcduct in context.Parts.OfType<Product>()-ToList()
orderby product.Name ascending
select new { Id-product.Id, ProductNane = product.Name >;
Answer: D
Braindump2go Offers 100% money back guarantee on all products! Our products remain valid for a lifetime! Recently we update our 70-516 Exam Questions since the Microsoft Official Exam Center adds some new questions in 70-516 Exam Dumps. Braindump2go checks all Exam Dumps every day and guarantee all the exam questions are the latest and correct!
FREE DOWNLOAD: NEW UPDATED 70-516 PDF Dumps & 70-516 VCE Dumps from Braindump2go: http://www.braindump2go.com/70-516.html (286 Q&A)