web analytics

Download MCSE New Exam Questions From PassLeader

PassLeader Supply The Newest MCSE Exam Questions With 100% Pass Ensure

[Pass Ensure VCE Dumps] PassLeader Real 286q 70-516 Exam VCE Dumps Help You Passing Exam Easily (181-200)

What are the new 70-516 exam questions? And Where to download the latest 70-516 exam dumps? Now, PassLeader have been publised the new version of 70-516 braindumps with new added 70-516 exam questions. PassLeader offer the latest 70-516 PDF and VCE dumps with New Version VCE Player for free download, and PassLeader’s new 286q 70-516 practice tests ensure your exam 100 percent pass. Visit www.passleader.com to get the 100 percent pass ensure 286q 70-516 exam questions!

keywords: 70-516 exam,286q 70-516 exam dumps,286q 70-516 exam questions,70-516 pdf dumps,70-516 vce dumps,70-516 braindumps,70-516 practice tests,70-516 study guide,TS: Accessing Data with Microsoft .NET Framework 4 Exam

QUESTION 181
You use Microsoft Visual Studio 2010 and Microsoft. NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server database. You use Entity SQL of the ADO.NET Entity Framework to retrieve data from the database. You need to define a custom function in the conceptual model. You also need to ensure that the function calculates a value based on properties of the object. Which two XML element types should you use? (Each correct answer presents part of the solution. Choose two.)

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

Answer: AE

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

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

Answer: D

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

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

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

QUESTION 184
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server database. The application uses the ADO.NET Entity Framework to model entities. The database includes objects based on the exhibit. (Click the Exhibit button.) The application includes the following code segment. (Line numbers are included for reference only.)
01 using (AdventureWorksEntities advWorksContext = new AdventureWorksEntities()){
02   …
03 }
You need to retrieve a list of all Products from todays sales orders for a specified customer. You also need to ensure that the application uses the minimum amount of memory when retrieving the list. Which code segment should you insert at line 02?

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

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

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

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

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

QUESTION 186
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server 2008 database. The application contains two SqlCommand objects named cmd1 and cmd2. You need to measure the time required to execute each command. Which code segment should you use?

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

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

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

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

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

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

Answer: B

QUESTION 188
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application uses the ADO.NET Entity Framework to model entities. The conceptual schema definition language (CSDL) file contains the following XML fragment.
<EntityType Name=”Contact”>
  …
  <Property Name=”EmailPhoneComplexProperty” Type=”AdventureWorksModel.EmailPhone” Nullable=”false” />
</EntityType>

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

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

Answer: C

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

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

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

QUESTION 190
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server 2008 database. You must retrieve a connection string. Which of the following is the correct connection string?

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

Answer: D


http://www.passleader.com/70-516.html

QUESTION 191
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server 2008 database.
SQLConnection conn = new SQLConnection(connectionString);
conn.Open();
SqlTransaction tran = db.BeginTransaction(IsolationLevel. …);

You must retrieve not commited records originate from various transactions. Which method should you use?

A.    ReadUncommited
B.    ReadCommited
C.    RepeatableRead
D.    Serializable

Answer: A

QUESTION 192
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. You use the ADO.NET Entity Framework to model your entities. The application connects to a Microsoft SQL Server 2008 database named AdventureWorks by using Windows Authentication. Information about the required Entity Data Model (EDM) is stored in the following files:
– model.csdl
– model.ssdl
– model.msl
These files are embedded as resources in the MyCompanyData.dll file. You need to define the connection string that is used by the application. Which connection string should you add to the app.config file?

