Tag: 70-516

Veritas 70-516 Dumps, Latest Updated Veritas 70-516 Certification Online

Welcome to download the newest Pass4itsure PGMP dumps:

Veritas 70-516 certification exam for Cisco certification are easily out there on the internet. Now you need not hanker once the projection materials in the market. FLYDUMPS helps materialize your dreams of success with the very least effort. Veritas 70-516 exam sample questions are the option of all IT institutions who aspire to obtain Cisco certification. Flydumps Veritas 70-516 exam sample questions would be the best choice for your Veritas 70-516 certification Veritas 70-516 test. It must be clear that, with the Flydumps Veritas 70-516 exam sample questions you not merely get questions as you may well presume from Flydumps, but you would moreover get fit and accurate answers so this you get a firm grasp of the information. The Veritas 70-516 exam sample questions that we can provide are based on the extensive exploring and real-world experiences on our online trainers, with for the duration of 10 ages of IT and certification experience.

QUESTION 28
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You create a Data Access Layer (DAL) that is database-independent.
The DAL includes the following code segment. (Line numbers are included for reference only.)
01 static void ExecuteDbCommand(DbConnection connection) 02 {
03 if (connection != null){
04 using (connection){
05 try{
06 connection.Open();
07 DbCommand command = connection.CreateCommand();
08 command.CommandText = “INSERT INTO Categories (CategoryName) VALUES (‘Low Carb’)”;
09 command.ExecuteNonQuery();
10 }

12 catch (Exception ex){
13 Trace.WriteLine(“Exception.Message: ” + ex.Message);
14 }
15 }
16 }
17 }

You need to log information about any error that occurs during data access. You also need to log the data provider that accesses the database.
Which code segment should you insert at line 11?

A. catch (OleDbException ex){Trace.WriteLine(“ExceptionType: ” + ex.Source);Trace.WriteLine(“Message: ” + ex.Message);}
B. catch (OleDbException ex){Trace.WriteLine(“ExceptionType: ” + ex.InnerException.Source);Trace.WriteLine(“Message: ” + ex.InnerException.Message);}
C. catch (DbException ex){Trace.WriteLine(“ExceptionType: ” + ex.Source);Trace.WriteLine(“Message: ” + ex.Message); }
D. catch (DbException ex){Trace.WriteLine(“ExceptionType: ” + ex.InnerException.Source);Trace.WriteLine(“Message: ” + ex.InnerException.Message);}

Correct Answer: C Explanation
Explanation/Reference:
Explanation:

Exception.InnerException Gets the Exception instance that caused the current exception. Message Gets a message that describes the current exception.
Exception.Source Gets or sets the name of the application or the object that causes the error. OleDbException catches the exception that is thrown only when the
underlying provider returns a warning or error for an OLE DB data source.
DbException catches the common exception while accessing data base.

QUESTION 29
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Forms application. The application connects to a Microsoft SQL Server database.
You need to find out whether the application is explicitly closing or disposing SQL connections.
Which code segment should you use?
A. string instanceName = Assembly.GetEntryAssembly().FullName;PerformanceCounter perf = new PerformanceCounter(“.NET Data Provider for SqlServer”,”NumberOfReclaimedConnections”, instanceName, true);int leakedConnections = (int)perf.NextValue();
B. string instanceName = Assembly.GetEntryAssembly().GetName().Name;PerformanceCounter perf = new PerformanceCounter(“.NET Data Provider for SqlServer”,”NumberOfReclaimedConnections”, instanceName, true);int leakedConnections = (int)perf.NextValue();
C. string instanceName = Assembly.GetEntryAssembly().FullName;PerformanceCounter perf = new PerformanceCounter(“.NET Data Provider for SqlServer”,”NumberOfNonPooledConnections”, instanceName, true);int leakedConnections = (int)perf.NextValue();
D. string instanceName = Assembly.GetEntryAssembly().GetName().Name;PerformanceCounter perf = new PerformanceCounter(“.NET Data Provider for SqlServer”,”NumberOfNonPooledConnections”, instanceName, true);int leakedConnections = (int)perf.NextValue();

Correct Answer: A Explanation
Explanation/Reference:
Explanation:
NumberOfNonPooledConnections The number of active connections that are not pooled. NumberOfReclaimedConnections The number of connections that have been reclaimed through garbage collection where Close or Dispose was not called by the application. Not explicitly closing or disposing connections hurts performance. Use of ADO.NET performance counters
QUESTION 30
You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL Server 2008 database.
You add the following stored procedure to the database.
CREATE PROCEDURE GetProducts AS BEGIN SELECT ProductID, Name, Price, Cost FROM Product END
You create a SqlDataAdapter named adapter to execute the stored procedure. You need to fill a DataTable instance with the first 10 rows of the result set.
What are two possible code segments that you can use to achieve this goal? (Each correct answer presents a complete solution. Choose two.)
A. DataSet ds = new DataSet();adapter.Fill(ds, 0, 10, “Product”)
B. DataSet ds = new DataSet();DataTable dt = ds.Tables.Add(“Product”);adapter.Fill(0, 10, dt);
C. DataSet ds = new DataSet();DataTable dt = ds.Tables.Add(“Product”); dt.ExtendedProperties[“RowCount”] = 10; dt.ExtendedProperties[“RowIndex”] = 0; adapter.Fill(dt);
D. DataSet ds = new DataSet(); ds.ExtendedProperties[“RowCount”] = 10; ds.ExtendedProperties[“RowIndex”] = 0; adapter.Fill(ds);
Correct Answer: AB Explanation

Explanation/Reference:
Explanation:
Fill(Int32, Int32, DataTable()) Adds or refreshes rows in a DataTable to match those in the data source starting at the specified record and retrieving up to the specified maximum number of records. (Inherited from DbDataAdapter.) Fill(DataSet, Int32, Int32, String) Adds or refreshes rows in a specified range in the DataSet to match those in the data source using the DataSet and DataTable names. (Inherited from DbDataAdapter.) SqlDataAdapter Class
QUESTION 31
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Communication Foundation (WCF) Data Services service. You
You add the following code segment. (Line numbers are included for reference only.)

01 var uri = new Uri
02 var ctx = new NorthwindEntities(uri);
03 var categories = from c in ctx.Categories
04 select c;
05 foreach (var category in categories) {
06 PrintCategory(category);
07
08 foreach (var product in category.Products) {
09
10 PrintProduct(product);
11 }
12 }

You need to ensure that the Product data for each Category object is lazy-loaded.

What should you do?

A. Add the following code segment at line 07.ctx.LoadProperty(category, “Products”);
B. Add the following code segment at line 09.ctx.LoadProperty(product, “*”);
C. Add the following code segment at line 07.var strPrdUri = string.Format(“Categories({0})? $expand=Products”, category.CategoryID); var productUri = new Uri (strPrdUri, UriKind.Relative); ctx.Execute<Product>(productUri);
D. Add the following code segment at line 09.var strPrdUri = string.Format(“Products? $filter=CategoryID eq {0}”, category.CategoryID); var productUri = new Uri (strPrdUri, UriKind.Relative); ctx.Execute<Product>(productUri);

Correct Answer: A Explanation
Explanation/Reference:
Explanation:

LoadProperty(Object, String) Explicitly loads an object related to the supplied object by the specified navigation property and using the default merge option.
UriKind Enumeration
RelativeOrAbsolute The kind of the Uri is indeterminate.
Absolute The Uri is an absolute Uri.
Relative The Uri is a relative Uri.

QUESTION 32
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.

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();}}

Correct Answer: C Explanation
Explanation/Reference:
QUESTION 33
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server 2008 database. You create classes by using LINQ to SQL based on the records shown in the exhibit. (Click the Exhibit button.)

