PrepAway - Latest Free Exam Questions & Answers

Category: 70-515 (v.1)

Exam 70-515: TS: Web Applications Development with Microsoft .NET Framework 4 (update August 24th, 2013)

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 Personobjects 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 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 correctanswer presents part of the solution. Choose two.)

You need to ensure that the GetCurrentRate method can be called from JavaScript

You are implementing a WCF service library.
You add a new code file that contains the followingcode 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?

You need to ensure that Address instances that are serialized by the XmlSerializer class meet the XML format r

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

You need to display the items in a table named Products by using a custom layout

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 codesegment.
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?

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 thatexposes 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 correctanswer presents part of the solution. Choose two.)

You need to ensure that the About action is invokedwhen the root URL of the site is accessed

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 invokedwhen the root URL of the site is accessed.
What should you do?

You need to add a route to meet the following requirements

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?

You need to ensure that requests for this URL that contain an unrecognized country value will not be processed

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


Page 5 of 19« First...34567...10...Last »