[Free] Get all latest Microsoft 70-515 Actual Tests 71-80

Ensurepass

QUESTION 71

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

 

Public Class Address

 

Public AddressType As Integer

 

Public Line1 As String

 

Public Line2 As String

 

Public City As String

 

Public ZipPostalCode As String

 

End Class

 

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>

 

<PostalCode>60603</PostalCode>

 

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

 

A.

Add the following attribute to the AddressType field.

<XmlAttribute()>

B.

Add the following attribute to the Line2 field.

<XmlElement(IsNullable:=True)>

C.

Add the following attribute to the ZipPostalCode field.

<XmlAttribute(“ZipCode”)>

D.

Add the following attribute to the ZipPostalCode field.

<XmlElement(“ZipCode”)>

 

Correct Answer: AD

Explanation:

XmlSerializer Class

(http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx)

 

QUESTION 72

You create a new ASP.NET MVC 2 Web application. The following default routes are created in the Global.

 

asax.vb file. (Line numbers are included for reference only.)

 

01 Shared Sub RegisterRoutes(ByVal routes As

 

RouteCollection)

 

03 routes.IgnoreRoute(“{resource}.axd/{*pathInfo}”)

 

05 routes.MapRoute(_

 

“Default”,

 

“{controller}/{action}/{id}”,

 

New With {.controller = “Home”, .action = “Index”, .id = “”} )

 

07 End Sub

 

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

 

Function About() As ActionResult

 

Function Index() As ActionResult

 

Function Details(ByVal id As Integer) As ActionResult

 

You need to ensure that the About action is invoked when the root URL of the site is accessed.

 

What should you do?

 

A.

At line 04 in the Global.asax.vb file, add the following line of code.

routes.MapRoute(“Default4Empty”, “/”,

New With {.controller = “Home”, .action = “About”})

B.

At line 04 in the Global.asax.vb file, add the following line of code.

routes.MapRoute(“Default”, “”,

New With {.controller = “Home”, .action = “About”})

C.

Replace line 05 in the Global.asax.vb file with the following line of code.

routes.MapRoute(“Default4Empty”,”{controller}/{action}/{id}”,

New With {.controller = “Home”, .action = “About”, .id = “”} )

D.

Replace line 05 in the Global.asax.vb file with the following line of code.

routes.MapRoute(“Default”,

“{controller}/{action}”,New With {.controller = “Home”, .action = “About”} )

 

Correct Answer: C

 

 

QUESTION 73

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?

 

A.

Add the ValidateAntiForgeryToken attribute to the Details action method.

B.

Add the Bind attribute to the country parameter of the Details action method.

Set the attribute’s Prefix property to Country.

C.

Create a class that implements the IRouteConstraint interface.

Configure the default route to use this class.

D.

Create a class that implements the IRouteHandler interface.

Configure the default route to use this class.

 

Correct Answer: C

 

 

QUESTION 74

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

 

Function Edit(ByVal id As Integer) As ActionResult

 

Return View(SelectUserToEdit(id))

 

End Function

 

Function Edit(ByVal person As Person) As ActionResult

 

UpdateUser(person)

 

Return RedirectToAction(“Index”)

 

End Function

 

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

 

A.

Add the following attribute to the first Edit action.

<AcceptVerbs(HttpVerbs.Head)>

B.

Add the following attribute to the first Edit action.

<HttpGet()>

C.

Add the following attribute to the second Edit action.

<HttpPost()>

D.

Add the following attribute to the second Edit action.

<HttpPut()>

 

Correct Answer: BC

Explanation:

There is no [HttpPut] attribute.

[AcceptVerbs] represents an attribute that specifies which HTTP verbs an action method will respond to. The possible variants are HttpVerbs enumeration: Get, Post, Put, Delete, Head.