You need to create a LINQ query to retrieve a list of objects that contains the OrderID and CustomerID properties. You need to retrieve the total price amount of each Order record.
What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)
A. from details in dataContext.Order_Detailgroup details by details.OrderID into gjoin order in dataContext.Orders on g.Key equals order.OrderID select new {OrderID = order.OrderID, CustomerID = order.CustomerID,TotalAmount = g.Sum(od => od.UnitPrice * od.Quantity)}
B. dataContext.Order_Detail.GroupJoin(dataContext.Orders,d => d.OrderID,o => o.OrderID,(dts, ord) => new {OrderID = dts.OrderID,CustomerID = dts.Order.CustomerID,TotalAmount = dts.UnitPrice * dts.Quantity})
C. from order in dataContext.Orders group order by order.OrderID into gjoin details in dataContext.Order_Detail on g.Key equals details.OrderID select new {OrderID = details.OrderID,CustomerID = details.Order.CustomerID,TotalAmount = details.UnitPrice * details.Quantity}
D. dataContext.Orders.GroupJoin(dataContext.Order_Detail,o => o.OrderID,d => d.OrderID.(ord, dts) => new {OrderID = ord.OrderID,CustomerID = ord.CustomerID,TotalAmount = dts.Sum(od => od.UnitPrice * od.Quantity)})

Correct Answer: AD Explanation
Explanation/Reference:
Explanation:
Alterantive A. This is an Object Query. It looks at the Order Details EntitySet and creating a group g based on OrderID.

*
The group g is then joined with Orders EntitySet based on g.Key = OrderID
*
For each matching records a new dynamic object containing OrderID, CustomerID and TotalAmount is created.
*
The dynamic records are the results returned in an INumerable Object, for later processing Alterantive D. This is an Object Query. The GroupJoin method is
used to join Orders to OrderDetails.
Parameters for GroupJoin:

1.
An Order_Details EntitySet
2.
Order o (from the Orders in the Orders Entity Set, picking up Order_id from both Entity Sets)
3.
Order_ID from the first Order_Details record from the OD EnitySet
4.
Lamda Expression passing ord and dts (ord=o, dts=d) The body of the Lamda Expression is working out the total and Returning a Dynamic object as in A.

QUESTION 34
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. You use Entity SQL to retrieve data from the database.
You need to enable query plan caching.
Which object should you use?
A. EntityCommand
B. EntityConnection
C. EntityTransaction
D. EntityDataReader

Correct Answer: A Explanation
Explanation/Reference:
Explanation:

Whenever an attempt to execute a query is made, the query pipeline looks up its query plan cache to see whether the exact query is already compiled and
available. If so, it reuses the cached plan rather than building a new one. If a match is not found in the query plan cache, the query is compiled and cached.
A query is identified by its Entity SQL text and parameter collection (names and types). All text comparisons are case-sensitive.
Query plan caching is configurable through the EntityCommand. To enable or disable query plan caching through System.Data.EntityClient.EntityCommand.
EnablePlanCaching, set this property to true or false. Disabling plan caching for individual dynamic queries that are unlikely to be used more then once improves
performance.

You can enable query plan caching through EnablePlanCaching. Query Plan Caching
QUESTION 35
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server 2008 database. The database includes a database table named ProductCatalog as shown in the exhibit. (Click the Exhibit button.)

You add the following code segment to query the first row of the ProductCatalog table. (Line numbers are included for reference only.)

01 using (var cnx = new SqlConnection(connString))
02 {
03 var command = cnx.CreateCommand();
04 command.CommandType = CommandType.Text;
05 command.CommandText =”SELECT TOP 1 * FROM dbo.ProductCatalog”;
06 cnx.Open();
07 var reader = command.ExecuteReader();
08 if (reader.Read()) {
09 var id = reader.GetInt32(0);
10
11 reader.Close();
12 }
13 }
You need to read the values for the Weight, Price, and Status columns.

Which code segment should you insert at line 10?

A. var weight = reader.GetDouble(1); var price = reader.GetDecimal(2); var status = reader.GetBoolean(3);
B. var weight = reader. GetDecimal (1); var price = reader. GetFloat (2); var status = reader.GetByte(3);
C. var weight = reader.GetDouble(1); var price = reader.GetFloat(2); var status = reader.GetBoolean(3);
D. var weight = reader.GetFloat(1); var price = reader.GetDouble(2); var status = reader.GetByte(3);

Correct Answer: A Explanation
Explanation/Reference:
QUESTION 36
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application retrieves data from a Microsoft SQL Server 2008
database named AdventureWorks. The AdventureWorks.dbo.ProductDetails table contains a column named ProductImages that uses a varbinary(max) data type.

You write the following code segment. (Line numbers are included for reference only.)

01 SqlDataReader reader =
02 command.ExecuteReader(
03
04 );
05 while (reader.Read())
06 {
07 pubID = reader.GetString(0);
08 stream = new FileStream(
09 …
10 );
11 writer = new BinaryWriter(stream);
12 startIndex = 0;
13 retval = reader.GetBytes(1, startIndex, outByte, 0, bufferSize);
14 while (retval == bufferSize)
15 {
16 …
17 }
18 writer.Write(outByte, 0, (int)retval – 1);
19 writer.Flush();
20 writer.Close();
21 stream.Close();
22 }

You need to ensure that the code supports streaming data from the ProductImages column.

Which code segment should you insert at line 03?

A. CommandBehavior.Default
B. CommandBehavior.KeyInfo
C. CommandBehavior.SingleResult
D. CommandBehavior.SequentialAccess
Correct Answer: D Explanation

Explanation/Reference:
Explanation:
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(). 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.
SingleResult The query returns a single result set.
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.
CommandBehavior Enumeration
QUESTION 37
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application.

The application contains the following XML document.

<bib>
<book title=”TCP/IP Illustrated” year=”1994″>
<author> Author1 </author>
</book>
<book title=”Programming in Unix” year=”1992″>
<author> Author1 </author>
<author> Author2 </author>
<author> Author3 </author>
</book>
<book title=”Data on the Web” year=”2000″>
<author> Author4 </author>
<author> Author3 </author>
</book>
</bib>

You add the following code fragment. (Line numbers are included for reference only.)

01 public IEnumerable<XElement> GetBooks(string xml)
02 {
03 XDocument doc = XDocument.Parse(xml);
04
05 }

You need to return a list of book XML elements that are authored by Author1.

Which code segment should you insert at line 04?

A. return doc.Element(“bib”).Elements().SelectMany(e1 => e1.Elements().Where(e2 => e2 .Equals(new XElement(“author”,” Author1 “))));
B. return doc.Element(“bib”).Elements().SelectMany(e1 => e1.Elements().Where(e2 => (string)e2 == ” Author1 “));
C. return doc.Element(“bib”).Elements().Where(e1 => e1.Elements().Any(e2 => (string)e2 == ” Author1 “));
D. return doc.Element(“bib”).Elements().Where(e1=> e1.Elements().Any(e2 => e2 .Equals(new XElement(“author”,”Author1″))));

Correct Answer: C Explanation
Explanation/Reference:
QUESTION 38
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. You use the following SQL statement to retrieve an instance of a DataSet object named ds:
SELECT CustomerID, CompanyName, ContactName, Address, City FROM dbo.Customers
You need to query the DataSet object to retrieve only the rows where the ContactName field is not NULL.
Which code segment should you use?
A. from row in ds.Tables[0].AsEnumerable()where (string)row[“ContactName”] != nullselect row;
B. from row in ds.Tables[0].AsEnumerable()where row.Field<string>(“ContactName”) != nullselect row;
C. from row in ds.Tables[0].AsEnumerable()where !row.IsNull((string)row[“ContactName”])select row;
D. from row in ds.Tables[0].AsEnumerable()where !Convert.IsDBNull(row.Field<string>(” ContactName “))select row;
Correct Answer: B Explanation

