Microsoft Official Updated 70-516 Exam Dumps Questions Guarantee You 100% Success OR Braindump2go Promise Money Back! (181-190)

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 VE&70-516 PDF Dumps: http://www.braindump2go.com/70-516.html (286 Q&As)

2015 Latest released Microsoft Official 70-516 Practice Exam Question Free Download From Braindump2go Now! All New Updated 286 Questions And Answers are Real Questions from Microsoft Exam Center!

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 181
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 use Entity SQL of the ADO.NET Entity Framework to retrieve data from the database.
You need to define a custom function in the conceptual model.
You also need to ensure that the function calculates a value based on properties of the object.
Which two XML element types should you use? (Each correct answer presents part of the solution. Choose two.)

A.    Function
B.    FunctionImport
C.    Dependent
D.    Association
E.    DefiningExpression

Answer: AE
Explanation:
CHAPTER 6 ADO.NET Entity Framework
Lesson 1: What Is the ADO.NET Entity Framework?
Model-Defined Functions (page 413)

QUESTION 182
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You deploy a Windows Communication Foundation (WCF) Data Service to a production server.
The application is hosted by Internet Information Services (IIS).
After deployment, applications that connect to the service receive the following error message:
“The server encountered an error processing the request. See server logs for more details.”
You need to ensure that the actual exception data is provided to client computers.
What should you do?

A.    Modify the application’s Web.config file.
Set the value for the customErrors element to Off.
B.    Modify the application’s Web.config file.
Set the value for the customErrors element to RemoteOnly.
C.    Add the FaultContract attribute to the class that implements the data service.
D.    Add the ServiceBehavior attribute to the class that implements the data service.