A.    <add name=”AdventureWorksEntities”
connectionString=”metadata=res://MyComparny.Data,
Culture=neutral,PublicKeyToken=null/model.csdIlres://MyCompany.Data,Culture=neutral,
PublicKeyToken=null/model.ssdl|res://MyCompany.Data,Culture=neutral,
PublicKeyToken=null/model.msl;
provider=System.Data.EntityClient;
provider connection string=’DataSource=localhost;
Initial Catalog=AdventureWorks;lntegrated Security=True;
multipleactivesuitsets=true’”providerName=”System.Data.SqlClient”/>
B.    <add name=”AdventureWorksEntities”
connectionString=”metadata=res://MyComparny.Data,Culture=neutral,
PublicKeyToken=null/model.csdIlres://MyCompany.Data,Culture=neutral,
PublicKeyToken=null/model.ssdl|res://MyCompany.Data,Culture=neutral,
PublicKeyToken=null/model.msl;
provider=System.Data.SqlClient;
provider connection string=’DataSource=localhost;
Initial Catalog=AdventureWorks;lntegrated Security=True;
multipleactivesuitsets=true’”providerName=”System.Data.EntityClient”/>
C.    <add name=”AdventureWorksEntities”
connectionString=”metadata=res://MyComparny.Datamodel.csdl|res://MyCompany.Data.model.ssdl|res://MyCompany.Data.model.msl;
provider=System.Data.SqlClient;
provider connection string=’DataSource=localhost;
Initial Catalog=AdventureWorks;lntegrated Security=SSPI;
multipleactivesuitsets=true’”providerName=”System.Data.EntityClient”/>
D.    <add name=”AdventureWorksEntities”
connectionString=”metadata=res://MyComparny.Data,Culture=neutral,
PublicKeyToken=null/model.csdIlres://MyComparny.Data,Culture=neutral,
PublicKeyToken=null/model.ssdIlres://MyComparny.Data,Culture=neutral,
PublicKeyToken=null/model.msl;
provider=System.Data.OleDBClient;
provider connection string=’Provider=sqloledb;DataSource=localhost;
Initial Catalog=AdventureWorks;
lntegrated Security=SSPI;multipleactivesuitsets=true’”providerName=”System.Data.EntityClient”/>

Answer: B
Explanation:
Answering this question pay attention to fact that Entity Framework is used, so settings provider=”System.Data.SqlClient” and providerName=”System.Data.EntityClient” shold be set.
Connection Strings
http://msdn.microsoft.com/en-us/library/cc716756.aspx

QUESTION 193
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server database. The Data Definition Language (DDL) script of the database contains the following code segment:
CREATE TABLE [Sales].[SalesOrderHeader](
   [SalesOrderID] [int] IDENTITY(1,1) NOT NULL,
   [BillToAddressID] [int] NOT NULL,
   …
   CONSTRAINT [PK_SalesOrderHeader_SalesOrderID]
   PRIMARY KEY CLUSTERED ([SalesOrderID] ASC)
)
ALTER TABLE [Sales].[SalesOrderHeader]
   WITH CHECK ADD CONSTRAINT [FK_SalesOrderHeader_Address]
   FOREIGN KEY([BilIToAddressID])
   REFERENCES [Person].[Address]([AddressID])
You create an ADO.NET Entity Framework model. You need to ensure that the entities of the model correctly map to the DDL of the database. What should your model contain?

A.   
B.   
C.   
D.   

Answer: A

QUESTION 194
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. You create a Database 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);
}

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 195
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses the Entity Framework. The application has an entity model that contains a SalesOrderHeader entity. The entity includes an OrderDate property of type DateTime. You need to retrieve the 10 oldest SalesOrderHeaders according to the OrderDate property. Which code segment should you use?

A.    var model = new AdventureWorksEntities();
var sales = model.SalesOrderHeaders.Take(10).OrderByDescending(soh => soh.OrderDate);
B.    var model = new AdventureWorksEntities();
var sales = model.SalesOrderHeaders.OrderByDescending(soh => soh.OrderDate).Take(10);
C.    var model = new AdventureWorksEntities();
var sales = model.SalesOrderHeaders.OrderBy(soh => soh.OrderDate).Take(10);
D.    var model = new AdventureWorksEntities();
var sales = model.SalesOrderHeaders.Take(10).OrderBy(soh => soh.OrderDate);