Explanation/Reference:
Explanation:
Field<T>(DataRow, String) Provides strongly-typed access to each of the column values in the specified row. The Field method also supports nullable types.
QUESTION 39
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application that will access a WCF data service. The solution contains the projects shown in the following table.

The WCF data service exposes an Entity Framework model.
You need to access the service by using a WCF Data Services client. What should you do in the Application.Client project?
A. Add a reference to the Application.Model project.
B. Add a reference to the Application.Service project.
C. Add a service reference that uses the URL of the WCF data service.
D. Add a Web reference that uses the URL of the WCF data service. Correct Answer: C

Explanation Explanation/Reference:
QUESTION 40
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 need to create a database from your model. What should you do?
A. Run the edmgen.exe tool in FullGeneration mode.
B. Run the edmgen.exe tool in FromSSDLGeneration mode.
C. Use the Update Model Wizard in Visual Studio.
D. Use the Generate Database Wizard in Visual Studio. Run the resulting script against a Microsoft SQL Server database. Correct Answer: D

Explanation Explanation/Reference:
Explanation:
To update the database, right-click the Entity Framework designer surface and choose Generate Database From Model. The Generate Database Wizard produces a SQL script file that you can edit and execute.
QUESTION 41
You use the Microsoft .NET Framework 4 Entity Framework to develop an application that contains an Entity Data Model for the following database tables.

You need to ensure that the entity that is mapped to the ContentTypeDerived table derives from the entity that is mapped to the ContentTypeBase table.
What should you do?
A. Use a Table-Per-Type mapping method.
B. Use a Table-Per-Hierarchy mapping method.
C. Create a function import for each entity.
D. Create a complex type for each entity.

Correct Answer: A Explanation
Explanation/Reference:
QUESTION 42
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to enhance an existing application to use the Entity Framework. The classes that represent the entities in the model are Plain Old CLR Object (POCO) classes.
You need to connect the existing POCO classes to an Entity Framework context.
What should you do?
A. 1. Generate a MetadataWorkspace and create an ObjectContext for the model. 2. Disable proxy object creation on the ContextOptions of the ObjectContext. 3. Enable lazy loading on the ContextOptions of the ObjectContext.
B. 1. Generate a MetadataWorkspace and create an ObjectContext for the model. 2. Create an ObjectSet for the POCO classes. 3. Disable proxy object creation on the ContextOptions of the ObjectContext.
C. 1. Generate an Entity Data Model for the POCO classes. 2. Create an ObjectSet for the POCO classes. 3. Disable proxy object creation on the ContextOptions of the ObjectContext. 4. Enable lazy loading on the ContextOptions of the ObjectContext.
D. 1. Generate an Entity Data Model for the POCO classes. 2. Create an ObjectSet for the POCO classes. 3. Set Code Generation Strategy on the Entity Data Model to none. 4. Create an ObjectContext for the model.

Correct Answer: D Explanation
Explanation/Reference:
QUESTION 43
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. The model includes the entity shown in the following exhibit.

You need to add a function that returns the number of years since a person was hired.
You also need to ensure that the function can be used within LINQ to Entities queries.
What should you do?
A. Add the following code fragment to the .edmx file. <Function Name=”YearsSinceNow” ReturnType=”Edm.Int32″><Parameter Name=”date” Type=”Edm.DateTime” /><DefiningExpression>Year(CurrentDateTime()) – Year(date)</DefiningExpression></Function>Add the following function to the entity class definition. [EdmComplexType(“SchoolModel”, “YearsSinceNow”)]public static int YearsSinceNow(DateTime date){throw new NotSupportedException (“Direct calls are not supported.”);}
B. Add the following code fragment to the .edmx file. <Function Name=”YearsSinceNow” ReturnType=”Edm.Int32″><Parameter Name=”date” Type=”Edm.DateTime” /><DefiningExpression>Year(CurrentDateTime()) – Year(date)</DefiningExpression></Function>Add the following function to the entity class definition. [EdmFunction(“SchoolModel”, “YearsSinceNow”)] public static int YearsSinceNow(DateTime date){throw new NotSupportedException(“Direct calls are not supported.”);}
C. Add the following code fragment to the .edmx file. <Function Name=”YearsSinceNow” ReturnType=”Edm.Int32″><Parameter Name=”date” Type=”Edm.DateTime” /></Function>Add the following function to the entity class definition. [EdmFunction(“SchoolModel”, “YearsSinceNow”)] public static int YearsSinceNow(DateTime date) {return Year(CurrentDateTime() – Year(date)); }
D. Use the Entity Data Model Designer to create a complex property named YearsSinceNow that can be accessed through the LINQ to Entities query at a later time.

Correct Answer: B Explanation
Explanation/Reference:
Explanation:

How to: Call Model-Defined Functions in Queries

QUESTION 44
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. You use the ADO.NET Entity Framework to model entities.
You need to add a new type to your model that organizes scalar values within an entity.
You also need to map stored procedures for managing instances of the type.
What should you do?
A. Add the stored procedures in the SSDL file along with a Function attribute. Define a complex type in the CSDL file. Map the stored procedure in the MSL file with a ModificationFunctionElement.
B. Add the stored procedures in the SSDL file along with a Function attribute. Define a complex type in the CSDL file. Map the stored procedure in the MSL file with an AssociationEnd element.
C. Use the edmx designer to import the stored procedures. Derive an entity class from the existing entity as a complex type. Map the stored procedure in the MSL file with an AssociationEnd element.
D. Add the stored procedures in the SSDL file along with a Function attribute. Derive an entity class from the existing entity as a complex type. Map the stored procedure in the MSL file with a ModificationFunctionElement.

Correct Answer: A Explanation
Explanation/Reference:
Explanation:
EndProperty Element (MSL)
QUESTION 45
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application that uses the Entity Framework.
You need to execute custom logic when an entity is attached to the ObjectContext.
What should you do?
A. Create a partial method named OnStateChanged in the partial class for the entity.
B. Create a partial method named OnAttached in the partial class for the entity.
C. Create an event handler to handle the ObjectStateManagerChanged event.
D. Create an event handler to handle the ObjectMaterialized event.
Correct Answer: C Explanation

Explanation/Reference:
Explanation:
ObjectStateManagerChanged Occurs when entities are added to or removed from the state manager. ObjectMaterialized Occurs when a new entity object is created from data in the data source as part of a query or load operation. ObjectStateManagerChanged Event
ObjectMaterialized Event
QUESTION 46
You use Microsoft Visual Studio 2010 and Microsoft ADO.NET Framework 4 to create an application. The application connects to a Microsoft SQL Server 2008 database.
You use the ADO.NET LINQ to SQL model to retrieve data from the database. You use stored procedures to return multiple result sets. You need to ensure that the result sets are returned as strongly typed values.
What should you do?
A. Apply the FunctionAttribute and ResultTypeAttribute to the stored procedure function. Use the GetResult<TElement> method to obtain an enumerator of the correct type.
B. Apply the FunctionAttribute and ParameterAttribute to the stored procedure function and directly access the strongly typed object from the results collection.
C. Apply the ResultTypeAttribute to the stored procedure function and directly access the strongly typed object from the results collection.
D. Apply the ParameterAttribute to the stored procedure function. Use the GetResult<TElement> method to obtain an enumerator of the correct type.

Correct Answer: A Explanation
Explanation/Reference:
Explanation:

You must use the IMultipleResults.GetResult<TElement> Method pattern to obtain an enumerator of the correct type, based on your knowledge of the stored
procedure. FunctionAttribute Associates a method with a stored procedure or user-defined function in the database.
IMultipleResults.GetResult<TElement> Method
QUESTION 47
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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 application contains the Category and Product entities, as shown in the following exhibit.

