web analytics

[Pass Ensure VCE Dumps] PassLeader Premium 299q 70-515 Exam Questions For Free Download (1-20)

The latest 70-515 exam was updated with a lot of new exam questions, old version 70-515 exam dumps are not valid at all, you should get the newest 299q 70-515 practice tests or braindumps to prepare it. Now, PassLeader just published the new 70-515 exam questions with PDF dumps and VCE test software, which have been corrected with many new questions and will help you passing 70-515 exam easily. Visit www.passleader.com now and get the premium 299q 70-515 exam dumps with new version VCE Player for free download.

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 1
You are implementing an ASP.NET application that uses data-bound GridView controls in multiple pages. You add JavaScript code to periodically update specific types of data items in these GridView controls. You need to ensure that the JavaScript code can locate the HTML elements created for each row in these GridView controls, without needing to be changed if the controls are moved from one pa to another. What should you do?

A.    Replace the GridView control with a ListView control.
B.    Set the ClientIDMode attribute to Predictable in the web.config file.
C.    Set the ClientIDRowSuffix attribute of each unique GridView control to a different value.
D.    Set the @ OutputCache directive’s VaryByControl attribute to the ID of the GridView control.

Answer: C

QUESTION 2
You are implementing an ASP.NET application that includes a page named TestPage.aspx. TestPage.aspx uses a master page named TestMaster.master. You add the following code to the TestPage.aspx code-behind file to read a TestMaster.master public property named CityName.
protected void Page_Load(object sender, EventArgs e)
{
string s = Master.CityName;
}
You need to ensure that TestPage.aspx can access the CityName property. What should you do?

A.    Add the following directive to TestPage.aspx.
<%@ MasterType VirtualPath=”~/TestMaster.master” %>
B.    Add the following directive to TestPage.aspx.
<%@ PreviousPageType VirtualPath=”~/TestMaster.master” %>
C.    Set the Strict attribute in the @ Master directive of the TestMaster.master page to true.
D.    Set the Explicit attribute in the @ Master directive of the TestMaster.master page to true.

Answer: A

QUESTION 3
You are implementing an ASP.NET page. You add asp:Button controls for Help and for Detail. You add an ASP.NET skin file named default.skin to a theme. You need to create and use a separate style for the Help button, and you must use the default style for the Detail button. What should you do?

A.    Add the following markup to the default.skin file.
<asp:Button ID=”Help”></asp:Button>
<asp:Button ID=”Default”></asp:Button>
Use the following markup for the buttons in the ASP.NET page.
<asp:Button SkinID=”Help”>Help</asp:Button>
<asp:Button SkinID=”Default”>Detail</asp:Button>
B.    Add the following markup to the default.skin file.
<asp:Button SkinID=”Help”></asp:Button>
<asp:Button ID=”Default”></asp:Button>
Use the following markup for the buttons in the ASP.NET page.
<asp:Button SkinID=”Help”>Help</asp:Button>
<asp:Button SkinID=”Default”>Detail</asp:Button>
C.    Add the following code segment to default.skin.
<asp:Button SkinID=”Help”></asp:Button>
<asp:Button></asp:Button>
Use the following markup for the buttons in the ASP.NET page.
<asp:Button SkinID=”Help”></asp:Button>
<asp:Button SkinID=”Default”>Detail</asp:Button>
D.    Add the following markup to default.skin.
<asp:Button SkinID=”Help”></asp:Button>
<asp:Button></asp:Button>
Use the following markup for the buttons in the ASP.NET page.
<asp:Button SkinID=”Help”>Help</asp:Button>
<asp:Button>Detail</asp:Button>

Answer: D

QUESTION 4
You are creating an ASP.NET Web site. The site has a master page named Custom.master. The code-behind file for Custom.master contains the following code segment.
public partial class CustomMaster : MasterPage
{
public string Region
{
get; set;
}
protected void Page_Load(object sender, EventArgs e)
{
}
}
You create a new ASP.NET page and specify Custom.master as its master page. You add a Label control named lblRegion to the new page. You need to display the value of the master page’s Region property in lblRegion. What should you do?

