70-515|You are implementing an ASP.NET Dynamic Data Web site.

Question: 23

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?

A. Add a new Web page named Products.aspx to the Dynamic Data\PageTemplates folder of the Web site.

B. Add a new folder named Products to the Dynamic Data\CustomPages folder of the Web site. Add a new Web page named ListDetails.aspx to the Products folder.

C. Add a new Web user control named Products.ascx to the Dynamic Data\Filters folder of the Web site.
In the code-behind file for the control, change the base class from UserControl to System.Web.DynamicData.QueryableFilterUserControl.

D. Add a new Web user control named Products_ListDetails.ascx to the Dynamic Data\EntityTemplates folder of the Web site.
In the code-behind file for the control, change the base class from UserControl to System.Web.DynamicData.EntityTemplateUserControl.

Answer: B

70-515 | You are implementing custom ASP.NET server controls.You have a base class named Rotary Gauge Control and two subclasses named Compass Gauge Control and Speed Gauge Control.

Question : 22

You are implementing custom ASP.NET server controls.You have a base class named Rotary Gauge Control and two subclasses named Compass Gauge Control and Speed Gauge Control.Each control requires its own client JavaScript code in order to function properly.The JavaScript includes functions that are used to create the proper HTML elements for the control.You need to ensure that the JavaScript for each of these controls that is used in an ASP.NET page is included in the generated HTML page only once, even if the ASP.NET page uses multiple instances of thegiven control.What should you do?

A. Place the JavaScript in a file named controls.js and add the following code line to the Page_Load method of each control. Page .ClientScript .Register Client Script Include (this.GetType(), “script”,”controls.js”);
B. Add the following code line to the Page_Load method of each control, where strJavascript contains the JavaScript code for the control. Page. Client Script .Register Client Script Block(this.GetType(), “script”,strJavascript);
C. Add the following code line to the Page_Load method of each control, where CLASSNAME is the name of the control class and strJavascript contains the JavaScript code for the control.Page.ClientScript.RegisterStartupScript(typeof(CLASSNAME), “script”,strJavascript);
D. Add the following code line to the Page_Load method of each control, where CLASSNAME is the name of the control class and strJavascript contains the JavaScript code for the control. Page.ClientScript.RegisterClientScriptBlock(typeof(CLASSNAME), “script”, strJavascript);

Answer : D

70-515 | You use the following declaration to add a Web user control named TestUserControl.ascx to an ASP.NET page named TestPage.aspx.

Question : 21

You use the following declaration to add a Web user control named TestUserControl.ascx to an ASP.NET page named TestPage.aspx.<uc:TestUserControl ID=”testControl” runat=”server”/>You add the following code to the code-behind file of TestPage.aspx.private void TestMethod() {… }You define the following delegate.public delegate void MyEventHandler();You need to add an event of type MyEventHandler named MyEvent to TestUserControl.ascx and attach the page’s TestMethod method to the event.Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. Add the following line of code to TestUserControl.ascx.cs.public event MyEventHandler MyEvent;
B. Add the following line of code to TestUserControl.ascx.cs.public MyEventHandler MyEvent;
C. Replace the TestUserControl.ascx reference in TestPage.aspx with the following declaration.<uc:TestUserControl ID=”testControl” runat=”server” OnMyEvent=”TestMethod”/>
D. Replace the TestUserControl.ascx reference in TestPage.aspx with the following declaration.<uc:TestUserControl ID=”testControl” runat=”server” MyEvent=”TestMethod”/>

Answer : AC

70-515 | You create a Web page named TestPage.aspx and a user control named TestUser Control .ascx .TestPage.aspx uses TestUserControl.ascx as shown in the following line of code.

Question : 20

You create a Web page named TestPage.aspx and a user control named TestUser Control .ascx .TestPage.aspx uses TestUserControl.ascx as shown in the following line of code.<uc:TestUserControl ID=”testControl” runat=”server”/>On TestUserControl.ascx, you need to add a read-only member named CityName to return the value New York.You also must add code to TestPage.aspx to read this value.Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. Add the following line of code to the TestUserControl.ascx.cs code-behind file.
public string CityName {get { return “New York”; }}
B. Add the following line of code to the TestUserControl.ascx.cs code-behind file.protected readonly string CityName = “New York”;
C. Add the following code segment to the TestPage.aspx.cs code-behind file.protected void Page_Load(object sender, EventArgs e){string s = testControl.CityName;}
D. Add the following code segment to the TestPage.aspx.cs code-behind file.protected void Page_Load(object sender, EventArgs e){string s = testControl.Attributes[“CityName”];}

Answer :  AC

70-515 | You create a Web page named TestPage.aspx and a user control named contained in a file named TestUserControl.ascx.

Question : 19

You create a Web page named TestPage.aspx and a user control named contained in a file named TestUserControl.ascx.You need to dynamically add TestUserControl.ascx to TestPage.aspx.Which code segment should you use?