You need to ensure that LINQ to SQL executes only a single SQL statement against the database.
You also need to ensure that the query retrieves 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.Categoriesselect 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.Categoriesselect 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.Categoriesselect 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.Categoriesselect c;foreach (var category in categories){Console.WriteLine(“{0} has {1} products”, category.CategoryName, category.Products.Count);}}

Correct Answer: B Explanation
Explanation/Reference:
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

QUESTION 48
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application. You use the Entity Framework Designer to create an Entity Data
Model from an existing database by using the Generate from database wizard.
The model contains an entity type named Product. The Product type requires an additional property that is not mapped to a database column.
You need to add the property to Product.
What should you do?

A. Add the property in the generated class file, and select Run Custom Tool from the solution menu.
B. Add the property in a partial class named Product in a new source file.
C. Create a complex type with the name of the property in the Entity Framework Designer.
D. Create a function import with the name of the property in the Entity Framework Designer. Correct Answer: B

Explanation Explanation/Reference:
QUESTION 49
You use Microsoft .NET Framework 4 to develop an ASP.NET application. The application uses Integrated Windows authentication. The application accesses data
in a Microsoft SQL Server 2008 database that is located on the same server as the application.
You use the following connection string to connect to the database.
Integrated Security=SSPI; Initial Catalog=AdventureWorks;
The application must also execute a stored procedure on the same server on a database named pubs.
Users connect to the ASP.NET application through the intranet by using Windows-based authentication.
You need to ensure that the application will use connection pooling whenever possible and will keep the number of pools to a minimum.
Which code segment should you use?

A. command.CommandText = “USE [pubs]; exec uspLoginAudit;”; using (SqlConnection connection = new SqlConnection(“Initial Catalog=AdventureWorks; Integrated Security=SSPI;MultipleActiveResultSets=True”)){connection.Open();command.ExecuteNonQuery();}
B. command.CommandText = “exec uspLoginAudit;”;using (SqlConnection connection = new SqlConnection(“Integrated Security=SSPI; Initial Catalog=pubs”)) {connection.Open();command.ExecuteNonQuery();}
C. command.CommandText = “USE [pubs]; exec uspLoginAudit;”;using (SqlConnection connection = new SqlConnection( “Integrated Security=SSPI; Initial Catalog=AdventureWorks”)) {connection.Open();command.ExecuteNonQuery();}
D. command.CommandText = “exec uspLoginAudit;”; using (SqlConnection connection = new SqlConnection(“Integrated Security=SSPI;”)){connection.Open ();command.ExecuteNonQuery();}

Correct Answer: C Explanation
Explanation/Reference:
Explanation:
Working with Multiple Active Result Sets
QUESTION 50
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server 2008
database.
The application uses a Microsoft ADO.NET SQL Server managed provider. When a connection fails, the application logs connection information, including the full
connection string. The information is stored as plain text in a .config file.

You need to ensure that the database credentials are secure. Which connection string should you add to the .config file?
A. Data Source=myServerAddress; Initial Catalog=myDataBase; Integrated Security=SSPI; Persist Security Info=true;
B. Data Source=myServerAddress; Initial Catalog=myDataBase; User Id = myUsername; Password = myPassword; Persist Security Info=false;
C. Data Source=myServerAddress; Initial Catalog=myDataBase; Integrated Security=SSPI; Persist Security Info=false;
D. Data Source=myServerAddress; Initial Catalog=myDataBase; User Id = myUsername; Password = myPassword; Persist Security Info=true;

Correct Answer: C Explanation Explanation/Reference:
Explanation:
Persist Security Info
Default: ‘false’
When set to false or no (strongly recommended), security-sensitive information, such as the password, is not returned as part of the connection if the connection is
open or has ever been in an open state. Resetting the connection string resets all connection string values including the password.
Recognized values are true, false, yes, and no.

QUESTION 51
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 LINQ to SQL model to retrieve data from the database.
The application will not modify retrieved data.
You need to ensure that all the requested data is retrieved.
You want to achieve this goal using the minimum amount of resources. What should you do?
A. Set DeferredLoadingEnabled to true on the DataContext class.
B. Set DeferredLoadingEnabled to false on the DataContext class.
C. Set ObjectTrackingEnabled to true on the DataContext class.
D. Set ObjectTrackingEnabled to false on the DataContext class.

Correct Answer: D Explanation
Explanation/Reference:
Explanation:
Setting property ObjectTrackingEnabled to false improves performance at retrieval time, because there are fewer items to track. DataContext.ObjectTrackingEnabled Property
QUESTION 52
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application contains the following XML document.

< feed >
< title > Products < /title >
< entry >
< title > Entry title 1 < /title >
< author > Author1 < /title >
< content >
< properties >
< description > some description < /description >
< n otes > some notes < /notes >
< comments > some comments < /comments >
< /properties >
< /content >
< /entry >

< /feed >

You plan to add localization features to the application.

You add the following code segment. (Line numbers are included for reference only.)
01 public IEnumerable < XNode > GetTextNodesForLocalization(XDocument doc)
02 {
03
04 return from n in nodes
05 where n.NodeType == XmlNodeType.Text
06 select n;
07 }

You need to ensure that the GetTextNodesForLocalization method returns all the XML text nodes of the document.

Which code segment should you insert at line 03?

A. IEnumerable < XNode > nodes = doc.DescendantNodes();
B. IEnumerable < XNode > nodes = doc.Nodes();
C. IEnumerable < XNode > nodes = doc.Descendants();
D. IEnumerable < XNode > nodes = doc.NodesAfterSelf();

Correct Answer: A Explanation
Explanation/Reference:
Explanation:

DescendantNodes() Returns a collection of the descendant nodes for this document or element, in document order.
Descendants() Returns a collection of the descendant elements for this document or element, in document order.
Nodes() Returns a collection of the child nodes of this element or document, in document order. NodesAfterSelf() Returns a collection of the sibling nodes after
this node, in document order

QUESTION 53
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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. Add the ServiceBehavior attribute to the class that implements the data service.
B. Add the FaultContract attribute to the class that implements the data service.
C. Modify the applications Web.config file. Set the value for the customErrors element to Off.
D. Modify the applications Web.config file. Set the value for the customErrors element to RemoteOnly.
Correct Answer: A Explanation

Explanation/Reference:
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

{
[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=
{
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 54
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server 2008 database.
You need to use a spatial value type as a parameter for your database query.
What should you do?
A. Set the parameters SqlDbType to Udt. Set the parameters UdtTypeName to GEOMETRY.
B. Set the parameters SqlDbType to Binary.
C. Set the parameters SqlDbType to Variant.
D. Set the parameters SqlDbType to Structured. Set the parameters TypeName to GEOMETRY.

Correct Answer: A Explanation
Explanation/Reference:
Explanation:

There are two types of spatial data. The geometry data type supports planar, or Euclidean (flat-earth), data.
The geometry data type conforms to the Open Geospatial Consortium (OGC) Simple Features for SQL Specification version 1.1.0.
In addition, SQL Server supports the geography data type, which stores ellipsoidal (round-earth) data, such as GPS latitude and longitude coordinates.
SqlParameter.UdtTypeName Gets or sets a string that represents a user-defined type as a parameter.
CHAPTER 2 ADO.NET Connected Classes
Lesson 2: Reading and Writing Data
Working with SQL Server User-Defined Types (UDTs) (page 105) Spatial types
QUESTION 55
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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);
Correct Answer: C Explanation Explanation/Reference:

Explanation:
Table Mapping in ADO.NET
Veritas 70-516 exam is very adapted to the people who are interesting in the information technology domain. If you want to get the higher level, you not only to take part in the Veritas 70-516 exam sample questions in FLYDUMPS, but also other Veritas 70-516 certification. The FLYDUMPS prepares many certifications for people. Find the upgrade versions of Veritas 70-516 exam science, latest Veritas 70-516 questions and Veritas 70-516 pdf exam. With FLYDUMPS Veritas 70-516 exam sample questions, your success is guaranteed. There must be your acquisitive. This will present you with facts that you simply need to get success the exam.

Welcome to download the newest Pass4itsure PGMP dumps: http://www.pass4itsure.com/PGMP.html

ISEB ISEB-ITILF Practice, Prompt Updates ISEB ISEB-ITILF Study Material For Sale

Microsoft 70-516 Practise Questions, Buy Latest Microsoft 70-516 Certification Exams Guaranteed Success

Flydumps bring you the best Microsoft 70-516 exam preparation materials which will make you pass in the first attempt.And we also provide you all the Microsoft 70-516 exam updates as Flydumps announces a change in its Microsoft 70-516 exam syllabus,we inform you about it without delay.

QUESTION 1
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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 : IDisposableInsert 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(); }
Correct Answer: D Explanation
Explanation/Reference:
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 closedreturned to the pool) before your
request is complete. This is very important, otherwise there could be connection leaks.

