web analytics

[Pass Ensure VCE Dumps] Accurate 299q 70-515 Exam Questions With VCE Dumps Offered By PassLeader (41-60)

Passed 70-515 exam with the best PassLeader 70-515 exam dumps now! PassLeader are supplying the latest 299q 70-515 vce and pdf exam dumps covering all the new questions and answers, it is 100 percent pass ensure for 70-515 exam. PassLeader offer PDF and VCE format 70-515 exam dumps, and free version VCE player is also available. Visit passleader.com now and download the 100 percent passing guarantee 299q 70-515 braindumps to achieve your new 70-515 certification easily!

keywords: 70-515 exam,299q 70-515 exam dumps,299q 70-515 exam questions,70-515 pdf dumps,70-515 practice test,70-515 vce dumps,70-515 study guide,70-515 braindumps,TS: Web Applications Development with Microsoft .NET Framework 4 Exam

QUESTION 41
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?

A.    Replace line 10 with the following code segment.
context.MapRoute(“product_default”, “{area}/{controller}/{action}/{id}”, new {area = “product”, controller = “Product”, action = “Index”, id = “”});
B.    Replace line 10 with the following code segment.
context.MapRoute(“product_default”, “area}”,
C.    Add the following code segmnet at line 11
Area Registration.RegisterAllAreas();
D.    Add the following Code segmnet to the Register Routes in Global.asax.cs file.
Area Registration.RegisterAllAreas();

Answer: D

QUESTION 42
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.

Answer: A

QUESTION 43
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?

A.    Rename Score.ascx to LastScore.ascx.
B.    Move Score.ascx from the Views/Shared/DisplayTemplates folder to the Views/Player/DisplayTemplates folder.
C.    Add the following attribute to the LastScore property.
[UIHint(“Score”)]
D.    Add the following attribute to the LastScore property.
[Display(Name=”LastScore”, ShortName=”Score”)]

Answer: C

QUESTION 44
You create an ASP.NET MVC 2 Web application that contains the following controller class.
public class ProductController : Controller
{
static List<Product> products = new List<Product>();
public ActionResult Index()
{
return View();
}
}
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:
public ActionResult Index(Product p)

Answer: B

QUESTION 45
You are implementing an ASP.NET MVC 2 Web application that contains the following class.
public class DepartmentController : Controller
{
static List<Department> departments = new List<Department>();
public ActionResult Index()
{
return View(departments);
}
public ActionResult Details(int id)
{
return View(departments.Find(x => x.ID==id));
}
public ActionResult ListEmployees(Department d)
{
List<Employee> employees = GetEmployees(d);
return View(employees);
}
}
You create a strongly typed view that displays details for a Department instance. You want the view to also include a listing of department employees. You need to write a code segment that will call the ListEmployees action method and output the results in place. Which code segment should you use?

A.    <%= Html.Action(“ListEmployees”, Model) %>
B.    <%= Html.ActionLink(“ListEmployees”, “Department”, “DepartmentController”) %>
C.    <% Html.RenderPartial(“ListEmployees”, Model); %>
D.    <%= Html.DisplayForModel(“ListEmployees”) %>

Answer: A
Explanation:
Html.Action(string, object) invokes a child action method and returns the result as an HTML string.
ChildActionExtensions.Action Method
http://msdn.microsoft.com/en-us/library/system.web.mvc.html.childactionextensions.action.aspx
Html.DisplayForModel() Method returns HTML markup for each property in the model. Html.DisplayForModel(string, object) Method returns HTML markup for each property in the model, using the specified template and additional view data.
RenderPartialExtensions.RenderPartial Method
http://msdn.microsoft.com/en-us/library/system.web.mvc.html.renderpartialextensions.renderpartial.aspx
The ActionLink method renders an element that links to an action method.
LinkExtensions.ActionLink Method
http://msdn.microsoft.com/en-us/library/system.web.mvc.html.linkextensions.actionlink.aspx

