One Year Free Updation for Exam Microsoft 70-516 Dumps - Braindump2go Ensure You 100% Passing Exam 70-516 (231-240)
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) Braindump2go New Released 70-516 Exam Dumps Questions New Updated Today: Latest 286 Questions and Answers Explanation. Guarantee you 100% Success when you attend Microsoft MCM 70-516 Exam! We update 70-516 Exam Dumps Questions every day and you can come to download our latest 70-516 Practice Tests daily! 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 QUESTION 231 You use Microsoft .NET Framework 4 to develop an application that uses LINQ to SQL. You create a data model named AdvWorksDataContext, and you add the Product table to the data model. The Product table contains a decimal column named ListPrice and a string column named Color. You need to update the ListPrice column where the product color is Black or Red. Which code segment should you use? A. Dim colorList() As String = New String() {"Black", "Red"} Dim dc As AdvWorksDataContext = New AdvWorksDataContext Dim prod = From p In dc.Products Where colorList.Contains(p.Color) Select p For Each product In prod product.ListPrice = product.StandardCost * 1.5 Next dc.SubmitChanges() B. Dim dc As AdvWorksDataContext = New AdvWorksDataContext( "& " ) Dim prod = From p In dc.Products Select p Dim list = prod.ToList() For Each product As Product In list If (product.Color = "Black,Red") Then product.ListPrice = product.StandardCost * 1.5 End If Next dc.SubmitChanges() C. Dim dc As AdvWorksDataContext = New AdvWorksDataContext( "& " ) Dim prod = From p In dc.Products Where p.Color = "Black,Red" Select p For Each product In prod product.ListPrice = product.StandardCost * 1.5 Next dc.SubmitChanges() D. Dim dc As AdvWorksDataContext = New AdvWorksDataContext( "& " ) Dim prod = From p In dc.Products Select p Dim list = prod.ToList() For Each product As Product In list If (product.Color = "Black") AndAlso (product.Color = "Red") Then product.ListPrice = product.StandardCost * 1.5 End If Next dc.SubmitChanges() Answer: A QUESTION 232 Drag and Drop Question You plan to generate the following Transact-SQL script from an Entity Data Model (EDM) by using the Entity Framework Designer: You create an entity named Employee. You need to identify the data types for the properties of the Employee entity. What should you identify? (To answer, drag the appropriate data types to the correct statements. Each data type 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 233 The database contains orphaned Color records that are no longer connected to Part records. You need to clean up the orphaned records. You have an existing ContosoEntities context object named context. Which code segment should you use? A. Dim unusedColors = context.Colors.Where(Function(c) Not C.Parts.Any()) context.DeleteObject(unusedColors) context.SaveChanges() B. Dim unusedColors = context.Colors.Where(Function(c) Not C. Parts.Any()).ToList() For Each unused As Color In unusedColors context.DeleteObject(unused) Next context.SaveChanges() C. context.Colors.ToList().RemoveAll(Function(c) Not C.Parts.Any()) context.SaveChanges() D. context.Colors.TakeWhile(Function(c) Not C.Parts.Any()) context.SaveChanges() Answer: B QUESTION 234 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. You create classes by using LINQ to SQL based on the records shown in the exhibit. (Click the Exhibit button.) You need to create a LINQ query to retrieve a list of objects that contains the OrderID and CustomerID properties. You need to retrieve the total price amount of each Order record. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.) A. From details in dataContext.Order_Details _ Group details By details.OrderID Into g _ Join order In dataContext.Orders On g.Key = order.OrderID _ Select New With { _ .OrderID = order.OrderID, _ .CustomerID = order.CustomerID, _ .TotalAmount = g.Sum(Function(od) od.UnitPrice * od.Quantity) _ } B. dataContext.Order_Details.GroupJoin(dataContext.Orders, Function(d) D.OrderID, Function(o) o.OrderID, Function(dts,ord) New With { _ .OrderID = dts.OrderID, _ .CustomerID = dts.Order.CustomerID, _ .TotalAmount = dts.UnitPrice * dts.Quantity _ }) C. From order in dataContext.Orders _ Group order By order.OrderID Into g _ Join details in dataContext.Order_Details On g.Key = details.OrderID _ Select New With { _ .OrderID = details.OrderID, _ .CustomerID = details.Order.CustomerID, _ .TotalAmount = details.UnitPrice * details.Quantity _ } D. dataContext.Orders.GroupJoin(dataContext.Order_Details, Function(o) o.OrderID, Function(d) D.OrderID, Function(ord, dts) New With { _ .OrderID = ord.OrderID, _ .CustomerID = ord.CustomerID, _ .TotalAmount = dts.Sum(Function(od) od.UnitPrice * od.Quantity) _ }) Answer: AD Explanation: Alterantive A. This is an Object Query. It looks at the Order Details EntitySet and creating a group g based on OrderID. - The group g is then joined with Orders EntitySet based on g.Key = OrderID - For each matching records a new dynamic object containing OrderID, CustomerID and TotalAmount is created. - The dynamic records are the results returned in an INumerable Object, for later processing Alterantive D. This is an Object Query. The GroupJoin method is used to join Orders to OrderDetails. Parameters for GroupJoin: 1. An Order_Details EntitySet 2. Order o (from the Orders in the Orders Entity Set, picking up Order_id from both Entity Sets) 3. Order_ID from the first Order_Details record from the OD EnitySet 4. Lamda Expression passing ord and dts (ord=o, dts=d) The body of the Lamda Expression is working out the total and Returning a Dynamic object as in A. QUESTION 235 You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application that uses LINQ to SQL. The application contains the following model. Each region contains a single vendor. Customers order parts from the vendor that is located in their region. You need to ensure that each row in the Customer table references the appropriate row from the Vendor table. Which code segment should you use? A. Dim dc As SalesDataContext = New SalesDataContext( "..." ) Dim query = From c In dc.Customers Join v In dc.Vendors On c.Region Equals v.Region Select New With {.Customer = c, -Vendor = v} For Each u In query B. Vendor.VendorlD = u.Customer.VendorlD Next dc.SubmitChanges() C. Dim dc As SalesDataContext - New SalesDataContext ( "..." ) Dim query = From v In dc.Vendors Join c In dc.Customers On v.Region Equals c.Region Select New With {.Vendor = v, -Customer = c> For Each u In query D. Customer.VendorID = u.Vendor.VendorID Next dc.SubmitChanges() E. Dim dc As SalesDataContext = New SalesDataContext( "..." ) Dim query = From c In dc.Customers Join v In dc.Vendors On c.VendorID Equals v.VendorID Select New With {.Customer = c, -Vendor = v) For Each u In query F. Vendor.Region = u.Customer.Region Next dc.SubmitChanges() G. Dim dc As SalesDataContext - New SalesDataContext( "...") Dim query = From v In dc.Vendors Join c In dc.Customers On v.VendorID Equals c.VendorID Select New With {.Vendor = v, .Customer = c} For Each u In query H. Customer.Region = u.Vendor.Region Next dc.SubmitChanges() Answer: B QUESTION 236 Drag and Drop Question You have a Cable named Tablel that contains two columns named Columnl and Column2. Columnl contains string data. Column2 contains image files. You create the following code: 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 237 You are developing a new feature that displays an auto-complete list to users as they type color names. You have an existing ContosoEntities context object named context. To support the new feature you must develop code that will accept a string object named text containing a users partial input and will query the Colors database table to retrieve all color names that begin with that input. You need to create an Entity SQL (ESQL) query to meet the requirement. The query must not be vulnerable to a SQL injection attack. Which code segment should you use? A. Dim parameter = New ObjectParameter ("text", HttpUtility.HtmlEncode(text) & "%") Dim result = context.CreateQuery(Of String)( "SELECT (c.Name) FROM Colors AS c WHERE C.Name LIKE '@text'", parameter) B. Dim parameter = New ObjectParameter("text", text & "%") Dim result = context.CreateQuery(Of String)( "SELECT (c.Name) FROM Colors AS c WHERE C. Name LIKE @text", parameter) C. Dim parameter = New ObjectParameter("text", text & "%") Dim result = context.CreateQuery(Of String)( "SELECT VALUE (c.Name) FROM Colors AS c WHERE C.Name LIKE @text", parameter) D. Dim parameter = New ObjectParameter("text", text & "%") Dim result = context.CreateQuery(Of String)( "SELECT VALUE (c.Name) FROM Colors AS c WHERE C.Name LIKE '@text'", parameter) Answer: C Explanation: Entity SQL supports two variants of the SELECT clause. The first variant, row select, is identified by the SELECT keyword, and can be used to specify one or more values that should be projected out. Because a row wrapper is implicitly added around the values returned, the result of the query expression is always a multiset of rows. Each query expression in a row select must specify an alias. If no alias is specified,Entity SQL attempts to generate an alias by using the alias generation rules. The other variant of the SELECT clause, value select, is identified by the SELECT VALUE keyword. It allows only one value to be specified, and does not add a row wrapper. A row select is always expressible in terms of VALUE SELECT, as illustrated in the following example. ESQL Select (http://msdn.microsoft.com/en-us/library/bb399554.aspx) 1 QUESTION 238 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). 01 private static void ReturnIdentity(string connectionString) 02 { 03 using (SqlConnection connection = new SqlConnection(connectionString)) 04 { 05 SqlDataAdapter adapter = new SqlDataAdapter( 06 "SELECT CategoryID, CategoryName FROM dbo.Categories",connection); 07 adapter.InsertCommand = new SqlCommand("InsertCategory", connection); 08 adapter.InsertCommand.CommandType = CommandType.StoredProcedure; 09 SqlParameter rowcountParameter = adapter.InsertCommand.Parameters.Add( 10 "@RowCount", SqlDbType.Int); 12 adapter.InsertCommand.Parameters.Add( 13 "@CategoryName", SqlDbType.NChar, 15, "CategoryName"); 14 SqlParameter identityParameter = adapter.InsertCommand.Parameters.Add( 15 "@Identity", SqlDbType.Int, 0, "CategoryID"); 17 DataTable categories = new DataTable(); 18 adapter.Fill(categories); 19 DataRow categoryRow = categories.NewRow(); 20 categoryRow["CategoryName"] = "New Beverages"; 21 categories.Rows.Add(categoryRow); 22 adapter.Update(categories); 23 Int32 rowCount = (Int32)adapter.InsertCommand.Parameters["@RowCount"].Value; 24 } 25 } 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 11. rowcountParameter.Direction = ParameterDirection.ReturnValue; Insert the following code segment at line 16. identityParameter.Direction = ParameterDirection.ReturnValue; B. Insert the following code segment at line 11. rowcountParameter.Direction = ParameterDirection.Output; Insert the following code segment at line 16. identityParameter.Direction = ParameterDirection.Output; C. Insert the following code segment at line 11. rowcountParameter.Direction = ParameterDirection.ReturnValue; Insert the following code segment at line 16. identityParameter.Direction = ParameterDirection.Output; D. Insert the following code segment at line 11. rowcountParameter.Direction = ParameterDirection.Output; Insert the following code segment at line 16. 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) 2 QUESTION 239 You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. You use the following SQL statement to retrieve an instance of a DataSet object named ds. SELECT CustomerID, CompanyName, ContactName, Address, City FROM dbo.Customers You need to query the DataSet object to retrieve only the rows where the ContactName field is not NULL. Which code segment should you use? A. from row in ds.Tables(0).AsEnumerable() where DirectCast(row("ContactName"), String) IsNot Nothing select row B. from row in ds.Tables(0).AsEnumerable() where row.Field(Of String)("ContactName") IsNot Nothing select row C. from row in ds.Tables(0).AsEnumerable() where Not row.IsNull(DirectCast(row("ContactName"), String)) select row D. from row in ds.Tables(0).AsEnumerable() where Not Convert.IsDBNull(row.Field(Of String)("Region")) select row Answer: B Explanation: Field<T>(DataRow, String) Provides strongly-typed access to each of the column values in the specified row. The Field method also supports nullable types. QUESTION 240 You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. You use the ADO.NET LINQ to SQL model to retrieve data from the database. The application contains the Category and Product entities, as shown in the following exhibit. You need to ensure that LINQ to SQL executes only a single SQL statement against the database. You also need to ensure that the query retrieves the list of categories and the list of products. Which code segment should you use? A. Using dc As New NorthwindDataContext() dc.ObjectTrackingEnabled = False Dim categories As var = From c In dc.Categories _ Select c For Each category As var In categories Console.WriteLine("{0} has {1} products", category.CategoryName, category.Products.Count) Next End Using B. Using dc As New NorthwindDataContext() dc.DeferredLoadingEnabled = False Dim dlOptions As New DataLoadOptions() dlOptions.LoadWith(Of Category)(Function(c As ) C. Products) dc.LoadOptions = dlOptions Dim categories As var = From c In dc.Categories _ Select c For Each category As var In categories Console.WriteLine("{0} has {1} products", category. CategoryName, category.Products.Count) Next End Using C. Using dc As New NorthwindDataContext() dc.DefferredLoadingEnabled = False Dim categories As var = From c In dc.Categories _ Select c For Each category As var In categories Console.WriteLine("{0} has {1} products", category.CategoryName, category.Products.Count) Next End Using D. Using dc As New NorthwindDataContext() dc.DeferredLoadingEnabled = False Dim dlOptions As New DataLoadOptions() dlOptions.Asso ciateWith(Of Category)(Function(c As ) C.Products) dc.LoadOptions = dlOptions Dim categories As var = From c In dc.Categories _ Select c For Each category As var In categories Console.WriteLine("{0} has {1} products", category.CategoryName, category.Products.Count) Next End Using Answer: B Explanation: DataLoadOptions Class Provides for immediate loading and filtering of related data. DataLoadOptions.LoadWith(LambdaExpression) Retrieves specified data related to the main target by using a lambda expression. You can retrieve many objects in one query by using LoadWith. DataLoadOptions.AssociateWith(LambdaExpression) Filters the objects retrieved for a particular relationship. Use the AssociateWith method to specify sub-queries to limit the amount of retrieved data. DataLoadOptions Class (http://msdn.microsoft.com/en-us/library/system.data.linq.dataloadoptions.aspx) 3 How to: Retrieve Many Objects At Once (LINQ to SQL) (http://msdn.microsoft.com/en-us/library/Bb386917(v=vs.90).aspx) 4 How to: Filter Related Data (LINQ to SQL) (http://msdn.microsoft.com/en-us/library/Bb882678(v=vs.100).aspx 5) New Updated Braindump2go 70-489 Dumps Add Many New 70-489 Exam Questions,You can Download Free 70-489 PDF and 70-489 VCE from Braindump2go. Use Braindump2go 70-489 Study Guide and 70-489 Braindump2go to 100% Get 70-489 Certification. FREE DOWNLOAD: NEW UPDATED 70-516 PDF Dumps & 70-516 VCE Dumps from Braindump2go: http://www.braindump2go.com/70-516.html (286 Q&A)
|