A. protected void Page_Load(object sender, EventArgs e){Control userControl = Page.LoadControl(“TestUserControl.ascx”);Page.Form.Controls.Add(userControl);}
B. protected void Page_Load(object sender, EventArgs e) {Control userControl = Page.FindControl(“TestUserControl.ascx”);Page.Form.Controls.Load(userControl);}
C. protected void Page_PreInit(object sender, EventArgs e){Control userControl = Page.LoadControl(“TestUserControl.ascx”);Page.Form.Controls.Add(userControl);}
D. protected void Page_PreInit(object sender, EventArgs e){Control userControl = Page.FindControl(“TestUserControl.ascx”);Page.Form.Controls.Load(userControl);}

Answer : C

70-515 |You are implementing an ASP.NET application that will use session state in out-of-proc mode. You add the following code.

Question : 18

You are implementing an ASP.NET application that will use session state in out-of-proc mode. You add the following code.
public class Person
{public string FirstName { get; set;}
public string LastName { get; set;}}
You need to add an attribute to the Person class to ensure that you can save an instance to session state.Which attribute should you use?

A. Bindable
B. DataObject
C. Serializable
D. DataContract

Answer : C

70-515 | You are implementing a method in an ASP.NET application that includes the following requirements.Store the number of active bugs in the cache.

Question : 17

You are implementing a method in an ASP.NET application that includes the following requirements.Store the number of active bugs in the cache.The value should remain in the cache when there are calls more often than every 15 seconds.The value should be removed from the cache after 60 seconds.You need to add code to meet the requirements.Which code segment should you add?

A. Cache.Insert(“ActiveBugs”,result,null,DateTime.Now.AddSeconds(60),TimeSpan.FromSeconds(15));
B. Cache.Insert(“Trigger”,DateTime.Now,null,DateTime.Now.AddSeconds(60),
Cache.NoSlidingExpiration); CacheDependency cd = new CacheDependency(null, new string[]{ “Trigger ” }); Cache.Insert(“ActiveBugs”, result, cd, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(15));
C. Cache.Insert(“ActiveBugs”, result, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(15)) ;CacheDependency cd = new CacheDependency(null, new string[] { “ActiveBugs” });Cache.Insert (“Trigger”, DateTime.Now, cd, DateTime.Now.AddSeconds(60), Cache.NoSlidingExpiration);
D. CacheDependency cd = new CacheDependency(null, new string[] { “Trigger” }); Cache.Insert (“Trigger”,DateTime.Now, null, DateTime.Now.AddSeconds(60), Cache.NoSlidingExpiration); Cache .Insert(“ActiveBugs”, result, cd, Cache.NoAbsoluteExpiration, TimeSpan. FromSeconds(15));

Answer : B

70-515 Sample Question : 16

Question : 16

You are implementing an ASP.NET Web site.The site allows users to explicitly choose the display language for the site’s Web pages.You create a Web page that contains a DropDownList named ddlLanguage, as shown in the following code segment.
<asp:DropDownList ID=”ddlLanguage” runat=”server” AutoPostBack=”True” ClientIDMode=”Static”
OnSelectedIndexChanged=”SelectedLanguageChanged”>
<asp:ListItem Value=”en”>English</asp:ListItem>
<asp:ListItem Value=”es”>Spanish</asp:ListItem>
<asp:ListItem Value=”fr”>French</asp:ListItem>
<asp:ListItem Value=”de”>German</asp:ListItem>
</asp:DropDownList>
The site contains localized resources for all page content that must be translated into the language that is selected by the user.You need to add code to ensure that the page displays content in the selected language if the user selects a language in the drop-down list.Which code segment should you use?

A. protected void SelectedLanguageChanged(object sender, EventArgs e) {Page.UICulture = ddlLanguage.SelectedValue;}
B. protected override void InitializeCulture() {Page.UICulture = Request.Form[“ddlLanguage”];}
C. protected void Page_Load(object sender, EventArgs e) {Page.Culture = Request.Form[“ddlLanguage”];}
D. protected override void InitializeCulture() {Page.Culture = ddlLanguage.SelectedValue;}

Answer : B

70-515 Sample Question : 15

Question : 15

You are implementing an ASP.NET Web site.The root directory of the site contains a page named Error.aspx.You need to display the Error.aspx page if an unhandled error occurs on any page within the site.You also must ensure that the original URL in the browser is not changed.What should you do?

A. Add the following configuration to the web.config file.
<system.web><customErrors mode=”On”><error statusCode=”500″ redirect=”~/Error.aspx” /></customErrors></system.web>
B. Add the following configuration to the web.config file.<system.web><customErrors redirectMode=”ResponseRewrite” mode=”On”defaultRedirect=”~/Error.aspx” /></system.web>
C. Add the following code segment to the Global.asax file.void Application_Error(object sender, EventArgs e){Response.Redirect(“~/Error.aspx”);}
D. Add the following code segment to the Global.asax file.void Page_Error(object sender, EventArgs e){
Server.Transfer(“~/Error.aspx”);}

Answer : B

70-515 Sample Question : 14