QUESTION 46
You are testing an existing ASP.NET page. The page includes a text box. You are able to execute malicious JavaScript code by typing it in the text box and submitting. You need to configure the page to prevent JavaScript code from being submitted by the text box. In the @ Page directive, which attribute should you set to true?

A.    the EnableEventValidation attribute
B.    the ResponseEncoding attribute
C.    the ValidateRequest attribute
D.    the Strict attribute

Answer: C

QUESTION 47
You are implementing an ASP.NET Web site that will be accessed by an international audience. The site contains global and local resources for display elements that must be translated into the language that is selected by the user. You need to ensure that the Label control named lblCompany displays text in the user’s selected language from the global resource file. Which control markup should you use?

A.    <asp:Label ID=”lblCompany” runat=”server”
meta:resourcekey=”lblCompany” />
B.    <asp:Label ID=”lblCompany” runat=”server”
Text=”meta:lblCompany.Text” />
C.    <asp:Label ID=”lblCompany” runat=”server”
Text=”<%$ Resources:lblCompanyText %>” />
D.    <asp:Label ID=”lblCompany” runat=”server”
Text=”<%$ Resources:WebResources, lblCompanyText %>” />

Answer: D

QUESTION 48
You are implementing an ASP.NET page in an e-commerce application. Code in a btnAddToCart_Click event handler adds a product to the shopping cart. The page should check the status of the shopping cart and always show a cart icon when one or more items are in the shopping cart. The page should hide the icon when the shopping cart has no items. You need to add an event handler to implement this requirement. Which event handler should you add?

A.    btnAddToCart_Click
B.    Page_Load
C.    Page_PreRender
D.    Page_PreInit

Answer: C

QUESTION 49
You are implementing a read-only page that includes the following controls.
<asp:Button ID=”btnRefresh” runat=”server” Text=”Button” />
<asp:GridView ID=”gvCustomers” runat=”server” EnableViewState=”False” OnDataBinding=”gvCustomers_DataBinding”></asp:GridView>
You disable view state to improve performance. You need to ensure that the page is updated to display the latest data when the user clicks the refresh button. Which code segment should you use?

A.    protected void Page_PreInit(object sender, EventArgs e)
{
if (!IsPostBack)
{
gvCustomers.DataSource = GetCustomers();
gvCustomers.DataBind();
}
}
B.    protected void Page_Load(object sender, EventArgs e)
{
gvCustomers.DataSource = GetCustomers();
gvCustomers.DataBind();
}
C.    protected void gvCustomers_DataBinding(object sender, EventArgs e)
{
gvCustomers.DataSource = GetCustomers();
gvCustomers.DataBind();
}
D.    protected void Page_PreRender(object sender, EventArgs e)
{
if (!IsPostBack)
{
gvCustomers.DataSource = GetCustomers();
gvCustomers.DataBind();
}
}

Answer: B

QUESTION 50
You create an ASP.NET page named TestPage.aspx that contains validation controls. You need to verify that all input values submitted by the user have been validated by testing the Page.IsValid property. Which page event should add an event handler to?

A.    Init
B.    Load
C.    PreInit
D.    PreLoad

Answer: B


http://www.passleader.com/70-515.html

QUESTION 51
You are implementing an ASP.NET page that hosts a user control named CachedControl. You need to ensure that the content of the user control is cached for 10 seconds and that it is regenerated when fetched after the 10 seconds elapse. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A.    Modify the hosting page’s caching directive as follows.
<%@ OutputCache Duration=”10″ VaryByParam=”None” %>
B.    Add the following meta tag to the Head section of the hosting page.
<meta http-equiv=”refresh” content=”10″>
C.    Add the following caching directive to the hosted control.
<%@ OutputCache Duration=”10″ VaryByParam=”None” %>
D.    Add the following caching directive to the hosted control.
<%@ OutputCache Duration=”10″ VaryByControl=”None” %>

Answer: AC

