70-516 exam,dumps,study guides

Text-only Preview

Exam1pass
Easiest way to pass IT exams
Exam : 70-516


Title : TS: Accessing Data with
Microsoft .NET Framework 4





Version : DEMO









1. You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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
Exam1pass Help You Pass Any IT Exam
http://www.exam1pass.com

Exam1pass
Easiest way to pass IT exams
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

2. You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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.)
01Configuration config = ConfigurationManager.OpenExeConfiguration(exeConfigName);
02
03config.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;
Exam1pass Help You Pass Any IT Exam
http://www.exam1pass.com

Exam1pass
Easiest way to pass IT exams
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

3. You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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){
04Console.WriteLine(String.Format("Order: {0} ", order.SalesOrderNumber));
05 foreach (SalesOrderDetail item in order.SalesOrderDetail){
06Console.WriteLine(String.Format("Quantity: {0} ", item.Quantity));
07Console.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?
Exam1pass Help You Pass Any IT Exam
http://www.exam1pass.com

Exam1pass
Easiest way to pass IT exams
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

4.You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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.)
01AdventureWorksEntities context = New AdventureWorksEntities
(http://localhost:1234/AdventureWorks.svc );
02
03var q = from c in context.Customers
04where c.City == "London"
05orderby c.CompanyName
06select 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;
Exam1pass Help You Pass Any IT Exam
http://www.exam1pass.com

Exam1pass
Easiest way to pass IT exams
Answer: B

5.You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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.)
01public partial class SalesOrderDetail : EntityObject
02{
03partial 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: D

Exam1pass Help You Pass Any IT Exam
http://www.exam1pass.com