PrepAway - Latest Free Exam Questions & Answers

Author: seenagape

What are two possible ways to achieve this goal?

You are implementing an ASP.NET MVC 2 Web application.
A controller contains the following code.

public ActionResult Edit(int id)
{
return View(SelectUserToEdit(id));
}

public ActionResult Edit(Person person)
{
UpdateUser(person);
return RedirectToAction(“Index”);
}

The first Edit action displays the user whose details are to be edited, and the second Edit action is called when the Save button on the editing form is clicked to update the user details.
An exception is thrown at run time stating that the request for action Edit is ambiguous.
You need to correct this error and ensure that the controller functions as expected.
What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

Which URL should you use for the query?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Communication Foundation (WCF) Data Services service. You deploy the service to the following URL: http://contoso.com/Northwind.svc. You want to query the WCF Data Services service to retrieve a list of customer objects. You need to ensure that the query meets the following requirements: “Only customers that match the following filter criteria are retrieved: City=”Seattle” AND Level > 200. “Data is sorted in ascending order by the ContactName and Address properties. Which URL should you use for the query?

Which code segment should you use?

You use Microsoft .NET Framework 4 to create a Windows Forms client application. You write the following code segment. NotInheritable Class FormSettings Inherits ApplicationSettingsBase <UserScopedSetting> _ <DefaultSettingValue(“225, 200”)> _ Public Property FormSize() As Size Get Return DirectCast(Me(“FormSize”), Size) End Get Set Me(“FormSize”) = value End Set End Property End Class The application contains a form of type Form1 that contains a FormSettings object named frmSettings1. You need to maintain the user’s form size preference each time the user executes the application. Which code segment should you use?

Which code segment should you use?

You use Microsoft .NET Framework 4.0 to develop an application that connects to a Microsoft SQL Server 2008 database.
You add the following stored procedure to the database.

CREATE PROCEDURE dbo.GetClassAndStudents
AS
BEGIN
SELECT * FROM dbo.Class
SELECT * FROM dbo.Student
END

You create a SqIConnection named conn that connects to the database.
You need to fill a DataSet from the result that is returned by the stored procedure.
The first result set must be added to a DataTable named Class, and the second result set must be added to a DataTable named Student.
Which code segment should you use?

What are two possible attributes that you can add to the Edit action to achieve this goal?

You are implementing an ASP.NET MVC 2 Web application that allows users to view and edit data.
You need to ensure that only logged-in users can access the Edit action of the controller.
What are two possible attributes that you can add to the Edit action to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

What should you do?

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?

What should you do?

You are implementing an ASP.NET MVC 2 Web application.
The URL with path /Home/Details/{country} will return a page that provides information about the named country.
You need to ensure that requests for this URL that contain an unrecognized country value will not be processed by the Details action of HomeController.
What should you do?