QUESTION 52
You have created an ASP.NET server control named ShoppingCart for use by other developers. Some developers report that the ShoppingCart control does not function properly with ViewState disabled. You want to ensure that all instances of the ShoppingCart control work even if ViewState is disabled. What should you do?

A.    Require developers to set EnableViewStateMac to true.
B.    Store state in ControlState instead of ViewState.
C.    Serialize the state into an Application state entry called “MyControl”
D.    Require developers to change the session state mode to SQL Server.

Answer: B

QUESTION 53
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 SQL Server 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.

Answer: B

QUESTION 54
You are developing a Web page. The user types a credit card number into an input control named cc and clicks a button named submit. The submit button sends the credit card number to the server. A JavaScript library includes a CheckCreditCard function that returns a value of true if the credit card appears to be valid, based on its checksum. You need to ensure that the form cannot be used to submit invalid credit card numbers to the server. What should you do?

A.    Configure the input control to run on the server.
On the submit button, add a server-side OnClick handler that calls CheckCreditCard and rejects the form submission if the input is invalid.
B.    On the input control, add an onChange handler that calls CheckCreditCard and cancels the form submission when the input is invalid.
C.    Configure the input control and the submit button to run on the server.
Add a submit_OnClick handler that calls CheckCreditCard and rejects the form submission if the input is invalid.
D.    On the form, add an onSubmit handler that calls CheckCreditCard and cancels the form submission if the input is invalid.

Answer: D

QUESTION 55
You are developing an ASP.Net MVC 2 view and controller. The controller includes an action method that retrieves rows from a Product table in Microsoft SQL Server database. You need to cache the data that the action method returns. What should you do?

A.    Add the following <outputCacheSettings> section to the web.config file.
<system.web>
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name=”ProductView” duration=”60″
varyByParam=”*”/>
</outputCacheProfiles>
</outputCacheSettings>
</caching>
</system.web>
B.    Add the following line of code to the controller.
Cache.insert(“key”, “ProductView”, null, DateTime.Now.AddMinutes(60),TimeSpan.Zero);
C.    Add the following attribute to the action method
[OutputCache(Duration=60)];
D.    Add the following directive to the top of the view
<%@ OutPutCache Duration=”60″ VaryByParam=”*” %>

Answer: A

QUESTION 56
You are developing an ASP.NET Web application. The application includes a Icomparer<string> implementation named CaseInsensitiveComparer that compares strings without case sensitivity. You add the following method.(Line numbers are included for reference only.)
01 public IEnumerable<string>SortWords(string[] words)
02 {
03
04 }
You need to sort the array by word length and then by alphabetic order, ignoring case. Which code segment should you add at line 03?

A.    return words.Orderby(a  => a, new CaseInsensitiveComparer()).ThenBy(a =>a.Length);
B.    return words.Orderby(a =>a.Length).Orderby(a => a,new CaseInSensitiveComparer());
C.    return words.Orderby(a =>a.Length).ThenBy(a=> a, new CaseInSensitiveComparer());
D.    return words.Orderby(a =>a.Length.toString(), new CaseInSensitiveComparer());

Answer: C

QUESTION 57
You are implementing an ASP.Net web page that includes a Treeview control. You need to ensure that the TreeView control nodes are populated only when they are first expanded. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A.    Set the PopulateNodesFromClient property of the TreeView control to true.
B.    Add an event handler to the TreeNodeDataBound event that includes code to populate the node.
C.    Set the PopulateOnDemand property of the TreeNode control to true.
D.    Add an event handler to the TreeNodePopulate event than includes code to populate the node.

Answer: CD

QUESTION 58
You are implementing an ASP.NET web application. The application defines the following classes.
public class Person
{
public String Name{get; set;}
publicIList<Address> Addresses{get;set;}
}
public class Address
{
public String AddressType{get; set;}
public string AddressValue{get;set;}
}
The applicaction must generate XML from personList, wich is a collection of Person instances. The following XML is an example of the schema than the generated XML must use.
<Persons>
<Person Name=”John Doe”>
<Address Email=”[email protected]”/>
<Address AlternativeEmail=”[email protected]”/>
<Address MSNInstanceMessenger=”[email protected]”/>
</Person>
…..
</Persons>
You need to generate the XML. Wich code segment should you use?