A.    Add the following code segment to the Page_Load method of the page code-behind file.
CustomMaster custom = this.Parent as CustomMaster;
lblRegion.Text = custom.Region;
B.    Add the following code segment to the Page_Load method of the page code-behind file.
CustomMaster custom = this.Master as CustomMaster;
lblRegion.Text = custom.Region;
C.    Add the following code segment to the Page_Load method of the Custom.Master.cs code-behind file.
Label lblRegion = Page.FindControl(“lblRegion”) as Label;
lblRegion.Text = this.Region;
D.    Add the following code segment to the Page_Load method of the Custom.Master.cs code-behind file.
Label lblRegion = Master.FindControl(“lblRegion”) as Label;
lblRegion.Text = this.Region;

Answer: B

QUESTION 5
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

QUESTION 6
You are implementing an ASP.NET application that includes the following requirements. Retrieve the number of active bugs from the cache, if the number is present. If the number is not found in the cache, call a method named GetActiveBugs, and save the result under the ActiveBugs cache key. Ensure that cached data expires after 30 seconds. You need to add code to fulfill the requirements. Which code segment should you add?

A.    int? numOfActiveBugs = (int?)Cache[“ActiveBugs”];
if (!numOfActiveBugs.HasValue)
{
int result = GetActiveBugs();
Cache.Insert(“ActiveBugs”, result, null,
DateTime.Now.AddSeconds(30), Cache.NoSlidingExpiration);
numOfActiveBugs = result;
}
ActiveBugs = numOfActiveBugs.Value;
B.    int numOfActiveBugs = (int) Cache.Get(“ActiveBugs”);
if (numOfActiveBugs != 0)
{
int result = GetActiveBugs();
Cache.Insert(“ActiveBugs”, result, null,
DateTime.Now.AddSeconds(30), Cache.NoSlidingExpiration);
numOfActiveBugs = result;
}
ActiveBugs = numOfActiveBugs;
C.    int numOfActiveBugs = 0;
if (Cache[“ActiveBugs”] == null)
{
int result = GetActiveBugs();
Cache.Add(“ActiveBugs”, result, null, DateTime.Now.AddSeconds(30),
Cache.NoSlidingExpiration, CacheItemPriority.Normal, null);
Cache.NoSlidingExpiration, CacheItemPriority.Normal, null);
numOfActiveBugs = result;
}
ActiveBugs = numOfActiveBugs;
D.    int numOfActiveBugs = (int?)Cache[“ActiveBugs”];
if (!numOfActiveBugs.HasValue)
{
int result = GetActiveBugs();
Cache.Insert(“ActiveBugs”, result, null,
Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(30));
numOfActiveBugs = result;
}
ActiveBugs = numOfActiveBugs.Value;

Answer: A

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

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

QUESTION 9
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

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


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

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

QUESTION 12
You create a custom server control named Task that contains the following code segment. (Line numbers are included for reference only.)
01 namespace DevControls
02 {
03 public class Task : WebControl
04 {
05 [DefaultValue(“”)]
06 public string Title { … }
07
08 protected override void RenderContents(HtmlTextWriter output)
09 {
10 output.Write(Title);
11 }
12 }
13 }
You need to ensure that adding a Task control from the Toolbox creates markup in the following format.
<Dev:Task ID=”Task1″ runat=”server” Title=”New Task” />
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A.    Add the following code segment to the project’s AssemblyInfo.cs file.
[assembly: TagPrefix(“DevControls”, “Dev”)]
B.    Replace line 05 with the following code segment.
[DefaultValue(“New Task”)]
C.    Insert the following code segment immediately before line 03.
[ToolboxData(“<{0}:Task runat=\”server\” Title=\”New Task\” />”)]
D.    Replace line 10 with the following code segment.
output.Write(“<Dev:Task runat=\”server\” Title=\”New Task\” />”);

