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)
Try 2015 Latet Updated 70-516 Practice Exam Questions and Answers, Pass 70-516 Actual Test 100% in 2015 New Year! Braindump2go Latest released Free Sample 70-516 Exam Questions are shared for instant download! Braindump2go holds the confidence of 70-516 exam candiates with Microsoft Official Guaranteed 70-516 Exa Dumps Products! 286 New Updated Questions and Answers! 2015 Microsoft 70-516 100% Success!
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 201
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 load records from the Customers table into a DataSet object named dataset.
You need to retrieve the value of the City field from the first and last records in the Customers table.
Which code segment should you use?
A. DataTable dt = dataset.Tables[“Customers”];
string first = dt.Rows[0][“City”].ToString();
string last = dt.Rows[dt.Rows.Count – 1][“City”].ToString();
B. DataTable dt = dataset.Tables[“Customers”];
string first = dt.Rows[0][“City”].ToString();
string last = dt.Rows[dt.Rows.Count][“City”].ToString();
C. DataRelation relationFirst = dataset.Relations[0];
DataRelation relationLast =
dataset.Relations[dataset.Relations.Count – 1];
string first = relationFirst.childTable.Columns[“City”].ToString();
string last = relationLast.childTable.Columns[“City”].ToString()
D. DataRelation relationFirst = dataset.Relations[0];
DataRelation relationLast =
dataset.Relations[dataset.Relations.Count];
string first = relationFirst.childTable.Columns[“City”].ToString();
string last = relationLast.childTable.Columns[“City”].ToString();
Answer: A
QUESTION 202
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 has two DataTable objects that reference the Customers and Orders tables in the database.
The application contains the following code segment. (Line numbers are included for reference only.)
01 DataSet customerOrders = new DataSet();
02 customerOrders.EnforceConstraints = true;
03 ForeignKeyConstraint ordersFK = new ForeignKeyConstraint(“ordersFK”,
04 customerOrders.Tables[“Customers”].Columns[“CustomerID”],
05 customerOrders.Tables[“Orders”].Columns[“CustomerID”]);
06 …
07 customerOrders.Tables[“Orders”].Constraints.Add(ordersFK);
You need to ensure that an exception is thrown when you attempt to delete Customer records that have related Order records.
Which code segment should you insert at line 06?
A. ordersFK.DeleteRule = Rule.SetDefault;
B. ordersFK.DeleteRule = Rule.None;
C. ordersFK.DeleteRule = Rule.SetNull;
D. ordersFK.DeleteRule = Rule.Cascade;
Answer: B
Explanation:
None No action taken on related rows, but exceptions are generated.
Cascade Delete or update related rows. This is the default.
SetNull Set values in related rows to DBNull.
SetDefault Set values in related rows to the value contained in the DefaultValue property. SetDefault specifies that all child column values be set to the default value.
CHAPTER 1 ADO.NET Disconnected Classes
Lesson 1: Working with the DataTable and DataSet Classes
Cascading Deletes and Cascading Updates (page 26)
QUESTION 203
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 a DataTable named OrderDetailTable that has the following columns:
– ID
– OrderID
– ProductID
– Quantity
– LineTotal
Some records contain a null value in the LineTotal field and 0 in the Quantity field.
You write the following code segment. (Line numbers are included for reference only.)
01 DataColumn column = new DataColumn(“UnitPrice”, typeof(double));
02 …
03 OrderDetailTable.Columns.Add(column);
You need to add a calculated DataColumn named UnitPrice to the OrderDetailTable object.
You also need to ensure that UnitPrice is set to 0 when it cannot be calculated.
Which code segment should you insert at line 02?
A. column.Expression = “LineTotal/Quantity”;
B. column.Expression = “LineTotal/ISNULL(Quantity, 1)”;
C. column.Expression = “if(Quantity > 0, LineTotal/Quantity, 0)”;
D. column.Expression = “iif(Quantity > 0, LineTotal/Quantity, 0)”;
Answer: D
Explanation:
IIF ( boolean_expression, true_value, false_value )
QUESTION 204
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 and contains a LINQ to SQL data model.
The data model contains a function named createCustomer that calls a stored procedure.
The stored procedure is also named createCustomer.
The createCustomer function has the following signature.
createCustomer (Guid customerID, String customerName, String address1)
The application contains the following code segment. (Line numbers are included for reference only.)
01 CustomDataContext context = new CustomDataContext();
02 Guid userID = Guid.NewGuid();
03 String address1 = “1 Main Steet”;
04 String name = “Marc”;
05 …
You need to use the createCustomer stored procedure to add a customer to the database.
Which code segment should you insert at line 05?
A. context.createCustomer(userID, customer1, address1);
B. context.ExecuteCommand(“createCustomer”, userID, customer1, address1);
Customer customer = new Customer() { ID = userID, Address1 = address1,
Name = customer1, };
C. context.ExecuteCommand(“createCustomer”, customer);
Customer customer = new Customer() { ID = userID, Address1 = address1,
Name = customer1, };
D. context.ExecuteQuery(typeof(Customer), “createCustomer”, customer);
Answer: A
QUESTION 205
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 the ADO.NET Entity Framework to manage persistence-ignorant entities.
You create an ObjectContext instance named context.
Then, you directly modify properties on several entities.
You need to save the modified entity values to the database.
Which code segment should you use?
A. context.SaveChanges(SaveOptions.AcceptAllChangesAfterSave);
B. context.SaveChanges(SaveOptions.DetectChangesBeforeSave);
C. context.SaveChanges(SaveOptions.None);
D. context.SaveChanges();
Answer: B
Explanation:
None Changes are saved without the DetectChanges or the AcceptAllChangesAfterSave() methods being called.
AcceptAllChangesAfterSave After changes are saved, the AcceptAllChangesAfterSave() method is called, which resets change tracking in the ObjectStateManager.
DetectChangesBeforeSave Before changes are saved, the DetectChanges method is called to
synchronize the property values of objects that are attached to the object context with data in the ObjectStateManager.
SaveOptions Enumeration
(http://msdn.microsoft.com/en-us/library/system.data.objects.saveoptions.aspx)
QUESTION 206
You develop a Microsoft .NET application that uses Entity Framework to store entities in a Microsft SQL Server 2008 database.
While the application is disconnected from the database, entities that are modified, are serialized to a local file.
The next time the application connects to the database, it retrieves the identity from the database by using an object context named context and stores the entity in a variable named remoteCustomer.
The application then serializes the Customer entity from the local file and stores the entity in a variable named localCustomer.
The remoteCustomer and the localCustomer variables have the same entity key.
You need to ensure that the offline changes to the Customer entity is persisted in the database when the ObjectContext.SaveChanges() method is called.
Which line of code should you use?
A. context.ApplyOriginalValues(“Customers”, remoteCustomer);
B. context.ApplyOriginalValues(“Customers”, localCustomer);
C. context.ApplyCurrentValues(“Customers”, remoteCustomer);
D. context.ApplyCurrentValues(“Customers”, localCustomer);
Answer: D
Explanation:
Reference: http://msdn.microsoft.com/en-us/library/dd487246.aspx
QUESTION 207
You use Microsoft .NET framework 4.0 to develop an application that connects to a Microsoft SQL Server 2008 database named AdventureWorksLT.
The database resides on an instance named INSTA on a server named SQL01.
You need to configure the application to connect to the database.
Which connection string should you add to the .config file?
A. Data Source=SQL01;
Initial Catalog=INSTA;
Integrated Security=true;
Application Name=AdventureWorksLT;
B. Data Source=SQL01;
Initial Catalog=AdventureWorksLT;
Integrated Security=true;
Application Name=INSTA;
C. Data Source=SQL01\INSTA;
Initial Catalog=AdventureWorksLT;
Integrated Security=true;
D. Data Source=AdventureWorksLT;
Initial Catalog=SQL01\INSTA;
Integrated Security=true;
Answer: C
QUESTION 208
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 context = new AdventureWorksEntities())
02 {
03 …
04 foreach (SalesOrderHeader order in customer.SalesOrderHeader)
05 {
06 Console.WriteLine(String.Format(“Order: {0} “, order.SalesOrderNumber));
07 foreach (SalesOrderDetail item in order.SalesOrderDetail)
08 {
09 Console.WriteLine(String.Format(“Quantity: {0} “, item.Quantity));
10 Console.WriteLine(String.Format(“Product: {0} “, item.Product.Name));
11 }
12 }
13 }
You want to list all the orders for a specific customer.
You need to ensure that the list contains following fields:
– Order number
– Quantity of products
– Product name
Which code segment should you insert in line 03?
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. Contact customer = (from contact in context.Contact.
Include(“SalesOrderHeader.SalesOrderDetail”)
select contact).FirstOrDefault();
D. Contact customer = (from contact in context.Contact.
Include(“SalesOrderHeader”)
select contact).FirstOrDefault();
Answer: A
QUESTION 209
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You are creating the data layer of the application.
You write the following code segment. (Line numbers are included for reference only.)
01 public static SqlDataReader GetDataReader(string sql)
02 {
03 SqlDataReader dr = null;
04 …
05 return dr;
06 }
You need to ensure that the following requirements are met:
– The SqlDataReader returned by the GetDataReader method can be used to
retreive rows from the database.
– SQL connections opened within the GetDataReader method will close when the SqlDataReader is closed.
Which code segment should you insert at the line 04?
A. using(SqlConnection cnn = new SqlConnection(strCnn))
{
try
{
SqlCommand cmd = new SqlCommand(sql, cnn);
cnn.Open();
dr = cmd.ExecuteReader();
}
catch
{
throw;
}
}
B. SqlConnection cnn = new SqlConnection(strCnn);
SqlCommand cmd = new SqlCommand(sql, cnn);
cnn.Open();
{
try
{
dr = cmd.ExecuteReader();
}
finally
{
cnn.Close();
}
}
C. SqlConnection cnn = new SqlConnection(strCnn);
SqlCommand cmd = new SqlCommand(sql, cnn);
cnn.Open();
{
try
{
dr = cmd.ExecuteReader();
cnn.Close();
}
catch
{
throw;
}
}
D. SqlConnection cnn = new SqlConnection(strCnn);
SqlCommand cmd = new SqlCommand(sql, cnn);
cnn.Open();
{
try
{
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
}
catch
{
cnn.Close();
throw;
}
}
Answer: D
Explanation:
CommandBehavior.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)
SqlCommand.ExecuteReader Method (CommandBehavior)
(http://msdn.microsoft.com/en-us/library/y6wy5a0f.aspx)
QUESTION 210
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses the Entity Framework.
The application has an entity model that includes SalesTerritory and SalesPerson entities as shown in the following diagram.
You need to calculate the total bonus for all sales people in each sales territory.
Which code segment should you use?
A. from person in model.SalesPersons
group person by person.SalesTerritory
into territoryByPerson
select new
{
SalesTerritory = territoryByPerson.Key,
TotalBonus = territoryByPerson.Sum(person => person.Bonus)
};
B. from territory in model.SalesTerritories
group territory by territory.SalesPerson
into personByTerritories
select new
{
SalesTerritory = personByTerritories.Key,
TotalBonus = personByTerritories.Key.Sum(person => person.Bonus)
};
C. model.SalesPersons
.GroupBy(person => person.SalesTerritory)
.SelectMany(group => group.Key.SalesPersons)
.Sum(person => person.Bonus);
D. model.SalesTerritories
.GroupBy(territory => territory.SalesPersons)
.SelectMany(group => group.Key)
.Sum(person => person.Bonus);
Answer: A
Latest 70-516 Questions and Answers from Microsoft Exam Center Offered by Braindump2go for Free Share Now! Read and remember all Real Questions Answers, Guaranteed Pass 70-516 Real Test 100% Or Full Money Back!
FREE DOWNLOAD: NEW UPDATED 70-516 PDF Dumps & 70-516 VCE Dumps from Braindump2go: http://www.braindump2go.com/70-516.html (286 Q&A)