A.    var XML= new XElement(“Persons”,
from person in personList
Select (new XElement(“Persons”, newXElement(“Name”, person.Name),
from addr in person.Addresses
select new XElement(“Address”, newXElement(addr.AddressType, addr.AddressValue)))));
B.    var XML= new XAttribute(“Persons”,
from person in personList
Select (new XElement(“Persons”, newXAttribute(“Name”, person.Name),
from addr in person.Addresses
select new XAttribute(“Address”, newXAttribute(addr.AddressType, addr.AddressValue)))));
C.    var XML= new XElement(“Persons”,
from person in personList
Select (new XElement(“Persons”, newXAttribute(“Name”, person.Name))));
D.    var XML= new XElement(“Persons”,
from person in personList
Select (new XElement(“Person”, newXAttribute(“Name”, person.Name),
from addr in person.Addresses
select new XElement(“Address”, newXAttribute(addr.AddressType, addr.AddressValue)))));

Answer: D

QUESTION 59
You are developing an ASP.NET web page. The page must display data from XML file named Inventory.xml. Inventory.xml contains data in the following format.
<?xml version=”1.0″ standalone=”yes”?>
<inventory>
<vehicle Make=”BMW” Model=”M3″ Year=”2005″ Price=”30000″
instock=”Yes”>
<Ratings>….</Ratings>
</Vechicle>
….
</Inventory>
You need to display Vehicle elements that have the inStock attribute set to YES. Wich two controls should you add to the page? (Each control presents part of the solution.Choose two.)

A.    <asp:GridView ID=”GridView1″ runat=”server”
AutoGenerateColumns=”True”
DataSource=”inventoryXMLDataSource”>
….
</asp:GridView>
B.    <asp:GridView ID=”GridView1″ runat=”server”
AutoGenerateColumns=”True”
DataSourceID=”inventoryXMLDataSource”>
….
</asp:GridView>
C.    <asp:XMLDataSource ID=”InventoryXMLDataSource”
runat=”server” DataFile=”Inventory.xml”
XPath=”/Inventory/Car[@InStock=’Yes’]”>
</asp:XMLDataSource>
D.    <asp:XMLDataSource ID=”InventoryXMLDataSource”
runat=”server” DataFile=”Inventory.xml”
XPath=”/Inventory/Car/InStock=’Yes'”>
<Data>Inventory.xml</Data>
</asp:XMLDataSource>

Answer: AC

QUESTION 60
You are implementing an ASP.NET page that includes a text box. You need to validate values that are typed by users to ensure that only numeric values are submitted. Which control markup should you use?

A.    <asp:TextBox ID=”txt1″ runat=”server” CausesValidation=”true” ValidationGroup=”Numeric” />
B.    <asp:TextBox ID=”txt1″ runat=”server” EnableClientScript=”true” ValidationGroup=”Numeric” />
C.    <asp:TextBox ID=”txt1″ runat=”server” />
<asp:RegularExpressionValidator ID=”val1″ runat=”server”
ControlToValidate=”txt1″ ValidationExpression=”[0-9]*” ErrorMessage=”Invalid input value” />
D.    <asp:TextBox ID=”txt1″ runat=”server” />
<asp:RegularExpressionValidator ID=”val1″
EnableClientScript=”true”
ControlToValidate=”txt1″
ValidationExpression=”[0-9]*” ErrorMessage=”Invalid input value” />

Answer: C
Explanation:
JavaScript executes as users enter and leave the focus of the controls on your page. Client-side validation is turned on by default. You can turn it off for specific validation controls by setting the EnableClientScript property to false.


http://www.passleader.com/70-515.html

Welcome To Visit PassLeader