Question : 14

You are creating an ASP.NET Web site. You create a HTTP module named CustomModule, and you register the module in the web.config file.The CustomModule class contains the following code.public class CustomModule : IHttpModule string footerContent = “<div>Footer Content</div>”;public void Dispose() {}}You need to add code to CustomModule to append the footer content to each processed ASP.NET page.Which code segment should you use?

A. public CustomModule(HttpApplication app){app.EndRequest += new EventHandler(app_EndRequest);void app_EndRequest(object sender, EventArgs e){HttpApplication app = sender asHttpApplication;app.Response.Write(footerContent);}
B. public void Init(HttpApplication app){app.EndRequest += new EventHandler(app_EndRequest);void app_EndRequest(object sender, EventArgs e){HttpApplication app = new HttpApplication();app.Response.Write(footerContent);}
C. public customModule();{HttpApplication app = newHttpApplication();app.EndRequest += new EventHandler(app_EndRequest);}
void app_EndRequest(object sender, EventArgs e){HttpApplication app = sender as HttpApplication;app.Response.Write(footerContent);}
D. public void Init(HttpApplication app) {app.EndRequest += new EventHandler(app_EndRequest);}void app_EndRequest(object sender, EventArgs e){HttpApplication app = sender asHttpApplication;app.Response.Write(footerContent);}

Answer : D

70-515 Sample Question : 13

Question : 13

You are creating an ASP.NET Web site.The site is configured to use Membership and Role management providers.You need to check whether the currently logged-on user is a member of a role named Administrators.Which code segment should you use?

A. bool isMember = Roles.GetUsersInRole(“Administrators”).Any();
B. bool isMember = Membership.ValidateUser(User.Identity.Name, “Administrators”);
C. bool isMember = Roles.GetRolesForUser(“Administrators”).Any();
D. bool isMember = User.IsInRole(“Administrators”);

Answer : D

70-515 Sample Question : 12

Question : 12

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. this.hdr1.InnerHtml = “Text”;
B. (hdr1.Parent as HtmlGenericControl).InnerText = “Text”;
C. HtmlGenericControl h1 = this.FindControl(“hdr1”) as HtmlGenericControl; h1.InnerText = “Text”;
D. HtmlGenericControl h1 = Parent.FindControl(“hdr1”) as HtmlGenericControl; h1.InnerText = “Text”;

Answer : AC

70-515 Sample Question : 11

Question : 11

You use the following declaration to add a Web user control named TestUserControl.ascx to an ASP.NET page named TestPage.aspx.<uc:TestUserControl ID=”testControl” runat=”server”/>You add the following code to the code-behind file of TestPage.aspx.private void TestMethod(){… }You define the following delegate. public delegate void MyEventHandler();You need to add an event of type MyEventHandler named MyEvent to TestUserControl.ascx and attach the page’s TestMethod method to the event.Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. Add the following line of code to TestUserControl.ascx.cs.public event MyEventHandler MyEvent;
B. Add the following line of code to TestUserControl.ascx.cs.public MyEventHandler MyEvent;
C. Replace the TestUserControl.ascx reference in TestPage.aspx with the following declaration.<uc:TestUserControl ID=”testControl” runat=”server” OnMyEvent=”TestMethod”/>
D. Replace the TestUserControl.ascx reference in TestPage.aspx with the following declaration.<uc:TestUserControl ID=”testControl” runat=”server” MyEvent=”TestMethod”/>

Answer : AC

70-515 Sample Question : 10

Question : 10

You create a Web page named TestPage.aspx and a user control named TestUserControl.ascx.TestPage.aspx uses TestUserControl.ascx as shown in the following line of code.<uc:TestUserControl ID=”testControl” runat=”server”/>On TestUserControl.ascx, you need to add a read-only member named CityName to return the value “New York”.You also must add code to TestPage.aspx to read this value.Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. Add the following line of code to the TestUserControl.ascx.cs code-behind file.public string CityName{get { return “New York”; }}
B. Add the following line of code to the TestUserControl.ascx.cs code-behind file.protected readonly string CityName = “New York”;
C. Add the following code segment to the TestPage.aspx.cs code-behind file.protected void Page_Load(object sender, EventArgs e){string s = testControl.CityName;}
D. Add the following code segment to the TestPage.aspx.cs code-behind file.protected void Page_Load(object sender, EventArgs e){string s = testControl.Attributes[“CityName”];}

Answer : AC

70-515 Sample Question : 8

Question : 8

You are implementing an ASP.NET application that will use session state in out-of-proc mode. You add the following code.public class Person{public string FirstName { get; set;}public string LastName { get; set;}}You need to add an attribute to the Person class to ensure that you can save an instance to session state.Which attribute should you use?

A. Bindable
B. DataObject
C. Serializable
D. DataContract

Answer : C

Search Words: 70-515 Actual Test real exam questions answers practice test braindumps, free Q&A online dumps download and free 70-515 Actual Test discount coupon code available.

Leave a Comment.

18 − 11 =