This page was exported from All The Latest MCTS Exam Questions And Answers For Free Share [ https://www.mctsdump.com ] Export date:Tue Dec 3 17:12:32 2024 / +0000 GMT ___________________________________________________ Title: [Pass Ensure VCE Dumps] Premium 286q 70-516 Exam Questions Ensure 100 Percent Exam Passing (61-80) --------------------------------------------------- 100% Pass 70-516 Exam: if you are preparing 70-516 exam and want to pass it exam easily, we recommend you to get the new 286q 70-516 exam questions from PassLeader, we PassLeader now are sharing the latest and updated 70-516 braindumps with VCE and PDF file, we have corrected all the new questions of our 70-516 VCE dumps and 70-516 PDF dumps and will help you 100% passing 70-516 exam. keywords: 70-516 exam,286q 70-516 exam dumps,286q 70-516 exam questions,70-516 pdf dumps,70-516 vce dumps,70-516 braindumps,70-516 practice tests,70-516 study guide,TS: Accessing Data with Microsoft .NET Framework 4 Exam QUESTION 61You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 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 retreive records from the ObjectCache table. (Line numbers are included for reference only.)01 string s = GetConnectionStringFromConfigFile("xmldb");02 using (SqlConnection conn = new SqlConnection(s))03    using (SqlCommand cmd = new SqlCommand("select * from ObjectCache", conn))04    {05       conn.Open();06       SqlDataReader rdr = cmd.ExecuteReader();07       while(rdr.Read())08       {09          ...10          DeserializeObject(obj);11       }12    }You need to retreive the data from the SerializedObjectData column and pass it to a method named DeserializeObject. Which line of code should you insert at line 09? A.    XmlReader obj  = (XmlReader)rdr[1];B.    SByte obj = (SByte)rdr[1];C.    String obj = (String)rdr[1];D.    Type obj = (Type)rdr[1]; Answer: C QUESTION 62You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application contains following XML document:<feed><title>Products</title><entry><title>Entry title 1</title><author>Author 1</author><content><properties><description>some description</description><notes>some notes</notes><comments>some comments</comments></properties></content></entry>...</feed>You plan to add localization features to the application. You add the following code segment. (Line numbers are included for reference only.)01 public IEnumerable <XNode> GetTextNodesForLocalization(XDocument doc)02 {03    ...04    return from n in nodes05           where n.NodeType = XmlNodeType.Text06           select n;07 }You need to ensure that the GetTextNodeForLocalization method returns all the XML text nodes of the XML document. Which code segment should you inser at line 03? A.    IEnumerable <XNode> nodes = doc.Descendants();B.    IEnumerable <XNode> nodes = doc.Nodes();C.    IEnumerable <XNode> nodes = doc.DescendantNodes();D.    IEnumerable <XNode> nodes = doc.NodesAfterSelf(); Answer: CExplanation:DescendantNodes() Returns a collection of the descendant nodes for this document or element, in document order.Descendants() Returns a collection of the descendant elements for this document or element, in document order.Nodes() Returns a collection of the child nodes of this element or document, in document order.NodesAfterSelf() Returns a collection of the sibling nodes after this node, in document order. QUESTION 63You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the ADO.NET Entity Framework Designer to model entities. The application includes two ObjectContext instances named context1 and context2. You need to persist the changes in both object contexts within a single transaction. Which code segment should you use? A.    using (TransactionScope scope = new TransactionScope()){  context1.SaveChanges();  context2.SaveChanges();}B.    using (TransactionScope scope = new TransactionScope()){  context1.SaveChanges();  context2.SaveChanges();  scope.Complete();}C.    using (TransactionScope scope = new TransactionScope()){  using (TransactionScope scope1 = new TransactionScope(TransactionScopeOption.RequireNew))  {    context1.SaveChanges();    scope1.Complete();  }  using (TransactionScope scope2 = new TransactionScope(TransactionScopeOption.RequireNew))  {    context2.SaveChanges();    scope2.Complete();  }  scope.Complete();}D.    using (TransactionScope scope = new TransactionScope()){  using (TransactionScope scope1 = new TransactionScope(TransactionScopeOption.RequireNew))  {    context1.SaveChanges();  }  using (TransactionScope scope2 = new TransactionScope(TransactionScopeOption.RequireNew))  {    context2.SaveChanges();  }} Answer: BExplanation:TransactionScope.Complete Indicates that all operations within the scope are completed successfully.TransactionScope Classhttp://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx QUESTION 64You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the ADO.NET Entity Framework Designer to model entities. The application includes self-tracking entities as shown in the following diagram. There is a Person entity names person1 that has TrackChanges turned on. You need to delete all e-mail addresses that are associated with person1 by using an ObjectContext. What are two possible code segments that you can use to achieve this goal? (Each correct answer presents a complete solution. Choose two). A.    foreach(var email in person1.EMailAddresses){ email.MarkAsDeleted();}context.SaveChanges();B.    while(person1.EMailAddresses.Count>0){ person1.EmailAddresses.RemoveAt(0);}context.SaveChanges();C.    person1.EMailAddresses = null;context.SaveChanges();D.    person1.EMailAddresses = new TrackableCollection<EMailAddress>();context.SaveChanges(); Answer: ABExplanation:Working with Self-Tracking Entitieshttp://msdn.microsoft.com/en-us/library/ff407090.aspxWorking with Sets of Self-Tracking Entitieshttp://blogs.msdn.com/b/adonet/archive/2010/06/02/working-with-sets-of-self-tracking-entities.aspx QUESTION 65You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses LINQ to SQL. You create a data model name 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 ListPrice column where the product color is Black or Red. Which code segment should you use? A.    string[] colorList = new string[] {"Black", "Red"};AdvWorksDataContext dc =  new AdvWorksDataContext();var prod = from p in dc.Products          where colorList.Contains(p.Color)          select p;foreach(var product in prod){ product.ListPrice = product.StandardCost * 1.5M;}dc.SubmitChanges();B.    AdvWorksDataContext dc =  new AdvWorksDataContext("...");var prod = from p in dc.Products          select p;var list = prod.ToList();foreach(Product product in list){if(product.Color == "Black, Red"){ product.ListPrice = product.StandardCost * 1.5M;}}dc.SubmitChanges();C.    AdvWorksDataContext dc =  new AdvWorksDataContext("...");var prod = from p in dc.Products          where p.Color == "Black, Red"          select p;foreach(var product in prod){ product.ListPrice = product.StandardCost * 1.5M;}dc.SubmitChanges();D.    AdvWorksDataContext dc =  new AdvWorksDataContext("...");var prod = from p in dc.Products          select p;var list = prod.ToList();foreach(Product product in list){if((product.Color == "Black) && (product.Color == "Red")){ product.ListPrice = product.StandardCost * 1.5M;}}dc.SubmitChanges(); Answer: A QUESTION 66You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. You create an Entity Data Model (EDM) by using the Microsoft ADO.NET Entity Data Model Designer (Entity Designer). The EDM contains a complex type. You need to map a stored procedure to the complex type by using the Entity Designer. What should you do? A.    Add an association to the stored procedure.B.    Add a code generation item that has the name of the stored procedure.C.    Add a function import for the stored procedure.D.    Add an entity that mirrors the properties of the complex type. Answer: C QUESTION 67You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The configuration file contains the following code segment.<configuration><connectionStrings><add name="AdventureWorksLT"        connectionString="DataSource=SQL01;InitialCatalog=AdventureWorksLT;IntegratedSecurity=True;"providerName="System.Data.SqlClient"/></connectionStrings></configuration>You need to retrieve the connection string named AdventureWorksLT from the configuration file. Which line of code should you use? A.    varconnectionString=ConfigurationManager.ConnectionStrings["AdventureWorksLT"].ConnectionString;B.    varconnectionString=ConfigurationManager.ConnectionStrings["AdventureWorksLT"].Name;C.    varconnectionString=ConfigurationManager.AppSettings["AdventureWorksLT"];D.    varconnectionString=ConfigurationSettings.AppSettings["AdventureWorksLT"]; Answer: A QUESTION 68You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses the Entity Framework. You create an Entity Data Model (EDM) named Model. You need to ensure that the Storage Schema Definition Language (SSDL) of the EDM can be modified without rebuilding the application. What should you do? A.    Set the Metadata Artifact Processing property to Embed in Output Assembly and use the following connection string:metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string="& "B.    Set the Metadata Artifact Processing property to Copy to Output Directory and use the following connection string:metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string ="& "C.    Set the Metadata Artifact Processing property to Embed in Output Assembly and use the following connection string:metadata=.Model.csdl|.Model.ssdl|.Model.msl;provider=System.Data.SqlClient;provider connection string="& "D.    Set the Metadata Artifact Processing property to Copy to Output Directory and use the following connection string:metadata=.Model.csdl|.Model.ssdl|.Model.msl;provider=System.Data.SqlClient;provider connection string ="& " Answer: DExplanation:How to: Copy Model and Mapping Files to the Output Directory (Entity Data Model Tools)http://msdn.microsoft.com/en-us/library/cc716709.aspx QUESTION 69You use Microsoft .NET Framework 4.0 to develop an application that connects to a Microsoft SQL Server 2008 database. You need to prevent dirty or phantom reads. Which IsolationLevel should you use? A.    SerializableB.    SnapshotC.    ReadCommitedD.    ReadUncommited Answer: B QUESTION 70You have a ContosoEntities context object named context and a Color object stored in a variable named color. You write the following code:context.Colors.DeleteObject(color);context.SaveChanges();When the code runs, it generates the following exception:System.Data.UpdateException: An error occurred while updating the entries.System.Data.SqlClient.SqlException: The DELETE satement conflicted with the REFERENCE constraint "FK_PartColor".The conflict occurred in database "Contoso", table "dbo.Parts", column 'ColorId'. You need to resolve the exception without negatively impacting the rest of the application. What should you do? A.    In the database, remove the foreign key association between the Parts table and the Colors table, and then update the entity data model.B.    Add a transation around the call to the SaveChanges() method and handle the exception by performing a retry.C.    Add code before the call to the DeleteObject() method to examine the collection of Part objects a ssociated with the Color object and then assign null to the Color property for each Part object.D.    Change the End2 OnDelete proprety of the FK_PartColor association from None to Cascade.E.    Change the End1 OnDelete proprety of the FK_PartColor association from None to Cascade. Answer: C http://www.passleader.com/70-516.html QUESTION 71The application user interface displays part names or color names in many plases as '## Name ##'. You need to provide a method named FormattedName() to format part names and color names throughout the application. What should you do? A.    Add the following code segment to the ExtensionMethods class in ExtensionMethods.cs:public static string FormattedName (this IName entity){return string.Format("## {0} ##", entity.Name)}B.    Add the following code segment to the ExtensionMethods class in ExtensionMethods.cs:public static string FormattedName (this Color entity){return string.Format("## {0} ##", entity.Name)}C.    Add the following code segment to the ExtensionMethods class in ExtensionMethods.cs:public static string FormattedName (this Part entity){return string.Format("## {0} ##", entity.Name)}D.    Add the following code segmend to the Color class in Color.cs:public string FormattedName(){return string.Format("## {0} ##", this.Name);}E.    Add the following code segmend to the Part class in Part.cs:public string FormattedName(){return string.Format("## {0} ##", this.Name);} Answer: A QUESTION 72You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses the Entity Framework. Entity types in the model are generated by the Entity Data Model generator tool (EdmGen.exe). You write the following code. (Line numbers are included for reference only.)01 MemoryStream stream = new MemoryStream();02 var query = context.Contacts.Include(“SalesOrderHeaders.SalesOrderDetails”);03 var contact = query.Where(“it.LastName = @lastname”, new ObjectParameter(“lastname”, lastName)).First();04 ....You need to serialize the contact and all of its related objects to the MemoryStream so that the contact can be deserialized back into the model. Which code segment should you insert at line 04? A.    var formatter = new XmlSerializer(typeof(Contact), new Type[] { typeof(SalesOrderHeader), typeof(SalesOrderDetail) });formatter.Serialize(stream, contact);B.    var formatter = new XmlSerializer(typeof(Contact));formatter.Serialize(stream, contact);C.    var formatter = new BinaryFormatter();formatter.Serialize(stream, contact);D.    var formatter = new SoapFormatter();formatter.Serialize(stream, contact); Answer: A QUESTION 73The entity data model must be configured to provide a way you cal the sp_FindObsolete stored procedure. The returned data must implement the Descendants property. In Visual Studio 2010, you open the Add functions Import dialog box from the EDMX diagram and enter the information shown in the following graphic. You need to complete the configuration in the dialog box. What should you do? A.    Click the Get Column Information button, click Create New Complex Type and then, in the Complex box, enter PartsB.    In the Returns a Collection Of area, click Scalars and then, in the Scalars list, click stringC.    In the Returns a Collection Of area, click Entities and then, in the Entities list, click ComponentD.    In the Returns a Collection Of area, click Scalars and then, in the Scalars list, click Int32 Answer: C QUESTION 74You use Microsoft Visual Studio 2010 to create a Microsoft .NET Framework 4.0 application. You create an Entity Data Model for the database tables shown in the following diagram. You need to modify the .edmx file so that a many-to-many association can exist between the Address and Customer entities. Which storage Model section of the .edmx file should you include? A.    <EntityType Name=”CustomerAddress”><Key><PropertyRef Name=”CustomerAddressID” /><PropertyRef Name=”CustomerID” /><PropertyRef Name=”AddressID” /></Key><Property Name=”CustomerAddressID” Type=”int” Nullable=”false” StoreGeneratedPattern=”Identity” /><Property Name=”CustomerID” Type=”int” Nullable=”false”/><Property Name=”AddressID” Type=”int” Nullable=”false”/><Property Name=”AddressType” Type=”nvarchar” Nullable=”false” MaxLength=”50?/></EntityType>B.    <EntityType Name=”CustomerAddress”><Key><PropertyRef Name=”CustomerID” /><PropertyRef Name=”AddressID” /></Key><Property Name=”CustomerID” Type=”int” Nullable=”false" /><Property Name=”AddressID” Type=”int” Nullable=”false" /><Property Name=”AddressType” Type=”nvarchar” Nullable=”false” MaxLength=”50? DefaultValue=”Home” /></EntityType>C.    <EntityType Name=”CustomerAddress”><Key><PropertyRef Name=”CustomerAddressID” /></Key><Property Name=”CustomerAddressID” Type=”int” Nullable=”false” StoreGeneratedPattern=”Identity” /><Property Name=”CustomerID” Type=”int” Nullable=”false”/><Property Name=”AddressID” Type=”int” Nullable=”false" /><Property Name=”AddressType” Type=”nvarchar” Nullable=”false” MaxLength=”50?/></EntityType>D.    <EntityType Name=”CustomerAddress”><Key><PropertyRef Name=”CustomerID” /><PropertyRef Name=”AddressID” /></Key><Property Name=”CustomerID” Type=”int” Nullable=”false”/><Property Name=”AddressID” Type=”int” Nullable=”false”/><Property Name=”AddressType” Type=”nvarchar” Nullable=”false” MaxLength=”50” /></EntityType> Answer: D QUESTION 75You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the ADO.NET Entity Framework Designer to model entities. You need to ensure that the entities are self-tracking. What should you do in the ADO.NET Entity Framework Designer? A.    Change the Code Generation Strategy option from Default to None.B.    Change the Transform Related Text Templates On Save option to False.C.    Add an ADO.NET Self-Tracking Entity Generator to the model.D.    Add an ADO.NET EntityObject Generator to the model. Answer: CExplanation:The ADO.NET Self-Tracking Entity Generator text template generates the object-layer code that consists of a custom typed ObjectContext and entity classes that contain self-tracking state logic so that the entities themselves keep track of their state instead of ObjectContext doing so. Probably the best usage of self-tracking entities is when working with N-tier applications.CHAPTER 6 ADO.NET Entity FrameworkLesson 1: What Is the ADO.NET Entity Framework?The Self-Tracking Entity Generator (page 405)ADO.NET Self-Tracking Entity Generator Templatehttp://msdn.microsoft.com/en-us/library/ff477604.aspx QUESTION 76You are developing an ADO.NET 4.0 application that interacts with a Microsoft SQL Server 2008 server through the SQL Server Native Client. You create a trace DLL registry entry and you register all of the trace schemas. You need to trace the application data access layer. Which control GUID file should you use? A.    ctrl.guid.snac10B.    ctrl.guid.mdacC.    ctrl.guid.adonetD.    ctrl.guid.msdadiag Answer: AExplanation:ctrl.guid.adonet-ADO.NET onlyctrl.guid.msdadiag-MSDADIAG onlyctrl.guid.snac10-SQL Server Native Client Providers only (SQL Server 2008) ctrl.guid.mdac-Windows Data Access Components (formerly Microsoft Data Access Components) on Windows 7 onlyData Access Tracing in SQL Server 2008http://msdn.microsoft.com/en-us/library/cc765421.aspx QUESTION 77You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to several SQL Server databases. You create a function that modifies customer records that are stored in multiple databases. All updates for a given record are performed in a single transaction. You need to ensure that all transactions can be recovered. What should you do? A.    Call the RecoveryComplete method of the TransactionManager class.B.    Call the EnlistDurable method of the Transaction class.C.    Call the Reenlist method of the TransactionManager class.D.    Call the EnlistVolatile method of the Transaction class. Answer: B QUESTION 78You are developing a WCF data service that will expose an existing Entity Data Model (EDM). You have the following requirements:- Users must be able to read all entities that are exposed in the EDM.- Users must be able to update or replace the SalesOrderHeader entities.- Users must be prevented from inserting or deleting the SalesOrderHeader entitiesYou need to ensure that the data service meets the requirements. Which code segment should you use in the Initialize method? A.    config.SetEntitySetAccessRule(“*”, EntitySetRights.AllRead);config.SetEntitySetAccessRule(“SalesOrderHeader”, EntitySetRights.AllWrite);B.    config.SetEntitySetAccessRule(“*”, EntitySetRights.AllRead);config.SetEntitySetAccessRule(“SalesOrderHeader”, EntitySetRights.WriteMerge | EntitySetRights.WriteReplace);C.    config.SetEntitySetAccessRule(“*”, EntitySetRights.AllRead);config.SetEntitySetAccessRule(“SalesOrderHeader”, EntitySetRights.WriteAppend | EntitySetRights.WriteDelete);D.    config.SetEntitySetAccessRule(“*”, EntitySetRights.AllRead);config.SetEntitySetAccessRule(“SalesOrderHeader”, EntitySetRights.All); Answer: BExplanation:http://msdn.microsoft.com/en-us/library/system.data.services.entitysetrights.aspxhttp://msdn.microsoft.com/en-us/library/ee358710.aspx QUESTION 79You use Microsoft .NET Framework 4.0 to develop an application that uses LINQ to SQL. The LINQ to SQL model contains the Product entity. A stored procedure named GetActiveProducts performs a query that returns the set of active products from the database. You need to invoke the stored procedure to return the active products, and you must ensure that the LINQ to SQL context can track changes to these entities. What should you do? A.    Select the Product entity, view the entity's property window, and change the Name for the entity to GetActiveProducts.B.    Add a property named GetActiveProducts to the Product entity.C.    Navigate to the GetActiveProducts stored procedure in Server Explorer, and drag the procedure onto the Product entity in the LINQ to SQL model designer surface.D.    Select the Product entity, view the entity's property window, and change the Source for the entity to GetActiveProducts. Answer: CExplanation:http://weblogs.asp.net/scottgu/archive/2007/08/16/linq-to-sql-part-6-retrieving-data-using-stored-procedures.aspx QUESTION 80You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the ADO.NET Entity Framework Designer to model entities. You retrieve an entity from an object context. A different application updates the database. You need to update the entity instance to reflect updated values in the database. Which line of code should you use? A.    context.Refresh(RefreshMode.StoreWins, entity);B.    context.LoadProperty(entity, “Client”, MergeOption.OverwriteChanges);C.    context.AcceptAllChanges();D.    context.LoadProperty(entity, "Server", MergeOption.OverwriteChanges); Answer: AExplanation:LoadProperty(Object, String) Explicitly loads an object related to the supplied object by the specified navigation property and using the default merge option. AcceptAllChanges Accepts all changes made to objects in the object context. Refresh(RefreshMode, Object) Updates an object in the object context with data from the data source.ObjectContext.Refresh Method (RefreshMode, Object)http://msdn.microsoft.com/en-us/library/bb896255.aspx http://www.passleader.com/70-516.html --------------------------------------------------- Images: --------------------------------------------------- --------------------------------------------------- Post date: 2015-11-30 07:11:01 Post date GMT: 2015-11-30 07:11:01 Post modified date: 2015-11-30 07:11:01 Post modified date GMT: 2015-11-30 07:11:01 ____________________________________________________________________________________________ Export of Post and Page as text file has been powered by [ Universal Post Manager ] plugin from www.gconverters.com