[Free] New Updated (October) Microsoft 70-516 Real Exam 111-120

Ensurepass

 

QUESTION 111

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

 

 

QUESTION 112

You use Microsoft .NET Framework 4 and the Entity Framework to develop an application. You create an Entity Data Model that has an entity named Customer. You set the optimistic concurrency option for Customer. You load and modify an instance of Customer named loadedCustomer, which is attached to an ObjectContext named context.

 

You need to ensure that if a concurrency conflict occurs during a save, the application will load up-to-date values from the database while preserving local changes.

 

Which code segment should you use?

 

A.

Try

context.SaveChanges() Catch ex As EntitySqlException

context.Refresh(RefreshHode.StoreWins, loadedCustomer)

)

B.

Try

context.SaveChanges()

Catch ex As OptimisticConcurrencyException

context.Refresh(RefreshMode.ClientWins, loadedCustomer)

)

C.

Try

context.SaveChanges()

Catch ex As EntitySqlException

context.Refresh(RefreshMode.ClientWins, loadedCustomer)

)

D.

Try

context.SaveChanges()

Catch ex As OptimisticConcurrencyException

context.Refresh(RefreshHode.StoreWins, loadedCustomer)

)

 

Correct Answer: B

 

 

QUESTION 113

You are developing a Microsoft .NET Framework 4 application.

 

You need to collect performance data to the event log after the application is deployed to the production environment.

 

Which two components should you include in the project? (Each correct answer presents part of the solution. Choose two.)

 

A.

A debug listener

B.

A trace listener

C.

Trace.WriteLine() statements

D.

Debug.Asset() statements

E.

Debug.WriteLineQ statements

 

Correct Answer: BC

Explanation:

Tracing is a way for you to monitor the execution of your application while it is running.

Example:

For example, suppose you set up two listeners: a TextWriterTraceListener and an EventLogTraceListener. Each listener receives the same message. The TextWriterTraceListener would direct its output to a stream, and the EventLogTraceListener would direct its output to an event log.

The following example shows how to send output to the Listeners collection.

C#VB

// Use this example when debugging.

System.Diagnostics.Debug.WriteLine(“Error in Widget 42”);

// Use this example when tracing.

System.Diagnostics.Trace.WriteLine(“Error in Widget 42”);

 

 

QUESTION 114

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:

Working with Multiple Active Result Sets

http://msdn.microsoft.com/en-us/library/yf1a7f4f(v=vs.80).aspx

SSPI

http://msdn.microsoft.com/en-us/library/windows/desktop/aa380493(v=vs.85).aspx

 

 

QUESTION 115

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 stores encrypted credit card numbers in the database.

 

You need to ensure that credit card numbers can be extracted from the database.

 

Which cryptograpny provider should you use?

 

A.

DSACryptoServiceProvider

B.

AESCryptoServiceProwier

C.

MD5CryptoServiceProvider

D.

SHA1 CryptoServceProvider

 

Correct Answer: B

Explanation:

AESCryptoServiceProvider Performs symmetric encryption and decryption using the Cryptographic Application Programming Interfaces (CAPI) implementation of the Advanced Encryption Standard (AES) algorithm.

DSACryptoServiceProvider Defines a wrapper object to access the cryptographic service provider (CSP) implementation of the DSA algorithm. This class cannot be inherited. MD5CryptoServiceProvider Computes the MD5 hash value for the input data using the implementation provided by the cryptographic service provider (CSP). This class cannot be inherited.

SHA1CryptoServiceProvider Computes the SHA1 hash value for the input data using the implementation provided by the cryptographic service provider (CSP). This class cannot be inherited.

 

DSACryptoServiceProvider

http://msdn.microsoft.com/en-us/library/system.security.cryptography.dsacryptoserviceprovider.aspx

AESCryptoServiceProvider

http://msdn.microsoft.com/en-us/library/system.security.cryptography.aescryptoserviceprovider.aspx

MD5CryptoServiceProvider