QUESTION 2
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Communication Foundation (WCF) Data Services service.
You discover that when an application submits a PUT or DELETE request to the Data Services service, it receives an error.
You need to ensure that the application can access the service.
Which header and request type should you use in the application?
A. an X-HTTP-Method header as part of a POST request
B. an X-HTTP-Method header as part of a GET request
C. an HTTP ContentType header as part of a POST request
D. an HTTP ContentType header as part of a GET request
Correct Answer: A Explanation
Explanation/Reference:
Explanation:
The X-HTTP-Method header can be added to a POST request that signals that the server MUST process the request not as a POST, but as if the HTTP verb specified as the value of the header was used as the method on the HTTP request’s request line, as specified in [RFC2616] section 5.1. This technique is often referred to as “verb tunneling”. This header is only valid when on HTTP POST requests. X-HTTPMethod (http://msdn.microsoft.com/en-us/library/dd541471(v=prot.10).aspx)
QUESTION 3
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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.
Correct Answer: C Explanation Explanation/Reference:
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 4
You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL Server 2008 database by using SQL Server authentication. The application contains the following connection string. SERVER=DBSERVER-01; DATABASE=pubs; uid=sa; pwd=secret; You need to ensure that the password value in the connection string property of a SqlConnection object does not exist after the Open method is called.
What should you add to the connection string?
A. Persist Security Info=True
B. Trusted_Connection=True
C. Persist Security Info=False
D. Trusted_Connection=False
Correct Answer: C Explanation
Explanation/Reference:
Explanation:

The Persist Security Info property specifies whether the data source can persist sensitive authentication information such as a password.
Persist Security Info Property
(http://msdn.microsoft.com/en-us/library/aa214039(v=sql.80).aspx)

QUESTION 5
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 manage order data. The application makes a Web service call to obtain orders from an order-tracking system.
You need to ensure that the orders are added to the local data store.
Which method should you call on the ObjectContext?
A. Attach
B. AttachTo
C. AddObject
D. ApplyCurrentValues
Correct Answer: C Explanation
Explanation/Reference:
Explanation:
ObjectContext.AddObject() Call AddObject on the ObjectContext to add the object to the object context. Do this when the object is a new object that does not yet exist in the data source. ObjectContext.Attach() Call Attach on the ObjectContext to attach the object to the object context. Do this when the object already exists in the data source but is currently not attached to the context. If the object being attached has related objects, those objects will also be attached to the object context. Objects are added to the object context in an unchanged state. 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. ObjectContext.AttachTo() Call AttachTo on the ObjectContext to attach the object to a specific entity set in the object context or if the object has a null (Nothing in Visual Basic) EntityKey value. The object being attached is not required to have an EntityKey associated with it. If the object does not have an entity key, then entitySetName cannot be an empty string. ApplyCurrentValues<TEntity>() method is used to apply changes that were made to objects outside the ObjectContext, such as detached objects that are received by a Web service. The method copies the scalar values from the supplied object into the object in the ObjectContext that has the same key. You can use the EntityKey of the detached object to retrieve an instance of this object from the data source.
QUESTION 6
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. (Click the Exhibit button.)

The application includes the following code segment. (Line numbers are included for reference only.)
01 using (AdventureWorksEntities advWorksContext = new AdventureWorksEntities()){ 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 [email protected]”, 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 [email protected]”, 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));}}}

Correct Answer: B Explanation
Explanation/Reference:
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 7
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Microsoft ASP.NET application.
You want to connect the application to a Microsoft SQL Server Express 2008 database named MyDatabase. The primary database file is named MyDatabase.mdf and it is stored in the App_Data folder.
You need to define the connection string.
Which connection string should you add to the Web.config file?
A. Data Source=localhost; Initial Catalog=MyDataBase; Integrated Security=SSPI; User Instance=True
B. Data Source=.\SQLEXPRESS; Initial Catalog=MyDataBase; Integrated Security=True; User Instance=True
C. Data Source=.\SQLEXPRESS; AttachDbFilename=|DataDirectory|\MyDatabase.mdf; Integrated Security=True; User Instance=True
D. Data Source=SQLEXPRESS; AttachDbFilename=|DataDirectory|\App_Data\MyDatabase.mdf; Integrated Security=SSPI; User Instance=True
Correct Answer: C Explanation
Explanation/Reference:
Explanation:
CHAPTER 2 ADO.NET Connected Classes Lesson 1: Connecting to the Data Store Attaching to a Local SQL Database File with SQL Express (page 73)
QUESTION 8
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.)

01 AdventureWorks Entities context = new AdventureWorksEntities (
02 ” http://localhost:1234/AdventureWorks.svc ”
03 );
04
05 var q = from c in context.Customers
06 where c.City == “London”
07 orderby c.CompanyName
08 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 04?

A. context.MergeOption = MergeOption.AppendOnly;
B. context.MergeOption = MergeOption.PreserveChanges;
C. context.MergeOption = MergeOption.OverwriteChanges;
D. context.MergeOption = MergeOption.NoTracking;
Correct Answer: B Explanation
Explanation/Reference:
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 9
You use Microsoft .NET Framework 4 to develop an application. The configuration file contains the following code segment.

<configuration>
<connectionStrings>
<add name=”AdventureWorksLT”
connectionString=”Data Source=SQL01;
Initial Catalog=AdventureWorksLT;
Integrated Security=True;”
providerName=”System.Data.SqlClient”/>
</connectionStrings>
</configuration>

You need to retrieve the connection string named AdventureWorksLT from the configuration file.

Which line of code should you use?