Answer: C
Explanation:
OrderBy() Sorts the elements of a sequence in ascending order according to a key. OrderByDescending() Sorts the elements of a sequence in descending order according to a key.
Enumerable.OrderBy<TSource, TKey> Method (IEnumerable<TSource>, Func<TSource, TKey>)
http://msdn.microsoft.com/en-us/library/bb534966.aspx

QUESTION 196
You use Microsoft .NET Framework 4.0 to develop an application that connects to two separate Microsoft SQL Server 2008 databases. The Customers database stores all the customer information, and the Orders database stores all the order information. The application includes the following code. (Line numbers are included for reference only.)
01   try
02   {
03       conn.Open();
04       tran = conn.BeginTransaction(“Order”);
05       SqlCommand cmd = new SqlCommand();
06       cmd.Connection = conn;
07       cmd.Transaction = tran;
08       tran.Save(“save1”);
09       cmd.CommandText = “INSERT INTO [Cust].dbo.Customer ”  + “(Name, PhoneNumber) VALUES (‘Paul Jones’, ” + “‘404-555-1212’)”;
10       cmd.ExecuteNonQuery();
11       tran.Save(“save2”);
12       cmd.CommandText = “INSERT INTO [Orders].dbo.Order ” + “(CustomerID) VALUES (1234)”;
13       cmd.ExecuteNonQuery();
14       tran.Save(“save3”);
15       cmd.CommandText = “INSERT INTO [Orders].dbo.” + “OrderDetail (OrderlD, ProductNumber) VALUES” + “(5678, ‘DC-6721’)”;
16       cmd.ExecuteNonQuery();
17       tran.Commit();
18   }
19   catch (Exception ex)
20   {
21       …
22   }
You run the program, and a timeout expired error occurs at line 16. You need to ensure that the customer information is saved in the database. If an error occurs while the order is being saved, you must roll back all of the order information and save the customer information. Which line of code should you insert at line 21?

A.    tran.Rollback();
B.    tran.Rollback(“save2”);
tran.Commit();
C.    tran.Rollback();
tran.Commit();
D.    tran.Rollback(“save2”);

Answer: B
Explanation:
Reference:
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqltransaction.save.aspx
http://msdn.microsoft.com/en-us/library/4ws6y4dy.aspx

QUESTION 197
You use Microsoft .NET Framework 4.0 to develop an application. You use the XmlReader class to load XML from a location that you do not control. You need to ensure that loading the XML will not load external resources that are referenced in the XML. Which code segment should you use?

A.    XmlReaderSettings settings = new XmlReaderSettings();
settings.ValidationType = ValidationType.None;
XmlReader reader = XmlReader.Create(“data.xml”, settings);
B.    XmlReaderSettings settings = new XmlReaderSettings();
settings.CheckCharacters = true;
XmlReader reader = XmlReader.Create(“data.xml”, settings);
C.    XmlReaderSettings settings = new XmlReaderSettings();
settings.XmlResolver = null;
XmlReader reader = XmlReader.Create(“data.xml”, settings);
D.    XmlReaderSettings settings = new XmlReaderSettings();
settings.ConformanceLevel = ConformanceLevel.Auto;
XmlReader reader = XmlReader.Create(“data.xml”, settings);

Answer: C
Explanation:
CheckCharacters Gets or sets a value indicating whether to do character checking. ConformanceLevel Gets or sets the level of conformance which the XmlReader will comply. ValidationType Gets or sets a value indicating whether the XmlReader will perform validation or type assignment when reading. XmlResolver Sets the XmlResolver used to access external documents.
XmlReaderSettings Class
http://msdn.microsoft.com/en-us/library/system.xml.xmlreadersettings.aspx
http://stackoverflow.com/questions/215854/prevent-dtd-download-when-parsing-xml
http://msdn.microsoft.com/en-us/library/x1h1125x.aspx

