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)
Braindump2go New Released 70-516 Microsoft Exam Dumps Free Download Today! All 286q 70-516 Exam Questions are the new updated from Microsoft Official Exam Center.Braindump2go Offers 70-516 PDF Dumps and 70-516 VCE Dumps for free Download Now! 100% pass 70-516 Certification Exam!
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 91
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses the ADO.NET Entity Framework to model entities.
You create an entity model as shown in the following diagram.
You need to ensure that all Person entities and their associated EmailAddresses are loaded. Which code segment should you use?
A. var people = context.People.Include
(“EmailAddresses”).ToList();
B. var people = context.People.Except
(new ObjectQuery<Person>(“Person.EmailAddresses”, context)).ToList();
C. var people = context.People.Except
(new ObjectQuery<Person>(“EmailAddresses”, context)).ToList();
D. var people = context.People.Include
(“Person.EmailAddresses”).ToList();
Answer: A
Explanation:
CHAPTER 6 ADO.NET Entity Framework
Lesson 1: What Is the ADO.NET Entity Framework?
Lazy Loading vs. Explicit Loading vs. Eager Loading (page 384)
http://msdn.microsoft.com/en-us/library/bb896272.aspx
QUESTION 92
You use Microsoft .NET Framework 4.0 to develop an application that connects to a local Microsoft SQL Server 2008 database.
The application can access a high-resolution timer.
You need to display the elapsed time, in sub-milliseconds (<1 millisecond), that a database query takes to execute.
Which code segment should you use?
A. int Start = Environment.TickCount;
command.ExecuteNonQuery();
int Elapsed = (Environment.TickCount) – Start;
Console.WriteLine(“Time Elapsed: {0:N} ms”, Elapsed);
B. Stopwatch sw = Stopwatch.StartNew();
command.ExecuteNonQuery() ;
sw.Stop() ;
Console.WriteLine(“Time Elapsed: {0:N} ms”,
sw.Elapsed.TotalMilliseconds);
C. DateTime Start = DateTime.UtcNow;
command.ExecuteNonQuery();
TimeSpan Elapsed = DateTime.UtcNow – Start;
Console.WriteLine(“Time Elapsed: {0:N} ms”, Elapsed.Milliseconds);
D. Stopwatch sw = new Stopwatch();
sw.Start() ;
command.ExecuteNonQuery();
sw.Stop();
Console.WriteLine(“Time Elapsed: {0:N} ms”, sw.Elapsed.Milliseconds);
Answer: D
Explanation:
Stopwatch Class
(http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx)
QUESTION 93
You 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 associate a previously deserialized entity named person1 to an object context named model and persist changes to the database.
Which code segment should you use?
A. person1.AcceptChanges();
model.SaveChanges();
B. model.People.ApplyChanges(person1) ;
model.SaveChanges();
C. model.AttachTo(“People”, person1);
model.SaveChanges();
D. model.People.Attach(person1);
model.SaveChanges();
Answer: C
Explanation:
Cosiderations from Attaching and Detaching objects
(http://msdn.microsoft.com/en-us/library/bb896271.aspx):
The object that is passed to the Attach method must have a valid EntityKey value. If the object does not have a valid EntityKey value, use the AttachTo method to specify the name of the entity set.
Attach Use the Attach method of ObjectContext where the method accepts a single typed entity parameter.
AttachTo The AttachTo method of ObjectContext accepts two parameters. The first parameter is a string containing the name of the entity set.
The second parameter’ type is object and references the entity you want to add.
Attach The Attach method of ObjectSet, which is the entity set’ type, accepts a single typed parameter containing the entity to be added to the ObjectSet.
CHAPTER 6 ADO.NET Entity Framework
Lesson 2: Querying and Updating with the Entity Framework
Attaching Entities to an ObjectContext(page 437)
Attaching and Detaching objects
(http://msdn.microsoft.com/en-us/library/bb896271.aspx)
http://msdn.microsoft.com/en-us/library/bb896248(v=vs.90).aspx
http://msdn.microsoft.com/en-us/library/bb896248.aspx
QUESTION 94
You use Microsoft .NET Framework 4.0 to develop an application that uses WCF Data Services to persist entities from the following Entity Data Model.
You create a new Blog instance named newBlog and a new Post instance named newPost as shown in the following code segment. (Line numbers are included for reference only.)
01 Blog newBlog = new Blog();
02 Post newPost = new Post();
03 ….
04 Uri serviceUri = new Uri(“…”);
05 BlogsEntities context = new BlogsEntities(serviceUri);
06 ….
You need to ensure that newPost is related to newBlog through the Posts collection property and that newPost and newBlog are sent to the service.
Which code segment should you insert at line 06?
A. context.AttachLink(newBlog, “Posts”, newPost);
context.SaveChanges(SaveChangesOptions.Batch) ;
B. newBlog.Posts.Add(newPost);
context.AddToBlogs(newBlog);
context.AddToPosts(newPost);
context.SaveChanges(SaveChangesOptions.Batch);
C. newBlog.Posts.Add(newPost);
context.AttachTo(“Blogs”, newBlog);
context.AttachTo(“Posts”, newPost);
context.SaveChanges(SaveChangesOptions.Batch);
D. newBlog.Posts.Add(newPost);
context.UpdateObject(newBlog);
context.UpdateObject(newPost);
context.SaveChanges(SaveChangesOptions.Batch);
Answer: C
Explanation:
Attaching and Detaching objects
(http://msdn.microsoft.com/en-us/library/bb896271.aspx)
QUESTION 95
You use Microsoft .NET Framework 4.0 to develop an application that connects to a Microsoft SQL Server 2008 database.
The application includes a table adapter named taStore, which has the following DataTable.
There is a row in the database that has a ProductID of 680.
You need to change the Name column in the row to “New Product Name”.
Which code segment should you use?
A. var dt = new taStore.ProductDataTable();
var ta = new taStoreTableAdapters.ProductTableAdapter();
ta.Fill(dt);
taStore.ProductRow row = (taStore.ProductRow)dt.Rows.Find(680) ;
row.Name = “New Product Name”;
ta.Update(row);
B. var ta = new taStoreTableAdapters.ProductTableAdapter();
var dt = ta.GetData();
var row = dt.Select(“680”) ;
row[0][“Name”] = “New Product Name”;
ta.Update(row);
C. var dt = new taStore.ProductDataTable();
var ta = new taStoreTableAdapters.ProductTableAdapter();
ta.Fill(dt);
var dv = new DataView();
dv.RowFilter = “680”;
dv[0][“Name”] = “New Product Name”;
ta.Update(dt);
D. var dt = new taStore.ProductDataTable();
var row = dt.NewProductRow();
row.ProductID = 680;
row.Name = “New Product Name”;
dt.Rows.Add(row) ;
Answer: A
Explanation:
DataRowCollection.Find() Method To use the Find method, the DataTable object to which the DataRowCollection object belongs to must have at least one column designated as a primary key column. See the PrimaryKey property for details on creating a PrimaryKey column, or an array of DataColumn objects when the table has more than one primary key.
var dt = new CustomersDS.CustomersDataTable();
var ta = new CustomersDSTableAdapters.CustomersTableAdapter();
ta.Fill(dt);
CustomersDS.CustomersRow row = (CustomersDS.CustomersRow)dt.Rows.Find(4); row.Name = “A. Found Customer Id”;
ta.Update(row);
DataTable.Select() Method Gets an array of all DataRow objects that match the filter criteria. To
create the filterExpression argument,
use the same rules that apply to the DataColumn class’s Expression
property value for creating filters.
var ta = new CustomersDSTableAdapters.CustomersTableAdapter();
var dt = ta.GetData();
var row = dt.Select(“CustomerID > 2”);
row[0][“Name”] = “B. Found Customer Id”;
ta.Update(row);
TableAdapter Overview
(http://msdn.microsoft.com/en-us/library/bz9tthwx(v=vs.80).aspx)
QUESTION 96
You use Microsoft .NET Framework 4.0 to develop an application that exposes a WCF Data Services endpoint.
The endpoint uses an authentication scheme that requires an HTTP request that has the following header format.
GET /OData.svc/Products(1)
Authorization: WRAP access_token “123456789”
You add the following method to your DataService implementation.
01 protected override void OnStartProcessingRequest(ProcessRequestArgs args)
02 {
03 ….
04 }
You need to ensure that the method retrieves the authentication token.
Which line of code should you use?
A. string token =
args.OperationContext.RequestHeaders[“Authorization”];
B. string token =
args.OperationContext.RequestHeaders[“WRAP access_token”];
C. string token =
args.OperationContext.ResponseHeaders[“Authorization”];
D. string token =
args.OperationContext.ResponseHeaders[“WRAP access_token”];
Answer: A
Explanation:
OData and Authentication-OAuth WRAP
(http://blogs.msdn.com/b/astoriateam/archive/2010/08/19/odata-and-authentication-part-8-oauth-wrap.aspx)
QUESTION 97
You 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 use the ADO.NET Entity Framework Designer to model entities.
You add the following stored procedure to the database, and you add a function import to the model.
CREATE PROCEDURE [dbo].[InsertDepartment]
@Name nvarchar(50),
@ID int NULL OUTPUT
AS
INSERT INTO Department (Name) VALUES (@Name)
SELECT @ID = SCOPE_IDENTITY()
You need to insert a new department and display the generated ID.
Which code segment should you use?
A. using (SchoolEntities context = new SchoolEntities())
{
var id = new ObjectParameter(“ID”, typeof(int));
context.InsertDepartment(“Department 1”, id);
Console.WriteLine(id.Value);
}
B. using (SchoolEntities context = new SchoolEntities())
{
var id = context.InsertDepartment(“Department 1”, null);
Console.WriteLine(id);
}
C. using (SchoolEntities context = new SchoolEntities())
{
ObjectParameter id = null;
context.InsertDepartment(“Department 1”, id);
Console.WriteLine(id.Value);
}
D. using (SchoolEntities context = new SchoolEntities())
{
var id = new ObjectParameter(“ID”, null));
context.InsertDepartment(“Department 1”, id);
Console.WriteLine(id.Value);
}
Answer: A
Explanation:
Reference: http://blogs.microsoft.co.il/blogs/gilf/archive/2010/05/09/how-to-retrieve-stored-procedure-output-parametersin-entity-framework.aspx
QUESTION 98
You use Microsoft .NET Framework 4.0 to develop an ASP.NET Web application that connects to a Microsoft SQL Server 2008 database.
The application uses Integrated Windows authentication in Internet Information Services (IIS) to authenticate users.
A connection string named connString defines a connection to the database by using integrated security.
You need to ensure that a SqlCommand executes under the application pool’s identity on the database server.
Which code segment should you use?
A. using (var conn = new SqlConnection())
{
conn.ConnectionString = connString;
SqlCommand cmd = null;
using (HostingEnvironment.Impersonate())
{
cmd = new SqlCommand(“SELECT * FROM BLOG”, conn);
}
conn.Open();
var result = cmd.ExecuteScalar();
}
B. using (var conn = new SqlConnection(connString))
{
var cmd = new SqlCommand (“SELECT * FROM BLOG, conn);
conn.Open();
using(HostingEnvironment.Impersonate())
{
var result = cmd.ExecuteScalar();
}
}
C. using (var conn = new SqlConneccion())
{
using (HostingEnvironroent.Impersonate())
{
conn.ConnectionString = connString;
}
var cmd = new SqlCommand(“SELECT * FROM BLOG, conn);
conn.Open() ;
var result = cmd.ExecuteScalar();
}
D. using (var conn = new SqlConnection())
{
conn.ConnectionString = connString;
var cmd = new SqlCommand(“SELECT * FROM BLOG”, conn);
using (HostingEnvironment.Impersonate())
{
conn.Open();
}
var result = cmd.ExecuteScalar();
}
Answer: D
QUESTION 99
You use Microsoft .NET Framework 4.0 to develop an ASP.NET 4 Web application.
You need to encrypt the connection string information that is stored in the web.config file.
The application is deployed to multiple servers.
The encryption keys that are used to encrypt the connection string information must be exportable and importable on all the servers.
You need to encrypt the connection string section of the web.config file so that the file can be used on all of the servers.
Which code segment should you use?
A. Configuration config =
WebConfigurationManager.OpenWebConfiguration(“~”) ;
ConnectionStringsSection section =
(ConnectionStringsSection)config.GetSection(“connectionStrings”);
section.Sectionlnformation.ProtectSection
(“RsaProtectedConfigurationProvider”); config.Save();
B. Configuration config =
WebConfigurationManager.OpenMachineConfiguration(“~”);
ConnectionStringsSection section =
(ConnectionStringsSection)config.GetSection(“connectionStrings”);
section.Sectionlnformation.ProtectSection
(“RsaProtectedConfigurationProvider’*); config.Save();
C. Configuration config =
WebConfigurationHanager.OpenWebConfiguration (“~”) ;
ConnectionStringsSection section =
(ConnectionStringsSection)config.GetSection(“connectionStrings”) ;
section.Sectionlnformation.ProtectSection
(“DpapiProtectedConfigurationProvider”); config.Save ();
D. Configuration config =
WebConfigurationManager.OpenMachineConfiguration (“~”) ;
ConnectionStringsSection section =
(ConnectionStringsSection)config.GetSection(“connectionStrings”) ;
section.Sectionlnformation.ProtectSection
(“DpapiProtectedConfigurationProvider”); config.Save () ;
Answer: A
Explanation:
You encrypt and decrypt the contents of a Web.config file by using System.Configuration . DPAPIProtectedConfigurationProvider from the System.Configuration.dll assembly, which uses
the Windows Data Protection API (DPAPI) to encrypt and decrypt data, or by using 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 8 Developing Reliable Applications
Lesson 3: Protecting Your Data
Storing Encrypted Connection Strings in Web Applications (page 555)
QUESTION 100
You use Microsoft .NET Framework 4.0 and the Entity Framework to develop an application.
You create an Entity Data Model that has an entity named Customer.
You set the optimistic concurrency option for Customer.
You load and modify an instance of Customer named loadedCustomer, which is attached to an ObjectContext named context.
You need to ensure that if a concurrency conflict occurs during a save, the application will load up-to-date values from the database while preserving local changes.
Which code segment should you use?
A. try
{
context.SaveChanges();
}
catch(EntitySqlException ex)
{
context.Refresh(RefreshMode.StoreWins, loadedCustomer);
}
B. try
{
context.SaveChanges();
}
catch(OptimisticConcurrencyException ex)
{
context.Refresh(RefreshMode.ClientWins, loadedCustomer);
}
C. try
{
context.SaveChanges();
}
catch(EntitySqlException ex)
{
context.Refresh(RefreshMode.ClientWins, loadedCustomer);
}
D. try
{
context.SaveChanges();
}
catch(OptimisticConcurrencyException ex)
{
context.Refresh(RefreshMode.StoreWins, loadedCustomer);
}
Answer: B
Explanation:
EntitySqlException Represents errors that occur when parsing Entity SQL command text.
This exception is thrown when syntactic or semantic rules are violated.
System.Object
System.Exception
System.SystemException
System.Data.DataException
System.Data.EntityException
System.Data.EntitySqlException
OptimisticConcurrencyException
The exception that is thrown when an optimistic concurrency violation occurs.
System.Object
System.Exception
System.SystemException
System.Data.DataException
System.Data.UpdateException
System.Data.OptimisticConcurrencyException
Optimistic Concurrency (ADO.NET)
(http://msdn.microsoft.com/en-us/library/aa0416cz.aspx)
http://msdn.microsoft.com/en-us/library/system.data.objects.refreshmode.aspx
http://msdn.microsoft.com/en-us/library/bb738618.aspx
Braindump2go 100% Guarantees all the 70-516 286q are Real Exam Questions & Answers from Microsoft Official certification exams.We also provides long free updation for 70-516 Exam Dumps: 1 Year Free Updates – Downloaded Automatically on your computer to ensure you get updated pool of questions. Braindump2go trys best to make you feel confident in passing 70-516 Certifications Exam!
FREE DOWNLOAD: NEW UPDATED 70-516 PDF Dumps & 70-516 VCE Dumps from Braindump2go: http://www.braindump2go.com/70-516.html (286 Q&A)
Braindump2go | Testking | Pass4sure | Actualtests | Others | |
$99.99 | $124.99 | $125.99 | $189 | $29.99/$49.99 | |
Up-to-Dated | ✔ | ✖ | ✖ | ✖ | ✖ |
Real Questions | ✔ | ✖ | ✖ | ✖ | ✖ |
Error Correction | ✔ | ✖ | ✖ | ✖ | ✖ |
Printable PDF | ✔ | ✖ | ✖ | ✖ | ✖ |
Premium VCE | ✔ | ✖ | ✖ | ✖ | ✖ |
VCE Simulator | ✔ | ✖ | ✖ | ✖ | ✖ |
One Time Purchase | ✔ | ✖ | ✖ | ✖ | ✖ |
Instant Download | ✔ | ✖ | ✖ | ✖ | ✖ |
Unlimited Install | ✔ | ✖ | ✖ | ✖ | ✖ |
100% Pass Guarantee | ✔ | ✖ | ✖ | ✖ | ✖ |
100% Money Back | ✔ | ✖ | ✖ | ✖ | ✖ |