http://msdn.microsoft.com/en-us/library/system.security.cryptography.md5cryptoserviceprovider.aspx

SHA1CryptoServiceProvider Class

http://msdn.microsoft.com/en-us/library/system.security.cryptography.sha1cryptoserviceprovider.aspx

 

 

QUESTION 116

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.

 

You need to associate a previously deserialized entity named personl to an object context named model and persist changes to the database.

 

Which code segment should you use?

 

A.

personl.AcceptChanges();

mode1.SaveChanges();

B.

model.People.ApplyChanges(personl);

mode1.SaveChanges();

C.

model.AttachTo(“People”, personl);

model.SaveChanges();

D.

model.People.Attach(personl);

model.SaveChanges();

 

Correct Answer: C

Explanation:

Cosiderations from Attaching and Detaching objects

http://msdn.microsoft.com/en-us/library/bb896271.aspx

The object that is passed to the Attach method must have a valid EntityKey value. If the object does not have a valid EntityKey value, use the AttachTo method to specify the name of the entity set.

Attach Use the Attach method of ObjectContext where the method accepts a single typed entity parameter.

AttachTo The AttachTo method of ObjectContext accepts two parameters. The first parameter is a string containing the name of the entity set. The second parameter’ type is object and references the entity you want to add. Attach The Attach method of ObjectSet, which is the entity set’ type, accepts a single typed parameter containing the entity to be added to the ObjectSet.

CHAPTER 6 ADO.NET Entity Framework

Lesson 2: Querying and Updating with the Entity Framework Attaching Entities to an ObjectContext(page 437)

Attaching and Detaching objects

http://msdn.microsoft.com/en-us/library/bb896271.aspx

http://msdn.microsoft.com/en-us/library/bb896248(v=vs.90).aspx

http://msdn.microsoft.com/en-us/library/bb896248.aspx

 

 

QUESTION 117

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:

Setting property ObjectTrackingEnabled to false improves performance at retrieval time, because there are fewer items to track.

DataContext.ObjectTrackingEnabled Property

http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.objecttrackingenabled.aspx

 

QUESTION 118

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an ASP.NET Web application that uses the Entity Framework.

 

The build configuration is set to Release. The application must be published by using Microsoft Visual Studio 2010, with the following requirements:

 

clip_image002The database schema must be created on the destination database server.

clip_image002[1]The Entity Framework connection string must be updated so that it refers to the destination database server.

 

You need to configure the application to meet the requirements.

 

Which two actions should you perform?(Each correct answer presents part of the solution. Choose two.)

 

A.

Generate the DDL from the Entity Framework Designer and include it in the project. Set the action for the DDL to ApplicationDefinition.

B.

Set Items to deploy in the Package/Publish Web tab to All files in this Project Folder for the release configuration.

C.

Use the web.config transform file to modify the connection string for the release configuration.

D.

Include the source database entry in the Package/Publish SQL tab and update the connection string for the destination database.

 

Correct Answer: CD

 

 

QUESTION 119

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 }

 

11

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:

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 120

You are creating a Microsoft .NET Framework 4 application that will access data from an Oracle database named DB1.

 

DB1 is located on a server named DBSVR. The Oracle instance requires that connections be authenticated by using Windows authentication.

 

You need to identify the connection string for the application.

 

Which connection string should you identify?

 

A.

Data Source=DBSVR; initial catalog=DBl; Integrated Security=SSPI;

B.

Data Source=DBSVS: 1433/231; SPPRMSLOB=True;

C.

Data Source=DBSVR; initial catalog=DB1; Network Library=DBMSSOCN;

D.

Data Source=DBSVR: 1433/331; User ID=/;

 

Correct Answer: D

Explanation:

For Windows Authentication use connection strings like:

Data Source=myOracleDB;User Id=/;

Free VCE & PDF File for Microsoft 70-516 Real Exam

Instant Access to Free VCE Files: MCSE|MCSA|MCITP…
Instant Access to Free PDF Files: MCSE|MCSA|MCITP…