Answer: D
Explanation:
Apply the ServiceBehaviorAttribute attribute to a service implementation to specify service-wide execution behavior.
The IncludeExceptionDetailInFaults property specifies whether unhandled exceptions in a service are returned as SOAP faults. This is for debugging purposes only.
ServiceBehavior Attribute
(http://msdn.microsoft.com/en-us/library/system.servicemodel.servicebehaviorattribute.aspx)
FaultContract Attribute
(http://msdn.microsoft.com/en-us/library/ms752208.aspx)
[ServiceContract(Namespace=”http://Microsoft.ServiceModel.Samples”)]
public interface ICalculator
{
[OperationContract]
int Add(int n1, int n2);
[OperationContract]
int Subtract(int n1, int n2);
[OperationContract]
int Multiply(int n1, int n2);
[OperationContract]
[FaultContract(typeof(MathFault))]
int Divide(int n1, int n2);
}
The FaultContractAttribute attribute indicates that the Divide operation may return a fault of type MathFault. A
fault can be of any type that can be serialized. In this case, the MathFault is a data contract, as follows:
[DataContract(Namespace=”http://Microsoft.ServiceModel.Samples”)] public class MathFault
{
private string operation;
private string problemType;
[DataMember]
public string Operation
{
get { return operation; }
set { operation = value; }
}
[DataMember]
public string ProblemType
{
get { return problemType; }
set { problemType = value; }
}
}

QUESTION 183
The application populates a DataSet object by using a SqlDataAdapter object.
You use the DataSet object to update the Categories database table in the database.
You write the following code segment. (Line numbers are included for reference only.)
01 SqlDataAdapter dataAdpater = new SqlDataAdapter(“SELECT CategoryID, CategoryName FROM Categories”, connection);
02 SqlCommandBuilder builder = new SqlCommandBuilder(dataAdpater);
03 DataSet ds = new DataSet();
04 dataAdpater.Fill(ds);
05 foreach (DataRow categoryRow in ds.Tables[0].Rows)
06 {
07      if (string.Compare(categoryRow[“CategoryName”].ToString(), searchValue, true) == 0)
08      {
09         …
10      }
11 }
12 dataAdpater.Update(ds);
You need to remove all the records from the Categories database table that match the value of the searchValue variable.
Which line of code should you insert at line 09?

A.    categoryRow.Delete();
B.    ds.Tables[0].Rows.RemoveAt(0);
C.    ds.Tables[0].Rows.Remove(categoryRow);
D.    ds.Tables[0].Rows[categoryRow.GetHashCode()].Delete();

Answer: A
Explanation:
DataRow Class
(http://msdn.microsoft.com/en-us/library/system.data.datarow.aspx)
DataRow.Delete() Deletes the DataRow.

QUESTION 184
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. (Click the Exhibit button.)
The application includes the following code segment. (Line numbers are included for reference only.)
01 using (AdventureWorksEntities advWorksContext = new AdventureWorksEntities()){
02   …
03 }
You need to retrieve a list of all Products from todays sales orders for a specified customer.
You also need to ensure that the application uses the minimum amount of memory when retrieving the list.
Which code segment should you insert at line 02?

A.    Contact customer = context.Contact.Where(“it.ContactID =
@customerId”, new ObjectParameter(“customerId”,
customerId)).First();
customer.SalesOrderHeader.Load();
foreach (SalesOrderHeader order in customer.SalesOrderHeader)
{
  order.SalesOrderDetail.Load();
  if (order.OrderDate.Date == DateTime.Today.Date)
  {
    foreach (SalesOrderDetail item in order.SalesOrderDetail)
    {
Console.WriteLine(String.Format(“Product: {0} “, item.ProductID));
    }
  }
}
B.    Contact customer = context.Contact.Where(“it.ContactID =
@customerId”, new ObjectParameter(“customerId”,
customerId)).First();
customer.SalesOrderHeader.Load();
foreach (SalesOrderHeader order in customer.SalesOrderHeader)
{
  if (order.OrderDate.Date == DateTime.Today.Date)
  {
    order.SalesOrderDetail.Load();
    foreach (SalesOrderDetail item in order.SalesOrderDetail)
    {
Console.WriteLine(String.Format(“Product: {0} “, item.ProductID));
    }
  }
}
C.    Contact customer =
(from contact in context.Contact.Include(“SalesOrderHeader”)
select contact).FirstOrDefault();
foreach (SalesOrderHeader order in customer.SalesOrderHeader)
{
  order.SalesOrderDetail.Load();
  if (order.OrderDate.Date == DateTime.Today.Date)
  {
    foreach (SalesOrderDetail item in order.SalesOrderDetail)
    {
Console.WriteLine(String.Format(“Product: {0} “, item.ProductID));
    }
  }
}
D.    Contact customer =
(from contact in context.Contact.Include
(“SalesOrderHeader.SalesOrderDetail”) select contact).
FirstOrDefault();
foreach (SalesOrderHeader order in customer.SalesOrderHeader)
{
  if (order.OrderDate.Date == DateTime.Today.Date)
  {
    foreach (SalesOrderDetail item in order.SalesOrderDetail)
    {
Console.WriteLine(String.Format(“Product: {0} “, item.ProductID));
    }
  }
}

Answer: B
Explanation:
A & C check the Order date after Order Detail, so we are retrieving more Order details than necessary
D is calling a Function (using eager loading) for the First Contact record only, so does not meet the requirements.

QUESTION 185
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application contains the following code segment. (Line numbers are included for reference only.)
01 class DataAccessLayer
02 {
03   private static string connString;
04   …
05   …
06   public static DataTable GetDataTable(string command){
07   …
08   …
09   }
10 }
You need to define the connection life cycle of the DataAccessLayer class.
You also need to ensure that the application uses the minimum number of connections to the database.
What should you do?

A.    Insert the following code segment at line 04.
private static SqlConnection conn = new SqlConnection(connString);
public static void Open()
{
   conn.Open();
}
public static void Close()
{
   conn.Close();
}
B.    Insert the following code segment at line 04.
private SqlConnection conn = new SqlConnection(connString);
public void Open()
{
   conn.Open();
}
public void Close()
{
   conn.Close();
}
C.    Replace line 01 with the following code segment.
class DataAccessLayer : IDisposable
Insert the following code segment to line 04.
private SqlConnection conn = new SqlConnection(connString);
public void Open()
{
   conn.Open();
}
public void Dispose()
{
   conn.Close();
}
D.    Insert the following code segment at line 07:
using (SqlConnection conn = new SqlConnection(connString))
{
   conn.Open();
}

Answer: D
Explanation:
One thing you should always do is to make sure your connections are always opened within a using statement.
Using statements will ensure that even if your application raises an exception while the connection is open, it will always be closed (returned to the pool) before your request is complete. This is very important, otherwise there could be connection leaks.

QUESTION 186
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 application contains two SqlCommand objects named cmd1 and cmd2.
You need to measure the time required to execute each command.
Which code segment should you use?

A.    Stopwatch w1 = new Stopwatch();
w1.Start();
cmd1.ExecuteNonQuery();
w1.Stop();
Trace.WriteLine(w1.ElapsedMilliseconds);
w1.Start();
cmd2.ExecuteNonQuery();
w1.Stop();
Trace.WriteLine(w1.ElapsedMilliseconds);
B.    Stopwatch w1 = new Stopwatch();
w1.Start();
cmd1.ExecuteNonQuery();
w1.Stop();
Trace.WriteLine(w1.ElapsedMilliseconds);
w1.Reset();
cmd2.ExecuteNonQuery();
w1.Stop();
Trace.WriteLine(w1.ElapsedMilliseconds);
C.    Stopwatch w1 = Stopwatch.StartNew();
cmd1.ExecuteNonQuery();
w1.Stop();
Trace.WriteLine(w1.ElapsedMilliseconds);
w1.Start();
cmd2.ExecuteNonQuery();
w1.Stop();
Trace.WriteLine(w1.ElapsedMilliseconds);
D.    Stopwatch w1 = Stopwatch.StartNew();
cmd1.ExecuteNonQuery();
w1.Stop();
Trace.WriteLine(w1.ElapsedMilliseconds);
w1 = Stopwatch.StartNew();
cmd2.ExecuteNonQuery();
w1.Stop();
Trace.WriteLine(w1.ElapsedMilliseconds);

Answer: D
Explanation:
A & C do not reset the stopwatch before running cmd2. B does not start the stopwatch after resetting the stopwatch Start() does not reset the stopwatch, whereas StartNew() will create a new instance of the Stop watch and initialise the elapsed time to Zero.
Stopwatch Class
(http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx)

QUESTION 187
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to two different Microsoft SQL Server 2008 database servers named Server1 and Server2.
A string named sql1 contains a connection string to Server1.
A string named sql2 contains a connection string to Server2.
01 using (TransactionScope scope = new
02    …
03 )
04 {
05   using (SqlConnection cn1 = new SqlConnection(sql1))
06   {
07     try{
08        …
09     }
10     catch (Exception ex)
11     {
12     }
13   }
14   scope.Complete();
15 }
You need to ensure that the application meets the following requirements:
– There is a SqlConnection named cn2 that uses sql2.
– The commands that use cn1 are initially enlisted as a lightweight
transaction.
The cn2 SqlConnection is enlisted in the same TransactionScope only if commands executed by cn1 do not throw an exception.
What should you do?

A.    Insert the following code segment at line 02.
TransactionScope(TransactionScopeOption.Suppress)
Insert the following code segment at line 08.
using (SqlConnection cn2 = new SqlConnection(sql2))
{
   try
   {
      cn2.Open();
      …
      cn1.Open();
      …
   }
   catch (Exception ex){}
}
B.    Insert the following code segment at line 02.
TransactionScope(TransactionScopeOption.Suppress)
Insert the following code segment at line 08.
cn1.Open();

using (SqlConnection cn2 = new SqlConnection(sql2))
{
  try
  {
      cn2.Open();
      …
  }
  catch (Exception ex){}
}
C.    Insert the following code segment at line 02.
TransactionScope(TransactionScopeOption.RequiresNew)
Insert the following code segment at line 08.
using (SqlConnection cn2 = new SqlConnection(sql2))
{
   try{
      cn2.Open();
      …
      cn1.Open();
      …
   }
   catch (Exception ex){}
}
D.    Insert the following code segment at line 02.
TransactionScope(TransactionScopeOption.RequiresNew)
Insert the following code segment at line 08.
cn1.Open();

using (SqlConnection cn2 = new SqlConnection(sql2))
{
   try
   {
      cn2.Open();
      …
   }
   catch (Exception ex){}
}

Answer: B
Explanation:
Seen in exam
Here cn1 is for the Ambient Transaction (i.e the lightweight or logical transaction) that will be used run the 2 transactions in the ambient scope.
If the cn1 transaction fails, then the requirement is for the cn2 transaction NOT to join the ambient transaction. It needs to run within its own independent transaction. This is achieved by using TransactionScopeOption.
Suppress.
If the cn2 transaction does NOT fail, then both transactions will run under the ambient Transaction.
TransactionScopeOption
Required A transaction is required by the scope. It uses an ambient transaction if one already exists. Otherwise, it creates a new transaction before entering the scope. This is the default value.
RequiresNew A new transaction is always created for the scope. Suppress The ambient transaction context is suppressed when creating the scope. All operations within the scope are done without an ambient transaction context.

QUESTION 188
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.
The conceptual schema definition language (CSDL) file contains the following XML fragment.
<EntityType Name=”Contact”>
  …
  <Property Name=”EmailPhoneComplexProperty” Type=”AdventureWorksModel.EmailPhone” Nullable=”false” />
</EntityType>

<ComplexType Name=”EmailPhone”>
  <Property Type=”String” Name=”EmailAddress” MaxLength=”50″ FixedLength=”false” Unicode=”true” />
  <Property Type=”String” Name=”Phone” MaxLength=”25″ FixedLength=”false” Unicode=”true” />
</ComplexType>
You write the following code segment. (Line numbers are included for reference only.)
01 using (EntityConnection conn = new EntityConnection(“name=AdvWksEntities”))
02 {
03   conn.Open();
04   string esqlQuery = @”SELECT VALUE contacts FROM
05                        AdvWksEntities.Contacts AS contacts
06                        WHERE contacts.ContactID == 3″;
07   using (EntityCommand cmd = conn.CreateCommand())
08   {
09     cmd.CommandText = esqlQuery;
10     using (EntityDataReader rdr = cmd.ExecuteReader())
11     {
12       while (rdr.Read())
13       {
14           …
15       }
16     }
17   }
18   conn.Close();
19 }
You need to ensure that the code returns a reference to a ComplexType entity in the model named EmailPhone.
Which code segment should you insert at line 14?

A.    int FldIdx = 0;
EntityKey key = record.GetValue(FldIdx) as EntityKey;
foreach (EntityKeyMember keyMember in key.EntityKeyValues)
{
return keyMember.Key + ” : ” + keyMember.Value;
}
B.    IExtendedDataRecord record = rdr[“EmailPhone”]as
IExtendedDataRecord;
int FldIdx = 0;
return record.GetValue(FldIdx);
C.    DbDataRecord nestedRecord = rdr[“EmailPhoneComplexProperty”]
as DbDataRecord;
return nestedRecord;
D.    int fieldCount =
rdr[“EmailPhone”].DataRecordInfo.FieldMetadata.Count;
for (int FldIdx = 0; FldIdx < fieldCount; FldIdx++)
{
  rdr.GetName(FldIdx);
  if (rdr.IsDBNull(FldIdx) == false)
  {
    return rdr[“EmailPhone”].GetValue(FldIdx).ToString();
}
}

Answer: C

QUESTION 189
You use Microsoft Visual Studio 2010 and Microsoft Entity Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server database.
You use the ADO.NET LINQ to SQL model to retrieve data from the database.
The applications contains the Category and Product entities as shown in the following exhibit:
You need to ensure that LINO to SQL executes only a single SQL statement against the database.
You also need to ensure that the query returns the list of categories and the list of products.
Which code segment should you use?

A.    using (NorthwindDataContext dc = new NorthwindDataContext()) {
   dc.ObjectTrackingEnabled = false;
   var categories = from c in dc.Categories
                           select c;
   foreach (var category in categories) {
      Console.WriteLine(“{0} has {1} products”,
category.CategoryName, category.Products.Count);
   }
}
B.    using (NorthwindDataContext dc = new NorthwindDataContext()) {
   dc.DeferredLoadingEnabled = false;
   DataLoadOptions dlOptions = new DataLoadOptions();
   dlOptions.LoadWith<Category>(c => c.Products);
   dc.LoadOptions = dlOptions;
   var categories = from c in dc.Categories
                           select c;
   foreach (var category in categories) {
      Console.WriteLine(“{0} has {1} products”,
category.CategoryName, category.Products.Count);
   }
}
C.    using (NorthwindDataContext dc = new NorthwindDataContext()) {
   dc.DeferredLoadingEnabled = false;
   var categories = from c in dc.Categories
                           select c;
   foreach (var category in categories) {
      Console.WriteLine(“{0} has {1} products”,
category.CategoryName, category.Products.Count);
   }
}
D.    using (NorthwindDataContext dc = new NorthwindDataContext()) {
   dc.DeferredLoadingEnabled = false;
   DataLoadOptions dlOptions = new DataLoadOptions();
   dlOptions.AssociateWith<Category>(c => c.Products);
   dc.LoadOptions = dlOptions;
   var categories = from c in dc.Categories
                           select c;
   foreach (var category in categories) {
      Console.WriteLine(“{0} has {1} products”,
category.CategoryName, category.Products.Count);
   }
}

Answer: B
Explanation:
DataLoadOptions Class Provides for immediate loading and filtering of related data. DataLoadOptions.LoadWith(LambdaExpression)
Retrieves specified data related to the main target by using a lambda expression.
You can retrieve many objects in one query by using LoadWith. DataLoadOptions.AssociateWith(LambdaExpression)
Filters the objects retrieved for a particular relationship.
Use the AssociateWith method to specify sub-queries to limit the amount of retrieved data.
DataLoadOptions Class
(http://msdn.microsoft.com/en-us/library/system.data.linq.dataloadoptions.aspx)
How to: Retrieve Many Objects At Once (LINQ to SQL)
(http://msdn.microsoft.com/en-us/library/Bb386917(v=vs.90).aspx)
How to: Filter Related Data (LINQ to SQL)
(http://msdn.microsoft.com/en-us/library/Bb882678(v=vs.100).aspx)

QUESTION 190
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.
You must retrieve a connection string.
Which of the following is the correct connection string?

A.    string connectionString =
ConfigurationSettings.AppSettings[“connectionString”];
B.    string connectionString =
ConfigurationManager.AppSettings[“connectionString”];
C.    string connectionString =
ApplicationManager.ConnectionStrings[“connectionString”];
D.    string connectionString =
ConfigurationManager.ConnectionStrings[“connectionString”].
ConnectionString;

Answer: D
Explanation:
CHAPTER 2 ADO.NET Connected Classes
Lesson 1: Connecting to the Data Store
Storing the Connection String in the Application Configuration File (page 75)


Braindump2go Promise All 70-516 Questions and Answers are the Latest Updated,we aim to provide latest and guaranteed questions for all certifications.You just need to be braved in trying then we will help you arrange all left things! 100% Pass All Exams you want Or Full Money Back! Do yo want to have a try on passing 70-516?


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