PrepAway - Latest Free Exam Questions & Answers

Category: 70-515

Exam 70-515: TS: Web Applications Development with Microsoft .NET Framework 4

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?

What should you do?

You create a new ASP.NET MVC 2 Web application.
The following default routes are created in the Global.asax.cs file. (Line numbers are included for reference only.)

01 public static void RegisterRoutes(RouteCollection routes)
02 {
03 routes.IgnoreRoute(“{resource}.axd/{*pathInfo}”);
05 routes.MapRoute(“Default”, “{controller}/{action}/{id}”, new {controller = “Home”, action = “Index”, id = “”});
06 }

You implement a controller named HomeController that includes methods with the following signatures.

public ActionResult Index()
public ActionResult Details(int id)
public ActionResult DetailsByUsername(string username)

You need to add a route to meet the following requirements.
* The details for a user must to be displayed when a user name is entered as the path by invoking the DetailsByUsername action.
* User names can contain alphanumeric characters and underscores, and can be between 3 and 20 characters long.

What should you do?

What should you do?

You create a new ASP.NET MVC 2 Web application.
The following default routes are created in the Global.asax.cs file. (Line numbers are included for reference only.)

01 public static void RegisterRoutes(RouteCollection routes)
02 {
03 routes.IgnoreRoute(“{resource}.axd/{*pathInfo}”);
05 routes.MapRoute(“Default”, “{controller}/{action}/{id}”, new {controller = “Home”, action = “Index”, id = “”});
06 }

You implement a controller named HomeController that includes methods with the following signatures.

public ActionResult About()
public ActionResult Index()
public ActionResult Details(int id)

You need to ensure that the About action is invoked when the root URL of the site is accessed.
What should you do?

Which two actions should you perform?

You are implementing a new Dynamic Data Web site.
The Web site includes a Web page that has an ObjectDataSource control named ObjectDataSource1.
ObjectDataSource1 interacts with a Web service that exposes methods for listing and editing instances of a class named Product.
You add a GridView control named GridView1 to the page, and you specify that GridView1 should use ObjectDataSource1 as its data source.
You then configure GridView1 to auto-generate fields and to enable editing.
You need to add Dynamic Data behavior to GridView1.
You also must ensure that users can use GridView1 to update Product instances.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

Which two actions should you perform?

You are implementing an ASP.NET Web site.
The site contains the following class.

public class Address
{
public int AddressType;
public string Line1;
public string Line2;
public string City;
public string ZipPostalCode;
}

The Web site interacts with an external data service that requires Address instances to be given in the following XML format.

<Address AddressType=”2″>
<Line1>250 Race Court</Line1>
<City>Chicago</City>
<ZipCode>60603</ZipCode>
</Address>

You need to ensure that Address instances that are serialized by the XmlSerializer class meet the XML format requirements of the external data service.
Which two actions should you perform (Each correct answer presents part of the solution. Choose two.)

What should you do?

You are implementing an ASP.NET Dynamic Data Web site.
The Web site includes a data context that enables automatic scaffolding for all tables in the data model.
The Global.asax.cs file contains the following code segment.

public static void RegisterRoutes(RouteCollection routes)
{
routes.Add(new DynamicDataRoute(“{table}/ListDetails.aspx”)
{
Action = PageAction.List,
ViewName = “ListDetails”,
Model = DefaultModel
});

routes.Add(new DynamicDataRoute(“{table}/ListDetails.aspx”)
{
Action = PageAction.Details,
ViewName = “ListDetails”,
Model = DefaultModel
});
}

You need to display the items in a table named Products by using a custom layout.
What should you do?

What should you do?

You are implementing a WCF service library.
You add a new code file that contains the following code segment.

namespace ContosoWCF
{
[ServiceContract]
public interface IRateService
{
[OperationContract]
decimal GetCurrentRate();
}

public partial class RateService : IRateService
{
public decimal GetCurrentRate()
{
decimal currentRate = GetRateFromDatabase();
return currentRate;
}
}
}

You build the service library and deploy its assembly to an IIS application.
You need to ensure that the GetCurrentRate method can be called from JavaScript.
What should you do?

Which two actions should you perform?

You are implementing an ASP.NET Web site.
The Web site contains a Web service named CustomerService.
The code-behind file for the CustomerService class contains the following code segment.

public class ProductService : System.Web.Services.WebService
{
public List<Product> GetProducts(int categoryID)
{
return GetProductsFromDatabase(categoryID);
}
}

You need to ensure that the GetProducts method can be called by using AJAX.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

Which code segment should you use?

You are implementing an ASP.NET application.
You add the following code segment.

public List<Person> GetNonSecretUsers()
{
string[] secretUsers = {“@secretUser”, “@admin”, “@root”};
List<Person> allpeople = GetAllPeople();

}

You need to add code to return a list of all Person objects except those with a UserId that is contained in the secretUsers list.
The resulting list must not contain duplicates.
Which code segment should you use?

Which code segment should you use?

You are implementing an ASP.NET application that uses LINQ to Entities to access and update the database.
The application includes the following method to update a detached entity of type Person.

private NorthwindContext _entities;

public void UpdatePerson(Person personToEdit)
{
}

You need to implement the UpdatePerson method to update the database row that corresponds to the personToEdit object.
Which code segment should you use?


Page 8 of 11« First...678910...Last »