A. var connectionString = ConfigurationManager .ConnectionStrings[“AdventureWorksLT”].ConnectionString;
B. var connectionString = ConfigurationManager .ConnectionStrings[“AdventureWorksLT”].Name;
C. var connectionString = ConfigurationManager.AppSettings[“AdventureWorksLT”];
D. var connectionString = ConfigurationSettings.AppSettings[“AdventureWorksLT”];
Correct Answer: A Explanation
Explanation/Reference:
QUESTION 10
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL Server 2008 database.
The application includes a SqlConnection named conn and a SqlCommand named cmd. You need to create a transaction so that database changes will be reverted in the event that an exception is thrown.
Which code segment should you use?
A. var transaction = conn.BeginTransaction();cmd.Transaction = transaction;try{… transaction.Commit();}catch{transaction.Rollback();}
B. var transaction = conn.BeginTransaction();cmd.Transaction = transaction;try{… transaction.Commit();}catch{transaction.Dispose();}
C. var transaction = conn.BeginTransaction();cmd.Transaction = transaction;try{…}catch{transaction.Commit();}
D. var transaction = conn.BeginTransaction();cmd.Transaction = transaction;try{… transaction.Rollback();}catch{transaction.Dispose ();}
Correct Answer: A Explanation
Explanation/Reference:
QUESTION 11
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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”;
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, name , address1)
B. context.ExecuteCommand(“createCustomer”, userID, name , address1);
C. Customer customer = new Customer() {ID = userID,Address1 = address1,Name = name,}; context.ExecuteCommand(“createCustomer”, customer);
D. Customer customer = new Customer() {ID = userID,Address1 = address1,Name = name, }; context.ExecuteQuery(typeof(Customer), “createCustomer”, customer);
Correct Answer: A Explanation
Explanation/Reference:
Explanation:
CHAPTER 4 LINQ to SQL Lesson 3: Submitting Changes to the Database Using Stored Procedures (page 285)
QUESTION 12
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You use a TableAdapter object to load a DataTable object. The
DataTable object is used as the data source for a GridView control to display a table of customer information on a Web page. You need to ensure that the
application meets the following requirements:
Load only new customer records each time the page refreshes.
Preserve existing customer records.

What should you do?

A. Set the ClearBeforeFill property of the TableAdapter to false. Use the Fill method of the TableAdapter to load additional customers.
B. Set the ClearBeforeFill property of the TableAdapter to false. Use the GetData method of the TableAdapter to create a new DataTable.
C. Set the ClearBeforeFill property of the TableAdapter to true. Use the Fill method of the TableAdapter to load additional customers.
D. Set the ClearBeforeFill property of the TableAdapter to true. Use the GetData method of the TableAdapter to create a new DataTable.
Correct Answer: A Explanation
Explanation/Reference:
Explanation:

