PrepAway - Latest Free Exam Questions & Answers

Author: seenagape

What should you do?

You are implementing an ASP.NET MVC 2 Web application that contains several folders.
The Views/Shared/DisplayTemplates folder contains a templated helper named Score.ascx that performs custom formatting of integer values.
The Models folder contains a class named Player with the following definition.

public class Player
{
public String Name { get; set; }
public int LastScore { get; set; }
public int HighScore { get; set; }
}

You need to ensure that the custom formatting is applied to LastScore values when the HtmlHelper.DisplayForModel method is called for any view in the application that has a model of type Player.
What should you do?

What should you do?

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 application allows users to make changes while disconnected from the data store. Changes are submitted to the data store by using the SubmitChanges method of the DataContext object. You receive an exception when you call the SubmitChanges method to submit entities that a user has changed in offline mode. You need to ensure that entities changed in offline mode can be successfully updated in the data store. What should you do?

Which code segment should you insert at line 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. You write the following code segment that executes two commands against the database within a transaction. (Line numbers are included for reference only.)
01 Using connection As New SqlConnection(cnnStr)
02 connection.Open()
03 Dim sqlTran As SqlTransaction = connection.BeginTransaction()
04 Dim command As SqlCommand = connection.CreateCommand()
05 command.Transaction = sqlTran
06 Try
07 command.CommandText = “INSERT INTO Production.ScrapReason(Name) VALUES(‘Wrong size’)”
08 command.ExecuteNonQuery()
09 command.CommandText = “INSERT INTO Production.ScrapReason(Name) VALUES(‘Wrong color’)”
10 command.ExecuteNonQuery()
11
12 End Using

You need to log error information if the transaction fails to commit or roll back.
Which code segment should you insert at line 11?

What should you do?

You are implementing an ASP.NET MVC 2 application.
In the Areas folder, you add a subfolder named Product to create a single project area.
You add files named ProductController.cs and Index.aspx to the appropriate subfolders.
You then add a file named Route.cs to the Product folder that contains the following code. (Line numbers are included for reference only.)

01 public class Routes : AreaRegistration
02 {
03 public override string AreaName
04 {
05 get { return “product”; }
06 }
07
08 public override void RegisterArea(AreaRegistrationContext context)
09 {
10 context.MapRoute(“product_default”, “product/{controller}/{action}/{id}”, new { controller = “Product”, action = “Index”, id = “” });
11 }
12 }

When you load the URL http://<applicationname>/product, you discover that the correct page is not returned.
You need to ensure that the correct page is returned.
What should you do?