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 VCE&70-516 PDF Dumps: http://www.braindump2go.com/70-516.html (286 Q&As)
Quick and Effective Microsoft 70-516 Exam Preparation Options – Braindump2go new released 70-516 Exam Dumps Questions! Microsoft Official 70-516 relevant practice tests are available for Instant downloading at Braindump2go! PDF and VCE Formates, easy to use and install! 100% Success Achievement Guaranteed!
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 111
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application uses the ADO.NET Entity Framework to model entities.
You define a Category class by writing the following code segment. (Line numbers are included for reference only.)
01 public class Category
02 {
03 public int CategoryID { get; set; }
04 public string CategoryName { get; set; }
05 public string Description { get; set; }
06 public byte[] Picture { get; set; }
07 …
08 }
You need to add a collection named Products to the Category class.
You also need to ensure that the collection supports deferred loading.
Which code segment should you insert at line 07?
A. public static List <Product> Products { get; set; }
B. public virtual List <Product> Products { get; set; }
C. public abstract List <Product> Products { get; set; }
D. protected List <Product> Products { get; set; }
Answer: B
Explanation:
One of the requirements for lazy loading proxy creation is that the navigation properties must be declared virtual (Overridable in Visual Basic).
If you want to disable lazy loading for only some navigation properties, then make those properties non-virtual.
Loading Related Objects (Entity Framework)
(http://msdn.microsoft.com/en-us/library/gg715120(v=vs.103).aspx)
QUESTION 112
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows Forms application.
You plan to deploy the application to several shared client computers.
You write the following code segment. (Line numbers are included for reference only.)
01 Configuration config = ConfigurationManager.OpenExeConfiguration(exeConfigName);
02 …
03 config.Save();
04 …
You need to encrypt the connection string stored in the .config file.
Which code segment should you insert at line 02?
A. ConnectionStringsSection section =
config.GetSection(“connectionString”)
as ConnectionStringsSection;
section.SectionInformation.ProtectSection
(“DataProtectionConfigurationProvider”);
B. ConnectionStringsSection section =
config.GetSection(“connectionStrings”)
as ConnectionStringsSection;
section.SectionInformation.ProtectSection
(“DataProtectionConfigurationProvider”);
C. ConnectionStringsSection section =
config.GetSection(“connectionString”)
as ConnectionStringsSection;
section.SectionInformation.ProtectSection
(“RsaProtectedConfigurationProvider”);
D. ConnectionStringsSection section =
config.GetSection(“connectionStrings”)
as ConnectionStringsSection;
section.SectionInformation.ProtectSection
(“RsaProtectedConfigurationProvider”);
Answer: D
Explanation:
You encrypt and decrypt the contents of a Web.config file by using System.Configuration .
DPAPIProtectedConfigurationProvider,
which uses the Windows Data Protection API (DPAPI) to encrypt and decrypt data, or System.Configuration.
RSAProtectedConfigurationProvider, which uses the RSA encryption algorithm to encrypt and decrypt data. When you use the same encrypted configuration file on many computers in a Web farm, only System.Configuration.RSAProtectedConfigurationProvider enables you to export the encryption keys that encrypt the data and import them on another server. This is the default setting.
CHAPTER 2 ADO.NET Connected Classes
Lesson 1: Connecting to the Data Store
Storing Encrypted Connection Strings in Web Applications (page 76)
Securing Connection Strings
(http://msdn.microsoft.com/en-us/library/89211k9b(v=vs.80).aspx)
QUESTION 113
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server database.
The application uses the ADO.NET Entity Framework to model entities.
The database includes objects based on the exhibit.
The application includes the following code segment. (Line numbers are included for reference only.)
01 using (AdventureWorksEntities context = new AdventureWorksEntities()){
02 …
03 foreach (SalesOrderHeader order in customer.SalesOrderHeader){
04 Console.WriteLine(String.Format(“Order: {0} “, order.SalesOrderNumber));
05 foreach (SalesOrderDetail item in order.SalesOrderDetail){
06 Console.WriteLine(String.Format(“Quantity: {0} “, item.Quantity));
07 Console.WriteLine(String.Format(“Product: {0} “, item.Product.Name));
08 }
09 }
10 }
You want to list all the orders for a specified customer.
You need to ensure that the list contains the following fields:
– Order number
– Quantity of products
– Product name
Which code segment should you insert at line 02?
A. Contact customer = context.Contact.Where(“it.ContactID = @customerId”,
new ObjectParameter(“@customerId”,
customerId)).First();
B. Contact customer = context.Contact.Where(“it.ContactID = @customerId”,
new ObjectParameter(“customerId”,
customerId)).First();
C. context.ContextOptions.LazyLoadingEnabled = true;
Contact customer = (from contact in context.Contact
include(“SalesOrderHeader.SalesOrderDetail”)
select conatct).FirstOrDefault();
D. Contact customer = (from contact in context.Contact
include(“SalesOrderHeader”)
select conatct).FirstOrDefault();
Answer: B
QUESTION 114
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You use the ADO.NET Entity Framework to model entities.
You write the following code segment. (Line numbers are included for reference only.)
01 AdventureWorksEntities context = new AdventureWorksEntities(“http://localhost:1234/AdventureWorks.svc”);
02 …
03 var q = from c in context.Customers
04 where c.City == “London”
05 orderby c.CompanyName
06 select c;
You need to ensure that the application meets the following requirements:
– Compares the current values of unmodified properties with values returned from the data source.
– Marks the property as modified when the properties are not the same.
Which code segment should you insert at line 02?
A. context.MergeOption = MergeOption.AppendOnly;
B. context.MergeOption = MergeOption.PreserveChanges;
C. context.MergeOption = MergeOption.OverwriteChanges;
D. context.MergeOption = MergeOption.NoTracking;
Answer: B
Explanation:
PreserveChanges-Objects that do not exist in the object context are attached to the context.
If the state of the entity is Unchanged, the current and original values in the entry are overwritten with data source values.
The state of the entity remains Unchanged and no properties are marked as modified.
If the state of the entity is Modified, the current values of modified properties are not overwritten with data source values.
The original values of unmodified properties are overwritten with the values from the data
source.
In the .NET Framework version 4, the Entity Framework compares the current values of unmodified properties with the values that were returned from the data source. If the values are not the same, the property is marked as modified.
MergeOption Enumeration
(http://msdn.microsoft.com/en-us/library/system.data.objects.mergeoption.aspx)
QUESTION 115
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You use the ADO.NET Entity Framework to model entities.
You write the following code segment. (Line numbers are included for reference only.)
01 public partial class SalesOrderDetail : EntityObject
02 {
03 partial void OnOrderQtyChanging(short value)
04 {
05 …
06 {
07 …
08 }
09 }
10 }
You need to find out whether the object has a valid ObjectStateEntry instance.
Which code segment should you insert at line 05?
A. if (this.EntityState != EntityState.Detached)
B. if (this.EntityState != EntityState.Unchanged)
C. if (this.EntityState != EntityState.Modified)
D. if (this.EntityState != EntityState.Added)
Answer: A
Explanation:
Detached The object exists but is not being tracked. An entity is in this state immediately after it has been created and before it is added to the object context. An entity is also in this state after it has been removed from the context by calling the Detach method or if it is loaded by using a NoTracking MergeOption. There is no ObjectStateEntry instance associated with objects in the Detached state.
Unchanged The object has not been modified since it was attached to the context or since the last time that the SaveChanges method was called.
Added The object is new, has been added to the object context, and the SaveChanges method has not been called.
After the changes are saved, the object state changes to Unchanged. Objects in the Added state do not have original values in the ObjectStateEntry.
Deleted The object has been deleted from the object context. After the changes are saved, the object state changes to Detached.
Modified One of the scalar properties on the object was modified and the SaveChanges method has not been called.
In POCO entities without change-tracking proxies, the state of the modified properties changes to Modified when the DetectChanges method is called. After the changes are saved, the object state changes to Unchanged.
EntityState Enumeration
(http://msdn.microsoft.com/en-us/library/system.data.entitystate.aspx)
CHAPTER 6 ADO.NET Entity Framework
Lesson 1: What Is the ADO.NET Entity Framework?
Storing Information about Objects and Their State (page 381)
QUESTION 116
You use Microsoft Visual Studio 2010, Microsoft Sync Framework, and Microsoft .NET Framework 4.0 to create an application.
You have a ServerSyncProvider connected to a Microsoft SQL Server database.
The database is hosted on a Web server.
Users will use the Internet to access the Customer database through the ServerSyncProvider.
You write the following code segment. (Line numbers are included for reference only.)
01 SyncTable customerSyncTable = new SyncTable(“Customer”);
02 customerSyncTable.CreationOption = TableCreationOption.UploadExistingOrCreateNewTable;
03 …
04 customerSyncTable.SyncGroup = customerSyncGroup;
05 this.Configuration.SyncTables.Add(customerSyncTable);
You need to ensure that the application meets the following requirements:
– Users can modify data locally and receive changes from the server.
– Only changed rows are transferred during synchronization.
Which code segment should you insert at line 03?
A. customerSyncTable.SyncDirection = SyncDirection.DownloadOnly;
B. customerSyncTable.SyncDirection = SyncDirection.Snapshot;
C. customerSyncTable.SyncDirection = SyncDirection.Bidirectional;
D. customerSyncTable.SyncDirection = SyncDirection.UploadOnly;
Answer: C
Explanation:
TableCreationOption:
CreateNewTableOrFail-Create the table in the client database. If an existing table has the same name, throw an exception.
DropExistingOrCreateNewTable-Create the table in the client database. If an existing table has the same name, drop the existing table first.
TruncateExistingOrCreateNewTable-Create the table in the client database if the table does not exist. If an existing table has the same name, delete all rows from this table. UploadExistingOrCreateNewTable-Create the table in the client database if the table does not exist. If an existing table has the same name, upload all rows from this table on the first synchronization.
This option is only valid with a SyncDirection of Bidirectional or UploadOnly. UseExistingTableOrFail-Use an existing table in the client database that has the same name. If the table does not exist, throw an exception.
SyncDirection:
Bidirectional-During the first synchronization, the client typically downloads schema and an initial data set from the server.
On subsequent synchronizations, the client uploads changes to the server and then downloads changes from the server.
DownloadOnly-During the first synchronization, the client typically downloads schema and an initial data set from the server.
On subsequent synchronizations, the client downloads changes from the server.
Snapshot-The client downloads a set of data from the server. The data is completely refreshed during each synchronization.
UploadOnly-During the first synchronization, the client typically downloads schema from the server.
On subsequent synchronizations, the client uploads changes to the server.
TableCreationOption Enumeration
(http://msdn.microsoft.com/en-us/library/microsoft.synchronization.data.tablecreationoption.aspx)
SyncDirection Enumeration
(http://msdn.microsoft.com/en-us/library/microsoft.synchronization.data.syncdirection.aspx)
CHAPTER 8 Developing Reliable Applications
Lesson 4: Synchronizing Data
Implementing the Microsoft Sync Framework (page 566)
QUESTION 117
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows Communication Foundation (WCF) Data Services service.
The service connects to a Microsoft SQL Server 2008 database.
The service is hosted by an Internet Information Services (IIS) 6.0 Web server.
The application works correctly in the development environment.
However, when you connect to the service on the production server, attempting to update or delete an entity results in an error.
You need to ensure that you can update and delete entities on the production server.
What should you do?
A. Add the following line of code to the InitializeService method of the service:
config.SetEntitySetAccessRule (“*”, EntitySetRights.WriteDelete |
EntitySetRights.WriteInsert);
B. Add the following line of code to the InitializeService method of the service:
config.SetEntitySetAccessRule (“*”, EntitySetRights.WriteDelete |
EntitySetRights.WriteMerge);
C. Configure IIS to allow the PUT and DELETE verbs for the .svc Application Extension.
D. Configure IIS to allow the POST and DELETE verbs for the .svc Application Extension.
Answer: C
Explanation:
An OData client accesses data provided by an OData service using standard HTTP. The OData protocol largely follows the conventions defined by REST, which define how HTTP verbs are used. The most important of these verbs are:
GET: Reads data from one or more entities.
PUT: Updates an existing entity, replacing all of its properties.
MERGE: Updates an existing entity, but replaces only specified properties[2].
POST: Creates a new entity.
DELETE: Removes an entity.
Http Header Verbs Enumeration
(http://msdn.microsoft.com/en-us/library/windows/desktop/aa364664(v=vs.85).aspx)
WCF Data Services Overview
(http://msdn.microsoft.com/en-us/library/cc668794.aspx)
Introduction to OData Protocol
(http://msdn.microsoft.com/en-us/data/hh237663)
QUESTION 118
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server 2008 database.
The database includes a table named dbo.Documents
that contains a column with large binary data.
You are creating the Data Access Layer (DAL).
You add the following code segment to query the dbo.Documents table. (Line numbers are included for reference only.)
01 public void LoadDocuments(DbConnection cnx)
02 {
03 var cmd = cnx.CreateCommand();
04 cmd.CommandText = “SELECT * FROM dbo.Documents”;
05 …
06 cnx.Open();
07 …
08 ReadDocument(reader);
09 }
You need to ensure that data can be read as a stream.
Which code segment should you insert at line 07?
A. var reader = cmd.ExecuteReader(CommandBehavior.Default);
B. var reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly);
C. var reader = cmd.ExecuteReader(CommandBehavior.KeyInfo);
D. var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess);
Answer: D
Explanation:
CommandBehavior:
Default
The query may return multiple result sets. Execution of the query may affect the database state. Default sets no CommandBehavior flags, so calling
ExecuteReader(CommandBehavior.Default) is functionally equivalent to calling ExecuteReader().
SingleResult The query returns a single result set.
SchemaOnly The query returns column information only.
When using SchemaOnly, the .NET Framework
Data Provider for SQL Server precedes the statement being executed with SET FMTONLY ON.
KeyInfo The query returns column and primary key information. When KeyInfo is used for command execution, the provider will append extra columns to the result set for existing primary key and timestamp columns. When using KeyInfo, the .NET Framework Data Provider
for SQL Server precedes the statement being executed with SET FMTONLY OFF and SET NO_BROWSETABLE ON.
The user should be aware of potential side effects, such as interference with the use of SET
FMTONLY ON statements.
SingleRow The query is expected to return a single row of the first result set. Execution of the query may affect the database state.
Some .NET Framework data providers may, but are not required to, use this information to optimize the performance of the command.
When you specify SingleRow with the ExecuteReader method of the OleDbCommand object, the .NET Framework Data Provider for OLE DB performs binding using the OLE DB IRow interface if it is available. Otherwise, it uses the IRowset interface.
If your SQL statement is expected to return only a single row, specifying SingleRow can also improve application performance.
It is possible to specify SingleRow when executing queries that are expected to return multiple result sets.
In that case, where both a multi-result set SQL query and single row are specified, the result returned will contain only the first row of the first result set. The other result sets of the query will not be returned.
SequentialAccess Provides a way for the DataReader to handle rows that contain columns with large binary values. Rather than loading the entire row, SequentialAccess enables the DataReader to load data as a stream. You can then use the GetBytes or GetChars method to specify a byte location to start the read operation, and a limited buffer size for the data being returned.
When you specify SequentialAccess, you are required to read from the columns in the order
they are returned, although you are not required to read each column. Once you have read past a location in the returned stream of data, data at or before that location can no longer be read from the DataReader.
When using the OleDbDataReader, you can reread the current column value until reading past
it. When using the SqlDataReader, you can read a column value can only once.
CloseConnection When the command is executed, the associated Connection object is closed when the associated DataReader object is closed.
CommandBehavior Enumeration
(http://msdn.microsoft.com/en-us/library/system.data.commandbehavior.aspx)
QUESTION 119
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server database.
You create a DataSet object in the application.
You add two DataTable objects named App_Products and App_Categories to the DataSet.
You add the following code segment to populate the DataSet object.
(Line numbers are included for reference only.)
01 public void Fill(SqlConnection cnx, DataSet ds)
02 {
03 var cmd = cnx.CreateCommand();
04 cmd.CommandText = “SELECT * FROM dbo.Products; ” + “SELECT * FROM dbo.Categories”;
05 var adapter = new SqlDataAdapter(cmd);
06 …
07 }
You need to ensure that App_Products and App_Categories are populated from the dbo.Products and dbo.Categories database tables.
Which code segment should you insert at line 06?
A. adapter.Fill(ds, “Products”);
adapter.Fill(ds, “Categories”);
B. adapter.Fill(ds.Tables[“App_Products”]);
adapter.Fill(ds.Tables[“App_Categories”]);
C. adapter.TableMappings.Add(“Table”, “App_Products”);
adapter.TableMappings.Add(“Table1”, “App_Categories”);
adapter.Fill(ds);
D. adapter.TableMappings.Add(“Products”, “App_Products”);
adapter.TableMappings.Add(“Categories”, “App_Categories”);
adapter.Fill(ds);
Answer: D
Explanation:
Table Mapping in ADO.NET
(http://msdn.microsoft.com/en-us/library/ms810286.aspx)
QUESTION 120
You are calling a stored procedure in SQL Server 2008 that returns a UDT as an output parameter.
This UDT, called MyCompanyType, was created by your company.
The UDT has a method called GetDetails that you want to execute in your client application.
What must you do to execute the method? (Each correct answer presents part of a complete solution. Choose three.)
A. Set the SqlDbType of the parameter to SqlDbType.Udt.
B. Set the UdtTypeName of the parameter to MyCompanyType.
C. Call the ExecuteXmlReader method on the SqlCommand to serialize the UDT as XML.
D. In the client application, set a reference to the assembly in which the UDT is.
Answer: ABD
All 286 Microsoft 70-516 Exam Dumps Questions are the New Checked and Updated! In recent years, the 70-516 certification has become a global standard for many successful IT companies. Looking to become a certified Microsoft professional? Download Braindump2go 2015 Latest Released 70-516 Exam Dumps Full Version and Pass 70-516 100%!
FREE DOWNLOAD: NEW UPDATED 70-516 PDF Dumps & 70-516 VCE Dumps from Braindump2go: http://www.braindump2go.com/70-516.html (286 Q&A)