Pass Your Exam On First Try Real Microsoft 70-516 Exam Braindumps (51-60)

QUESTION 51
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows Communication Foundation (WCF) Data Services service.
WCF Data Services uses an authentication scheme that requires an HTTP request that has the following header format:
GET /Odata.svc/Products(1)
Authorization: WRAP access_token=”123456789”
The application includes the following code. (Line numbers are included for reference only.)

01 public class program
02 {
03      Public void GetProducts()
04      {
05          var proxy = new MyDataServiceContext("…");
06          …
07      }
08 }
You need to ensure that the correct authentication header is present when requests are made by using MyDataServiceContext. What should you do?

A.    Insert the following code segmen at line 06:
Proxy.Credentials = new NetworkCredential(“WRAP access_token”, “123456789”);
B.    Insert the following code segment at line 06:
Proxy.Credentials = new NetworkCredential(“Authorization”, “WRAP access_token=\”123456789”\””);
C.    Insert the following code segmen at line 06:
Proxy.SendingRequest += new EventHandler<SendingRequestEventArgs>(proxy_SendingRequest);
Insert the following code segmen at line 09:
void proxy_SendingRequest(object sender, SendingRequestEventArgs e){
   e.RequestsHeaders.Add(“WRAP access_token”, “123456789”);
}
D.    Insert the following code segment at line 06:
Proxy.SendingRequest += new EventHandler<SendingRequestEventArgs>(proxy_SendingRequest);
Insert the following code segment at line 09:
void proxy_SendingRequest(object sender, SendingRequestEventArgs e){
   e.RequestsHeaders.Add(“Authorization”,“WRAP access_token”, “123456789”);
}

Answer: D

QUESTION 52
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows Communication Foundation (WCF) Data Services service. The solution contains the projects shown in the following table.
523
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 referance to the Application.Model Project.
B.    Add a referance 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.

Answer: C

QUESTION 53
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application contains the following XML document:
<bib>
<book title="TCP/IP Illusrated" 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 element that are authored by Author1. Which code segment should you insert at line 04?

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

Answer: C

QUESTION 54
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 add the following store 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 the goal?

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

Answer: AB

QUESTION 55
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application retreives data from Microsoft SQL Server 2008 database named AdventureWorks.
The AdventureWorks.dbo.ProductDetails table contains a column names ProductImages that uses a varbinary(max) data type.
You write the following code segment. (Line numbers are included for reference only.)
01 SqlDataReader reader = command.ExecureReader(– empty phrase here –);
02 while(reader.Read())
03 {
04    pubID = reader.GetString(0);
05    stream = new FileStream(…);
06    writer = new BinaryWriter(stream);
07    startIndex = 0;
08    retval = reader.GetBytes(1, startIndex, outByte, 0, bufferSize);
09    while(retval == bufferSize)
10    {
11        …
12    }
13    writer.Write(outbyte, 0, (int)retval-1);
14    writer.Flush();
15    writer.Close();
16    stream.Close();
17 }
You need to ensure that the code supports streaming data from the ProductImages column.
Which code segment should you insert at the empty phrase in line 01?

A.    CommandBehavior.Default
B.    CommandBehavior.KeyInfo
C.    CommandBehavior.SingleResult
D.    CommandBehavior.SequentialAccess

Answer: D

QUESTION 56
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 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 beed commited by other transactions.
Which IsolationLevel should you use?

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

Answer: A

QUESTION 57
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 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 58
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 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 navrchar(15),
@Identity int OUT
AS
  INSERT INTO Categories(CategoryName) VALUES (@CategoryName)
  SET @Identity = SCOPE_IDENTITY()
  RETURN @@ROWCOUNT
You add the following code fragment. (Line numbers are included for reference only.)
01 private static void ReturnIdentity(string connectionString)
02 {
03    using(SqlConnection connection = new SqlConnection(connectionString))
04    {
05       SqlDataAdpater adapter = new SqlDataAdapter("SELECT CategoryID, CategoryName FROM dbo.Categories", connection);
06       adapter.InsertCommand = new SqlCommand("InsertCategory", connection);
07       adapter.InsertCommand.CommandType = CommandType.StoredProcedure;
08       SqlParameter rowcountParameter = adapter.InsertCommand.Parameters.Add("@RowCount", SqlDbType.Int);
09       …
10       adapter.InsertCommand.Parameters.Add("@CategoryName", SqlDbType.NChar, 15, "CategoryName");
11       SqlParameter identityParameter = adapter.InsertCommand.Parameters.Add("@Identity", SqlDbType.Int, 0, "CategoryID");
12       …
13       DataTable categories = new DataTable();
14       adapter.Fill(categories);
15       DataRow ctegoryRow = categories.NewRow();
16       categoryRow["CategoryName"] = "New beverages";
17       categories.Rows.Add(categoryRow);
18       adapter.Update(categories);
19       Int32 rowCount = (Int32)adapter.InsertCommand.Parameters["@RowCount"].Value;
20    }
21 }
Which code elements needs to be added in the empty lines?

A.    Insert the following code segment at line 09:
rowcountParameter.Direction = ParameterDirection.ReturnValue;
Insert the following code segment at line 12:
identityParameter.Direction = ParameterDirection.ReturnValue;
B.    Insert the following code segment at line 09:
rowcountParameter.Direction = ParameterDirection.Output;
Insert the following code segment at line 12:
identityParameter.Direction = ParameterDirection.Output;
C.    Insert the following code segment at line 09:
rowcountParameter.Direction = ParameterDirection.ReturnValue;
Insert the following code segment at line 12:
identityParameter.Direction = ParameterDirection.Output;
D.    Insert the following code segment at line 09:
rowcountParameter.Direction = ParameterDirection.Output;
Insert the following code segment at line 12:
identityParameter.Direction = ParameterDirection.ReturnValue;

Answer: C

QUESTION 59
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses the EntityFramework.
The application has an entity named Person. 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.ExecuteStoreCommand("Detach", new []{new ObjectParameter("Person", person1)};
model.SaveChanges();

Answer: A

QUESTION 60
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that connects
to a MS SQL server 2008 database by User 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 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

Pass Your Exam On First Try Real Microsoft 70-516 Exam Braindumps

Welcome To Visit PassLeader