You are on page 1of 4

Exam : 70-516

Title : TS:Accessing Data with Microsoft .NET


Versiondemo
1. You use Microsoft Visual Studio 2010 and Microsoft ADO.NET Framework 4 to create an application.TheapplicationconnectstoaMicrosoftSQLServer2008database. You use the ADO.NET LINQ to SQL model to retrieve data from the database. You use stored procedurestoreturnmultipleresultsets.

Youneedtoensurethattheresultsetsarereturnedasstronglytypedvalues. Whatshouldyoudo A. Apply the FunctionAttribute and ResultTypeAttribute to the stored procedure function. Use theGetResult<TElement>methodtoobtainanenumeratorofthecorrecttype. B. Apply the FunctionAttribute and ParameterAttribute to the stored procedure function and directlyaccessthestronglytypedobjectfromtheresultscollection. C. Apply the ResultTypeAttribute to the stored procedure function and directly access the stronglytypedobjectfromtheresultscollection. D. Apply the ParameterAttribute to the stored procedure function. Use the GetResult<TElement> methodtoobtainanenumeratorofthecorrecttype. Answer:A 2. You use Microsoft Visual Studio 2010 and Microsoft ADO.NET Framework 4 to create an application.TheapplicationconnectstoaMicrosoftSQLServer2008database. You use the ADO.NET LINQ to SQL model to retrieve data from the database. You use stored procedurestoreturnmultipleresultsets. Youneedtoensurethattheresultsetsarereturnedasstronglytypedvalues. Whatshouldyoudo A. Apply the FunctionAttribute and ResultTypeAttribute to the stored procedure function. Use theGetResult<TElement>methodtoobtainanenumeratorofthecorrecttype. B. Apply the FunctionAttribute and ParameterAttribute to the stored procedure function and directlyaccessthestronglytypedobjectfromtheresultscollection. C. Apply the ResultTypeAttribute to the stored procedure function and directly access the stronglytypedobjectfromtheresultscollection. D. Apply the ParameterAttribute to the stored procedure function. Use the GetResult<TElement> methodtoobtainanenumeratorofthecorrecttype. Answer:A 3.YouuseMicrosoftVisualStudio2010andMicrosoft.NETFramework4tocreateanapplication. The application connects to a Microsoft SQL Server database. The application uses the ADO.NET LINQtoSQLmodeltoretrievedatafromthedatabase. Theapplicationwillnotmodifyretrieveddata. You need to ensure that all the requested data is retrieved. You want to achieve this goal using theminimumamountofresources. Whatshouldyoudo A.SetObjectTrackingEnabledtotrueontheDataContextclass. B.SetObjectTrackingEnabledtofalseontheDataContextclass. C.SetDeferredLoadingEnabledtotrueontheDataContextclass. D.SetDeferredLoadingEnabledtofalseontheDataContextclass. Answer:B 4.YouuseMicrosoftVisualStudio2010andMicrosoft.NETFramework4tocreateanapplication. The application connects to a Microsoft SQL Server database. The application uses the ADO.NET LINQtoSQLmodeltoretrievedatafromthedatabase.

Theapplicationwillnotmodifyretrieveddata. You need to ensure that all the requested data is retrieved. You want to achieve this goal using theminimumamountofresources. Whatshouldyoudo A.SetObjectTrackingEnabledtotrueontheDataContextclass. B.SetObjectTrackingEnabledtofalseontheDataContextclass. C.SetDeferredLoadingEnabledtotrueontheDataContextclass. D.SetDeferredLoadingEnabledtofalseontheDataContextclass. Answer:B 5.YouuseMicrosoftVisualStudio2010andMicrosoft.NETFramework4tocreateanapplication. TheapplicationconnectstoaMicrosoftSQLServerdatabase. YouusetheADO.NETLINQtoSQLmodeltoretrievedatafromthedatabase. TheapplicationcontainstheCategoryandProductentities,asshowninthefollowingexhibit. You need to ensure that LINQ to SQL executes only a single SQL statement against the database. Youalsoneedtoensurethatthequeryretrievesthelistofcategoriesandthelistofproducts. Whichcodesegmentshouldyouuse A.using(NorthwindDataContextdc=newNorthwindDataContext()) { dc.ObjectTrackingEnabled=false; varcategories=fromcindc.Categories selectc; foreach(varcategoryincategories) { Console.WriteLine("{0}has{1}products",category.CategoryName,category.Products.Count); } } B.using(NorthwindDataContextdc=newNorthwindDataContext()) { dc.DeferredLoadingEnabled=false; DataLoadOptionsdlOptions=newDataLoadOptions(); dlOptions.LoadWith<Category>(c=>c.Products); dc.LoadOptions=dlOptions; varcategories=fromcindc.Categories selectc; foreach(varcategoryincategories) { Console.WriteLine("{0}has{1}products",category.CategoryName,category.Products.Count); } } C.using(NorthwindDataContextdc=newNorthwindDataContext()) { dc.DeferredLoadingEnabled=false; varcategories=fromcindc.Categories

selectc; foreach(varcategoryincategories) { Console.WriteLine("{0}has{1}products",category.CategoryName,category.Products.Count); } } D.using(NorthwindDataContextdc=newNorthwindDataContext()) { dc.DeferredLoadingEnabled=false; DataLoadOptionsdlOptions=newDataLoadOptions(); dlOptions.AssociateWith<Category>(c=>c.Products); dc.LoadOptions=dlOptions; varcategories=fromcindc.Categories selectc; foreach(varcategoryincategories) { Console.WriteLine("{0}has{1}products",category.CategoryName,category.Products.Count); } } Answer:B

You might also like