Answer: AC

QUESTION 13
You are implementing an ASP.NET page that includes the following drop-down list.
<asp:PlaceHolder ID=”dynamicControls” runat=”server”>
<asp:DropDownList ID=”MyDropDown” runat=”server”>
<asp:ListItem Text=”abc” value=”abc” />
<asp:ListItem Text=”def” value=”def” />
</asp:DropDownList>
</asp:PlaceHolder>
You need to dynamically add values to the end of the drop-down list. What should you do?

A.    Add the following OnPreRender event handler to the asp:DropDownList
protected void MyDropDown_PreRender(object sender, EventArgs e)
{
DropDownList ddl = sender as DropDownList;
Label lbl = new Label();
lbl.Text = “Option”;
lbl.ID = “Option”;
ddl.Controls.Add(lbl);
}
B.    Add the following OnPreRender event handler to the asp:DropDownList
protected void MyDropDown_PreRender(object sender, EventArgs e)
{
DropDownList ddl = sender as DropDownList;
ddl.Items.Add(“Option”);
}
C.    Add the following event handler to the page code-behind.
protected void Page_LoadComplete(object sender, EventArgs e)
{
DropDownList ddl = Page.FindControl(“MyDropDown”) as DropDownList;
Label lbl = new Label();
lbl.Text = “Option”;
lbl.ID = “Option”;
ddl.Controls.Add(lbl);
}
D.    Add the following event handler to the page code-behind.
protected void Page_LoadComplete(object sender, EventArgs e)
{
DropDownList ddl = Page.FindControl(“MyDropDown”) as DropDownList;
ddl.Items.Add(“Option”);
}

Answer: B

QUESTION 14
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

QUESTION 15
You are implementing custom ASP.NET server controls. You have a base class named RotaryGaugeControl and two subclasses named CompassGaugeControl and SpeedGaugeControl. 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 the given 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.RegisterClientScriptInclude(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.ClientScript.RegisterClientScriptBlock(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

QUESTION 16
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

QUESTION 17
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 as HttpApplication;
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 = new HttpApplication();
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 as HttpApplication;
app.Response.Write(footerContent);
}

Answer: D

QUESTION 18
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

QUESTION 19
You are implementing an ASP.NET Web site. The site uses a component that must be dynamically configured before it can be used within site pages. You create a static method named SiteHelper.Configure that configures the component. You need to add a code segment to the Global.asax file that invokes the SiteHelper.Configure method the first time, and only the first time, that any page in the site is requested. Which code segment should you use?

A.    void Application_Start(object sender, EventArgs e)
{
SiteHelper.Configure();
}
B.    void Application_Init(object sender, EventArgs e)
{
SiteHelper.Configure();
}
C.    void Application_BeginRequest(object sender, EventArgs e)
{
SiteHelper.Configure();
}
D.    Object lockObject = new Object();
void Application_BeginRequest(object sender, EventArgs e)
{
lock(lockObject())
{
SiteHelper.Configure();
}
}

Answer: A

QUESTION 20
You create a Visual Studio 2010 solution that includes a WCF service project and an ASP.NET project. The service includes a method named GetPeople that takes no arguments and returns an array of Person objects. The ASP.NET application uses a proxy class to access the service. You use the Add Service Reference wizard to generate the class. After you create the proxy, you move the service endpoint to a different port. You need to configure the client to use the new service address. In addition, you must change the implementation so that calls to the client proxy will return a List<Person> instead of an array. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A.    In the context menu for the service reference in the ASP.NET project, select the Configure Service Reference command, and set the collection type to System.Collections.Generic.List.
B.    In the context menu for the service reference in the ASP.NET project, select the Update Service Reference command to retrieve the new service configuration.
C.    Change the service interface and implementation to return a List<Person>
D.    Edit the address property of the endpoint element in the web.config file to use the new service address.

Answer: AD


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

Welcome To Visit PassLeader