TableAdapter.Fill Populates the TableAdapter’s associated data table with the results of the TableAdapter’s SELECT command.
TableAdapter.Update Sends changes back to the database. For more information, see How to:
Update Data Using a TableAdapter.
TableAdapter.GetData Returns a new DataTable filled with data. TableAdapter.Insert Creates a new row in the data table. For more information, see How to: Add
Rows to a DataTable.
TableAdapter.ClearBeforeFill Determines whether a data table is emptied before you call one of the Fill methods.
Table Adapter Overview
(http://msdn.microsoft.com/en-us/library/bz9tthwx(v=vs.80).aspx)

QUESTION 13
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL Server 2008 database. The
application performs a database query within a transaction.
You need to ensure that the application can read data that has not yet been committed by other transactions.

Which IsolationLevel should you use?

A. ReadUncommitted
B. ReadCommitted
C. RepeatableRead
D. Unspecified
Correct Answer: A Explanation
Explanation/Reference:
Explanation:

Unspecified A different isolation level than the one specified is being used, but the level cannot be determined.
When using OdbcTransaction, if you do not set IsolationLevel or you set IsolationLevel to Unspecified, the transaction executes according to the isolation level that
is determined by the driver that is being used.
Chaos The pending changes from more highly isolated transactions cannot be overwritten. ReadUncommitted A dirty read is possible, meaning that no shared
locks are issued and no exclusive locks are honored.
ReadCommitted Shared locks are held while the data is being read to avoid dirty reads, but the data can be changed before the end of the transaction, resulting in
non-repeatable reads or phantom data. RepeatableRead Locks are placed on all data that is used in a query, preventing other users from updating the data.
Prevents non-repeatable reads but phantom rows are still possible. Serializable A range lock is placed on the DataSet, preventing other users from updating or
inserting rows into the dataset until the transaction is complete. Snapshot Reduces blocking by storing a version of data that one application can read while
another is modifying the same data.
Indicates that from one transaction you cannot see changes made in other transactions, even if you requery.
IsolationLevel Enumeration
(http://msdn.microsoft.com/en-us/library/system.data.isolationlevel.aspx) Isolation Levels in Database Engine
(http://msdn.microsoft.com/en-us/library/ms189122.aspx)

SET TRANSACTION ISOLATION LEVEL (Transact-SQL)
(http://msdn.microsoft.com/ru-ru/library/ms173763.aspx)

QUESTION 14
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application.

You create a stored procedure to insert a new record in the Categories table according to following code segment.
CREATE PROCEDURE dbo.InsertCategory
@CategoryName nvarchar(15),
@Identity int OUT
AS
INSERT INTO Categories (CategoryName) VALUES(@CategoryName) SET @Identity = SCOPE_IDENTITY()
RETURN @@ROWCOUNT

You write the following code segment. (Line numbers are included for reference only).

01 private static void ReturnIdentity(string connectionString)
02 {
03 using (SqlConnection connection = new SqlConnection(connectionString))
04 {
05 SqlDataAdapter adapter = new SqlDataAdapter(
06 “SELECT CategoryID, CategoryName FROM dbo.Categories”,connection);
07 adapter.InsertCommand = new SqlCommand(“InsertCategory”, connection);
08 adapter.InsertCommand.CommandType = CommandType.StoredProcedure;
09 SqlParameter rowcountParameter = adapter.InsertCommand.Parameters.Add(
10 “@RowCount”, SqlDbType.Int);

12 adapter.InsertCommand.Parameters.Add(
13 “@CategoryName”, SqlDbType.NChar, 15, “CategoryName”);
14 SqlParameter identityParameter = adapter.InsertCommand.Parameters.Add(
15 “@Identity”, SqlDbType.Int, 0, “CategoryID”);

17 DataTable categories = new DataTable();
18 adapter.Fill(categories);
19 DataRow categoryRow = categories.NewRow();
20 categoryRow[“CategoryName”] = “New Beverages”;
21 categories.Rows.Add(categoryRow);
22 adapter.Update(categories);
23 Int32 rowCount = (Int32)adapter.InsertCommand.Parameters[“@RowCount”].Value;
24 }
25 }

You need to retrieve the identity of the new record. You also need to retrieve the row count. What should you do?

A. Insert the following code segment at line 11.rowcountParameter.Direction = ParameterDirection.ReturnValue; Insert the following code segment at line 16. identityParameter.Direction = ParameterDirection.ReturnValue;
B. Insert the following code segment at line 11.rowcountParameter.Direction = ParameterDirection.Output; Insert the following code segment at line 16. identityParameter.Direction = ParameterDirection.Output;
C. Insert the following code segment at line 11. rowcountParameter.Direction = ParameterDirection.ReturnValue; Insert the following code segment at line 16. identityParameter.Direction = ParameterDirection.Output;
D. Insert the following code segment at line 11. rowcountParameter.Direction = ParameterDirection.Output; Insert the following code segment at line 16. identityParameter.Direction = ParameterDirection.ReturnValue;
Correct Answer: C Explanation
Explanation/Reference:
Explanation:

Input – The parameter is an input parameter.
InputOutput – The parameter is capable of both input and output.
Output – The parameter is an output parameter.
ReturnValue – The parameter represents a return value from an operation such as a stored procedure, builtin function, or user-defined function.
ParameterDirection Enumeration
(http://msdn.microsoft.com/en-us/library/system.data.parameterdirection(v=vs.71).aspx)

QUESTION 15
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application. You use the ADO.NET Entity Framework Designer to model entities. The application includes self- tracking entities as shown in the following diagram.

There is a Person entity named person1 that has Track Changes turned on.
You need to delete all e-mail addresses that are associated with person1 by using an ObjectContext named context.
What are two possible code segments that you can use to achieve this goal? (Each correct answer presents a complete solution. Choose two).

A. foreach(var email in person1.EmailAddresses){email.MarkAsDeleted();}context.SaveChanges();
B. while(person1.EmailAddresses.Count() > 0) {person1.EmailAddresses.RemoveAt(0);}context.SaveChanges();
C. person1.EmailAddresses = null;context.SaveChanges();
D. person1.EmailAddresses = newTrackableCollection<EmailAddress>();context.SaveChanges();
Correct Answer: BC Explanation Explanation/Reference:
Explanation:
Working with Self-Tracking Entities (http://msdn.microsoft.com/en-us/library/ff407090.aspx) Working with Sets of Self-Tracking Entities (http://blogs.msdn.com/b/adonet/archive/2010/06/02/working-with-sets-of-self-tracking-entities.aspx)
QUESTION 16
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application uses the ADO.NET Entity Framework to manage
customer and related order records.

You add a new order for an existing customer.
You need to associate the Order entity with the Customer entity.

What should you do?

A. Set the Value property of the EntityReference of the Order entity.
B. Call the Add method on the EntityCollection of the Order entity.
C. Use the AddObject method of the ObjectContext to add both Order and Customer entities.
D. Use the Attach method of the ObjectContext to add both Order and Customer entities. Correct Answer: A
Explanation Explanation/Reference:
Explanation:
Entity Reference (Of Entity) Represents a related end of an association with a multiplicity of zero or one.

QUESTION 17
You use Microsoft .NET Framework 4 to develop an application that uses the Entity Framework.
The application has an entity model with a Person entity. A Person instance named person1 and an ObjectContext instance named model exist.
You need to delete the person1 instance. Which code segment should you use?

A. model.DeleteObject(person1);model.SaveChanges();
B. model.Detach(person1);model.SaveChanges();
C. model.ExecuteStoreCommand(“Delete”, new []{ new ObjectParameter(“Person”, person1) });model.SaveChanges();
D. model.ExecuteFunction(“Detach”, new []{ new ObjectParameter(“Person”, person1) });model.SaveChanges(); Correct Answer: A
Explanation Explanation/Reference:
Explanation:
ObjectContext.DeleteObject Marks an object for deletion from the ObjectStateManager. The object is deleted in the data source when the SaveChanges method is called. ObjectContext.ExecuteStoreCommand Method executes an arbitrary command directly against the data source using the existing connection.
QUESTION 18
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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();
Correct Answer: B Explanation Explanation/Reference:
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 19
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 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”]);

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; Correct Answer: B

Explanation Explanation/Reference:
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 20
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server 2008
database. The application uses DataContexts to query the database.

You create a function that meets the following requirements:
Updates the Customer table on the database when a customer is marked as deleted. Updates the related entries in other tables (CustomerAddress,
CustomerContacts) by marking them as deleted.
Prevents consumer code from setting the Deleted columns value directly. You need to ensure that the function verifies that customers have no outstanding orders
before they are marked as deleted.

You also need to ensure that existing applications can use the updated function without requiring changes in the code.

What should you do?

A. Override the Delete operation of the DataContext object.
B. Override the Update operation of the DataContext object.
C. Modify the SELECT SQL statement provided to the DataContext object to use an INNER JOIN between the Customer and Orders tables.
D. Add new entities to the DataContext object for the Customers and Orders tables.

Correct Answer: A Explanation
Explanation/Reference:

Microsoft 70-516 Exam Certification Guide presents you with an organized test preparation routine through the use of proven series elements and techniques.“Do I Know This Already?”quizzes open each chapter and allow you to decide how much time you need to spend on each section.Microsoft 70-516 lists and Foundation Summary tables make referencing easy and give you a quick refresher whenever you need it.Challenging Microsoft 70-516 review questions help you assess your knowledge and reinforce key concepts.Microsoft 70-516 exercises help you think about exam objectives in real-world situations, thus increasing recall during exam time.

Microsoft 70-516 Study Guide Book,First-hand Microsoft 70-516 Practice Test For Sale

Attention Please:Professional new version Microsoft 70-516 PDF and VCE dumps can now free download on Flydumps.com,all are updated timely by our experts covering all Microsoft 70-516 new questions and questions.100 percent pass your exam.

QUESTION: 1
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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
QUESTION: 2 You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Communication Foundation (WCF) Data Services service. You discover that when an application submits a PUT or DELETE request to the Data Services service, it receives an error. You need to ensure that the application can access the service. Which header and request type should you use in the application?
A. an X-HTTP-Method header as part of a POST request
B. an X-HTTP-Method header as part of a GET request
C. an HTTP ContentType header as part of a POST request
D. an HTTP ContentType header as part of a GET request

Answer: A
QUESTION: 3 You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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
QUESTION: 4 You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL Server 2008 database by using SQL Server authentication. The application contains the following connection string. SERVER=DBSERVER-01; DATABASE=pubs; uid=sa; pwd=secret; You need to ensure that the password value in the connection string property of a SqlConnection object does not exist after the Open method is called. What should you add to the connection string?
A. Persist Security Info=True
B. Trusted_Connection=True
C. Persist Security Info=False
D. Trusted_Connection=False

Answer: C
QUESTION: 5 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 manage order data. The application makes a Web service call to obtain orders from an order-tracking system. You need to ensure that the orders are added to the local data store. Which method should you call on the ObjectContext?
A. Attach
B. AttachTo
C. AddObject
D. ApplyCurrentValues

Answer: A
QUESTION: 6 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. (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
QUESTION: 7 You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Microsoft ASP.NET application. You want to connect the application to a Microsoft SQL Server Express 2008 database named MyDatabase. The primary database file is named MyDatabase.mdf and it is stored in the App_Data folder. You need to define the connection string. Which connection string should you add to the Web.config file?
A. Data Source=localhost; Initial Catalog=MyDataBase; Integrated Security=SSPI; User Instance=True
B. Data Source=.\SQLEXPRESS; Initial Catalog=MyDataBase; Integrated Security=True; User Instance=True
C. Data Source=.\SQLEXPRESS; AttachDbFilename=|DataDirectory|\MyDatabase.mdf; Integrated Security=True; User Instance=True
D. Data Source =SQLEXPRESS; AttachDbFilename=|DataDirectory|\App_Data\MyDatabase.mdf; Integrated Security=SSPI; User Instance=True
Answer: C
QUESTION: 8
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.)
01 AdventureWorks Entities context = n ew AdventureWorksEntities (
02 ” http://localhost:1234/AdventureWorks.svc ”
03 );
04
05 var q = from c in context.Customers
06 where c.City == “London”
07 orderby c.CompanyName
08 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 04?

A.
context.MergeOption = MergeOption.AppendOnly;

B.
context.MergeOption = MergeOption.PreserveChanges;

C.
context.MergeOption = MergeOption.OverwriteChanges;

D.
context.MergeOption = MergeOption.NoTracking;

Answer: B
QUESTION: 9
You use Microsoft .NET Framework 4 to develop an application. The configuration file
contains the following code segment.
<configuration>

<connectionStrings>
<add name=”AdventureWorksLT”
connectionString=”Data Source=SQL01;
Initial Catalog=AdventureWorksLT;
Integrated Security=True;”
providerName=”System.Data.SqlClient”/>
</connectionStrings>
</configuration>
You need to retrieve the connection string named AdventureWorksLT from the configuration
file. Which line of code should you use?
A. var connectionString = ConfigurationManager .ConnectionStrings[“AdventureWorksLT”].ConnectionString;
B. var connectionString = ConfigurationManager .ConnectionStrings[“AdventureWorksLT”].Name;
C. var connectionString = ConfigurationManager .AppSettings[“AdventureWorksLT”];
D. var connectionString = ConfigurationSettings .AppSettings[“AdventureWorksLT”];

Answer: A
QUESTION: 10 You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL Server 2008 database. The application includes a SqlConnection named conn and a SqlCommand named cmd. You need to create a transaction so that database changes will be reverted in the event that an exception is thrown. Which code segment should you use?
A. var transaction = conn.BeginTransaction(); cmd.Transaction = transaction; try { … transaction.Commit(); }
catch { transaction.Rollback(); }
B. var transaction = conn.BeginTransaction(); cmd.Transaction = transaction; try { … transaction.Commit(); } catch { transaction.Dispose(); }

C. var transaction = conn.BeginTransaction(); cmd.Transaction = transaction; try { … } catch { transaction.Commit(); }
D. var transaction = conn.BeginTransaction(); cmd.Transaction = transaction; try { … transaction.Rollback(); } catch { transaction.Dispose (); }

Answer: A
QUESTION: 11 You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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”;
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, name , address1)
B. context.ExecuteCommand(“createCustomer”, userID, name , address1);
C. Customer customer = new Customer() { ID = userID,
Address1 = address1, Name = name ,
};
context.ExecuteCommand(“createCustomer”, customer);

D. Customer customer = new Customer() { ID = userID,
Address1 = address1, Name = name ,
};
context.ExecuteQuery(typeof(Customer), “createCustomer”, customer);
Answer: A
QUESTION: 12 You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You use a TableAdapter object to load a DataTable object. The DataTable object is used as the data source for a GridView control to display a table of customer information on a Web page. You need to ensure that the application meets the following requirements:

Load only new customer records each time the page refreshes.


Preserve existing customer records. What should you do?

A.
Set the ClearBeforeFill property of the TableAdapter to false. Use the Fill method of the TableAdapter to load additional customers.

B.
Set the ClearBeforeFill property of the TableAdapter to false. Use the GetData method of the TableAdapter to create a new DataTable.

C.
Set the ClearBeforeFill property of the TableAdapter to true. Use the Fill method of the TableAdapter to load additional customers.

D.
Set the ClearBeforeFill property of the TableAdapter to true. Use the GetData method of the TableAdapter to create a new DataTable.

Answer: A
QUESTION: 13 You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL Server 2008 database. The application performs a database query within a transaction. You need to ensure that the application can read data that has not yet been committed by other transactions. Which IsolationLevel should you use?

A. ReadUncommitted
B. ReadCommitted
C. RepeatableRead
D. Unspecified
Answer: A

QUESTION: 14
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an
application. You create a stored procedure to insert a new record in the Categories table
according to following code segment.
CREATE PROCEDURE dbo.InsertCategory @CategoryName nvarchar(15), @Identity int OUT AS INSERT INTO Categories (CategoryName) VALUES(@CategoryName) SET @Identity = SCOPE_IDENTITY() RETURN @@ROWCOUNT
You write the following code segment. (Line numbers are included for reference only).
01 private static void ReturnIdentity(string connectionString)
02 {
03 using (SqlConnection connection = new SqlConnection(connectionString))
04 {
05 SqlDataAdapter adapter = new SqlDataAdapter(
06 “SELECT CategoryID, CategoryName FROM dbo.Categories”,connection);
07 adapter.InsertCommand = new SqlCommand(“InsertCategory”, connection);
08 adapter.InsertCommand.CommandType = CommandType.StoredProcedure;
09 SqlParameter rowcountParameter = adapter.InsertCommand.Parameters.Add(
10 “@RowCount”, SqlDbType.Int);
11
12 adapter.InsertCommand.Parameters.Add(
13 “@CategoryName”, SqlDbType.NChar, 15, “CategoryName”);
14 SqlParameter identityParameter = adapter.InsertCommand.Parameters.Add(
15 “@Identity”, SqlDbType.Int, 0, “CategoryID”);
16
17 DataTable categories = new DataTable();
18 adapter.Fill(categories);
19 DataRow categoryRow = categories.NewRow();
20 categoryRow[“CategoryName”] = “New Beverages”;
21 categories.Rows.Add(categoryRow);
22 adapter.Update(categories);
23 Int32 rowCount = (Int32)adapter.InsertCommand.Parameters[“@RowCount”].Value;
24 }

25 }
You need to retrieve the identity of the new record. You also need to retrieve the row count.
What should you do?

A. Insert the following code segment at line 11. rowcountParameter.Direction =
ParameterDirection.ReturnValue; Insert the following c ode segment at line 16.
identityParameter.Direction = ParameterDirection.ReturnValue;

B. Insert the following code segment at line 11. rowcountParameter.Direction =
ParameterDirection.Output;
Insert the following code segment at line 16. identityParameter.Direction =
ParameterDirection.Output;

C. Insert the following code segment at line 11.
rowcountParameter.Direction = ParameterDirection.ReturnValue; Insert the following code
segment at line 16. identityParameter.Direction = ParameterDirection.Output;

D. Insert the following code segment at line 11. rowcountParameter.Direction =
ParameterDirection.Output; Insert the following code segment at line 16.
identityParameter.Direction = ParameterDirection.ReturnValue;
Answer: C
QUESTION: 15 You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application. You use the ADO.NET Entity Framework Designer to model entities. The

There is a Person entity named person1 that has Track Changes turned on. You need to delete all e-mail addresses that are associated with person1 by using an ObjectContext named context. What are two possible code segments that you can use to achieve this goal? (Each correct answer presents a complete solution. Choose two).

A. foreach(var email in person1.EmailAddresses)
{
email.MarkAsDeleted();
}
context.SaveChanges();

B. while(person1.EmailAddresses.Count() > 0)
{
person1.EmailAddresses.RemoveAt(0);
}
context.SaveChanges();

C. person1.EmailAddresses = null;
context.SaveChanges();

D. person1.EmailAddresses = new TrackableCollection<EmailAddress>();
context.SaveChanges();
Answer: A, B
QUESTION: 16 You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application uses the ADO.NET Entity Framework to manage customer and related order records. You add a new order for an existing customer. You need to associate the Order entity with the Customer entity. What should you do?
A. Set the Value property of the EntityReference of the Order entity.
B. Call the Add method on the EntityCollection of the Order entity.
C. Use the AddObject method of the ObjectContext to add both Order and Customer entities.
D. Use the Attach method of the ObjectContext to add both Order and Customer entities.

Answer: A
QUESTION: 17 You use Microsoft .NET Framework 4 to develop an application that uses the Entity Framework. The application has an entity model with a Person entity. A Person instance named person1 and an ObjectContext instance named model exist. You need to delete the person1 instance. Which code segment should you use?
A. model.DeleteObject(person1);

model.SaveChanges();
B. model.Detach(person1); model.SaveChanges();
C. model.ExecuteStoreCommand(“Delete”, new [] { new ObjectParameter(“Person”, person1) }); model.SaveChanges();
D. model.ExecuteFunction(“Detach”, new [] { new ObjectParameter(“Person”, person1) }); model.SaveChanges();

Answer: A
QUESTION: 18 You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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
QUESTION: 19
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 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”]);

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
QUESTION: 20 You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server 2008 database. The application uses DataContexts to query the database. You create a function that meets the following requirements: Updates the Customer table on the database when a customer is marked as deleted. Updates the related entries in other tables (CustomerAddress, CustomerContacts) by marking them as deleted. Prevents consumer code from setting the Deleted columns value directly. You need to ensure that the function verifies that customers have no outstanding orders before they are marked as deleted. You also need to ensure that existing applications can use the updated function without requiring changes in the code. What should you do?
A. Override the Delete operation of the DataContext object.
B. Override the Update operation of the DataContext object.
C. Modify the SELECT SQL statement provided to the DataContext object to use an INNER JOIN between the Customer and Orders tables.
D. Add new entities to the DataContext object for the Customers and Orders tables.

Answer: A

Our material on our site Microsoft 70-516 is exam-oriented, keeping in view the candidates requirements and level of understanding.Microsoft 70-516 materials are in the most popular and easy-to-use PDF version. You can use it on any devices with you anywhere.