QUESTION 198
You use Microsoft .NET Framework 4.0 to develop an application that connects to a Microsoft SQL Server 2008 database. You add the following table to the database.
CREATE TABLE Orders(
ID numeric(18, 0) NOT NULL,
OrderName varchar(50) NULL,
OrderTime time(7) NULL,
OrderDate date NULL)
You write the following code to retrieve data from the OrderTime column. (Line numbers are included for reference only.)
01 SqlConnection conn = new SqlConnection(“…”);
02 conn.Open();
03 SqlCommand cmd = new SqlCommand(“SELECT ID, OrderTime FROM Orders”, conn);
04 SqlDataReader rdr = cmd.ExecuteReader();
05 ….
06 while(rdr.Read())
07 {
08     ….
09 }
You need to retrieve the OrderTime data from the database. Which code segment should you insert at line 08?

A.    TimeSpan time = (TimeSpan)rdr[1];
B.    Timer time = (Timer)rdr[1];
C.    string time = (string)rdr[1];
D.    DateTime time = (DateTime)rdr[1];

Answer: A
Explanation:
Pay attention to the fact that it goes about Microsoft SQL Server 2008 in the question. Types date and time are not supported in Microsoft SQL Server Express.
time (Transact SQL)
http://msdn.microsoft.com/en-us/library/bb677243.aspx
Using date and time data
http://msdn.microsoft.com/en-us/library/ms180878.aspx
Date and time functions
http://msdn.microsoft.com/en-us/library/ms186724.aspx
SQL Server Data Type Mappings (ADO.NET)
http://msdn.microsoft.com/en-us/library/cc716729.aspx

QUESTION 199
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the ADO.NET Entity Framework Designer to model entities. The model contains an entity type named Product. You need to ensure that a stored procedure will be invoked when the ObjectContext.SaveChanges method is executed after an attached Product has changed. What should you do in the ADO.NET Entity Framework Designer?

A.    Add a new entity that has a base class of Product that is mapped to the stored procedure.
B.    Add a stored procedure mapping for the Product entity type.
C.    Add a complex type named Product that is mapped to the stored procedure.
D.    Add a function import for the Product entity type.

Answer: B
Explanation:
The ObjectContext class exposes a SaveChanges method that triggers updates to the underlying database.
By default, these updates use SQL statements that are automatically generated, but the updates can use stored procedures that you specify.
The good news is that the application code you use to create, update, and delete entities is the same whether or not you use stored procedures to update the database.
To map stored procedures to entities, in the Entity Framework designer, right-click the entity and choose Stored Procedure Mapping.
In the Mapping Details window assign a stored procedure for insert, update, and delete.
CHAPTER 6 ADO.NET Entity Framework
Lesson 1: What Is the ADO.NET Entity Framework?
Mapping Stored Procedures(page 387-388)
Stored Procedures in the Entity Framework
http://msdn.microsoft.com/en-us/data/gg699321

QUESTION 200
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows Communication Foundation (WCF) Data Services service. You deploy the data service to the following URL: http://contoso.com/Northwind.svc. You add the following code segment. (Line numbers are included for reference only.)
01 var uri = new Uri(@”http://contoso.com/Northwind.svc/”);
02 var ctx = new NorthwindEntities(uri);
03 var categories = from c in ctx.Categories select c;
04 foreach (var category in categories) {
05    PrintCategory(category);
06    …
07    foreach (var product in category.Products) {
08       …
09       PrintProduct(product);
10    }
11 }
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 06:
ctx.LoadProperty(category, “Products”);
B.    Add the following code segment at line 08:
ctx.LoadProperty(product, “*”);
C.    Add the following code segment at line 06:
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 08:
var strprdUri= string.format(“Products?$filter=CategoryID eq {0}”, category.CategoryID);
var prodcutUri = new Uri(strPrd, UriKind.Relative);
ctx.Execute<Product>(productUri);

Answer: A
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
http://msdn.microsoft.com/en-us/library/system.urikind.aspx
RelativeOrAbsolute The kind of the Uri is indeterminate.
Absolute The Uri is an absolute Uri.
Relative The Uri is a relative Uri.


http://www.passleader.com/70-516.html

         

Download MCSE New Exam Questions From PassLeader © 2014 http://www.passleader.com