HttpVerbs Enumeration (http://msdn.microsoft.com/en- us/library/system.web.mvc.httpverbs.aspx)

CHAPTER 14 Creating Websites with ASP.NET MVC 2

Lesson 2: Creating Models, Views, and Controllers

 

 

QUESTION 75

You are implementing an ASP.NET MVC 2 Web application. You create a shared user control named MenuBar.ascx that contains the application’s menu. You need to use the menu bar in all application views. What should you do?

 

A.

In the site’s master page, create a div element with an ID of Navigation. Add the following code segment inside this div element. <% Html.RenderPartial(“~/Views/Shared/MenuBar.ascx”); %>

B.

In the site’s master page, create a div element with an ID of Navigation. Add the following code segment inside this div element. <%= Url.Content(“~/Views/Shared/MenuBar.ascx”) %>

C.

In each of the controller’s action methods, add an entry to the ViewData collection with a key of Navigation and a value of ~/Views/Shared/MenuBar.ascx.

D.

In the site’s Global.asax.cs file, register a route named Navigation that points to the ~/Views/Shared/

MenuBar.ascx file.

 

Correct Answer: A

 

 

QUESTION 76

You create an ASP.NET MVC 2 Web application that contains the following controller class.

 

Public Class ProductController

 

Inherits System.Web.Mvc.Controller

 

Shared products As List(Of Product) = New List(Of Product)()

 

Function Index() As ActionResult

 

Return View()

 

End Function

 

End Class

 

In the Views folder of your application, you add a view page named Index.aspx that includes the following @ Page directive.

 

<%@ Page Inherits=”System.Web.Mvc.ViewPage” %>

 

You test the application with a browser. You receive the following error message when the Index method is invoked: # The view ‘Index’ or its master was not found.#

 

You need to resolve the error so that the new view is displayed when the Index method is invoked.

 

What should you do?

 

A.

Change the name of the Index.aspx file to Product.aspx.

B.

Create a folder named Product inside the Views folder. Move Index.aspx to the Product folder.

C.

Replace the @ Page directive in Index.aspx with the following value. <%@ Page Inherits=”System.Web.Mvc.ViewPage(Product)” %>

D.

Modify the Index method by changing its signature to the following Function Index(ByVal p As Product) As ActionResult

 

Correct Answer: B

 

 

QUESTION 77

You are developing an ASP.NET Web application. The application will contain a page that is customized for various browsers. The application will use output cache to optimize performance. You need to ensure that the page is cached by browser type and major version only. Which attribute should you add to the OutputCache directive?

 

A.

varyByCustom= “browser”

B.

varyByCustom= “User-Agentt”

C.

varyByHeader= “browser”

D.

varyByHeader= “User-Agentt”

 

Correct Answer: A

 

 

QUESTION 78

You are developing an ASP.NET Web page that includes a text box control. The page includes a server-side method named ValidateValue. You need to configure the page so that the text box value is validated by using the ValidateValue method. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

 

A.

Use the CompareValidator control.

B.

Use the CustomValidator control.

C.

Set ValidationGroup on the control to ValidateValue

D.

Set OnServerValidate on the control to ValidateValue.

 

Correct Answer: BD

 

 

QUESTION 79

You create an ASP.NET page that contains the following tag.

 

<h1 id=”hdr1″ runat=”server”>Page Name</h1>

 

You need to write code that will change the contents of the tag dynamically when the page is loaded. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

 

A.

Me.hdr1.InnerHtml = “Text”

B.

TryCast(hdr1.Parent, HtmlGenericControl).InnerText = “Text”

C.

Dim h1 As HtmlGenericControl =

TryCast(Me.FindControl(“hdr1”), HtmlGenericControl) h1.InnerText = “Text”

D.

Dim h1 As HtmlGenericControl =

TryCast(Parent.FindControl(“hdr1”), HtmlGenericControl) h1.InnerText = “Text”

 

Correct Answer: AC

 

 

QUESTION 80

You are troubleshooting an ASP.NET Web application. System administrators have recently expanded your web farm from one to two servers. Users are periodically reporting an error message about invalid view state. You need to fix the problem. What should you do?

 

A.

Set viewStateEncryptionMode to Auto in web.config on both servers.

B.

Set the machineKey in machine.config to the same value on both servers.

C.

Change the session state mode to SQLServer on both servers and ensure both servers use the same connection string.

D.

Override the SavePageStateToPersistenceMedium and LoadPageStateFromPersistenceMedium methods in the page base class to serialize the view state to a local web server file.

 

Correct Answer: B

 

Instant Access to Download Testing Software & PDF File for Microsoft 70-515 Real Exam

Instant Access to Try Microsoft 70-515 Free Demo

This entry was posted in 70-515 Actual Tests and tagged , , , , , . Bookmark the permalink.