Being worried about passing your 70-515 exam? Why not trying PassLeader’s 70-515 VCE or PDF dumps? We PassLeader now are offering the accurate 299q 70-515 exam questions and answers, you can get all the real exam questions from our 70-515 exam dumps. All our 299q 70-515 practice tests are the newest and same with the real test. We ensure that you can pass 70-515 exam easily with our premium 70-515 study guide! Now visit passleader.com to get the valid 70-515 braindumps with free version VCE Player!
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 101
You are developing an ASP.NET web page. The page includes the following EntityDataSource control:
<asp:EntityDataSource ID=”EntityDataSource1″ runat=”server” ConnectionString=”name=AdventureWorksEntities” DefaultContainerName=”AdventureWorksEntities” EnableFlattening=”False” EntitySetName=”Products” />
The page must filter the data that is displayed in a grid on a query string parameter named ProductPrefix. The grid must display products whose ProductName starts with the query string value. You need to ensure that the page generates the appropriate database query. What should you do?
A. Add the following element to the EntityDataSource control:
<WhereParameters>
<asp:DynamicQueryStringParameter QueryStringField=”ProductPrefix” Name=”ProductName” />
</WhereParameters>
B. Add the following element to the EntityDataSource control:
<WhereParameters>
<asp:QueryStringParameter QueryStringField=”ProductPrefix” Name=”ProductName” />
</WhereParameters>
C. Add the following element to the EntityDataSource control:
<asp:QueryExtender ID=”QueryExtender1″ runat=”server” TargetControlID=”EntityDataSource1″>
<asp:PropertyExpression Name=”ProductName” />
<asp:DynamicFilterExpression ControlID=”ProductPrefix” />
</asp:QueryExtender>
D. Add the following element to the EntityDataSource control:
<asp:QueryExtender ID=”QueryExtender1″ runat=”server” TargetControlID=”EntityDataSource1″>
<asp:SearchExpression SearchType=”StartsWith” DataFields=”ProductName”>
<asp:QueryStringParameter QueryStringField=”ProductPrefix” />
</asp:SearchExpression>
</asp:QueryExtender>
Answer: D
QUESTION 102
You are perfoming security testing on an existing asp.net web page. You notice that you are able to issue unauthorised postback requests to the page. You need to prevent unauthorised post back requests. which page directive you use?
A. <%@Page strict = “true” %>
B. <%@Page enableViewStateMac = “true” %>
C. <%@Page EnableEventValidation = “true” %>
D. <%@Page Aspcompact = “true” %>
Answer: C
QUESTION 103
You are developing an ASP.NET web application. The application includes the following Entity Data Model (EDM). You instantiate an ObjectContext for the EDM named context. You need to find the total number of addresses that are associated with customers that have a non-null middle name. Which LINQ to Entities query should you use?
A. var query = context.Customers
Where(c => c.MiddleName != null)
Select(c => c.CustomerAddresses.Count();
B. var query = context.Customers
Where(c => c.MiddleName != null)
SelectMany(c => c.CustomerAddresses.Count();
C. var query = context.Addresses
SelectMany(a => a.CustomerAddresses.OfType<Customer>()
Where(c => c.MiddleName != null)).Count();
D. var query = context.Addresses
GroupBy(a => a.CustomerAddresses
Where(ca => ca.Customer.MiddleName != null)).Count();
Answer: B
QUESTION 104
The page will be posted to the server after one or more image files are selected for upload. You need to ensure that all unuploaded files are saved to the server within one call to a single event handler. What should you do?
A. Read the HttpRequest.Files property and call the HttpPostedFile.SaveAs method for each file.
B. Read the HttpRequest.inputStream property and call the System.Io.File.WriteLines method for each file.
C. Read the HttpRequest.inputStream property and call the HttpResponse.WriteLine method for each file.
D. Read the HttpRequest.Files property and call the System.Io.File.WriteLines method for each file.
Answer: A
QUESTION 105
You are developing an ASP.NET web application that you will deploy to an Internet Information Services (IIS) 7.0 server. The application will run in Integrated pipeline mode. The application contains a phot gallery of images that are stored in a Microsoft SQL Server database. You need to ensure that the application can retrieve images from the database without blocking IIS worker process threads. What should you do?
A. Create a synchronous HttpHandler that is registered in the <httpHandlers> section in the web.config file.
B. Create an asynchronous HttpHandler that is registered in the <handlers> section under system.webServer in the web.config file.
C. Create a custom HttpModule that is registered in the <httpModules> section in the web.config file.
D. Create an asynchronous HttpHandler that is registered in the <httpHandlers> section in the web.config file.
Answer: B
QUESTION 106
You are adding new capabilities to an ASP.NET web site. The site currently connects to a Microsoft SQL Server database by using the credentials of the CONTOSO\AppIdentity account, which has been granted access to only objects within the database. The application requires the following implementation:
– Database objects that support ASP.NET roles must be added to the existing database.
– The Contoso\AppIdentity user must be granted only the minimum privileges that are required to support all features of ASP.NET roles.
You need to add the ASP.NET roles support. Which two actions should you perform? (Each correct answer presents part of the complete solution. Choose two.)
A. Use the aspnet_regsql tool.
B. Use the aspnet_regiis tool.
C. Add the CONTOSO\AppIdentity user to the asp_Roles_FullAccess database role.
D. Add the CONTOSO\AppIdentity user to the db_accessadmin database role.
Answer: AC
QUESTION 107
You are developing an ASP.NET MVC 2 Web application. A page makes an AJAX request and expects a list of company names in the following format.
[“Adventure Works”,”Contoso”]
You need to write an action method that returns the response in the correct format. Which type should you return from the action method?
A. AjaxHelper
B. XDocument
C. JsonResult
D. DataContractJsonSerializer
Answer: C
QUESTION 108
You are developing an ASP.NET Dynamic Data Web application. Boolean fields must display as Yes or No instead of as a check box. You replace the markup in the default Boolean field template with the following markup:
<asp:Label runat=”server” ID=”label” />
You need to implement the code that displays Yes or No. Which method of the FieldTemplateUserControl class should you override in the BooleanField class?
A. OnLoad
B. Construct
C. OnDataBinding
D. SaveControlState
Answer: C
QUESTION 109
You are developing an ASP.NET Web service. The following code segment implements the service. (Line numbers are included for reference only.)
01 [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
02 public class ProductService : System.Web.Services.WebService
03 {
04 [WebMethod]
05 public Product GetProduct(string name)
06 {
07
08 }
09
10 [WebMethod]
11 public Product GetProduct(int id)
12 {
13
14 }
15 }
You need to ensure that both GetProduct methods can be called from a Web client. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Remove line 01.
B. Add the static modifier on lines 05 and 11.
C. Add the following attribute before line 10.
[SoapDocumentMethod(Action=”GetProductById”)]
D. Modify the attribute on line 10 as follows.
[WebMethod(MessageName=”GetProductById”)]
Answer: AD
QUESTION 110
You are developing an ASP.NET Web application. Application data is stored in a Microsoft SQL Server 2008 database. You configure a connection string named cnnContoso. The application must cache the data that is returned from the database by using this connection string. You need to ensure that the application checks the database every 10 seconds. What should you do?
A. Add the following configuration to the <system.web> section of the web.config file.
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name=”cnnContoso” duration=”10″ />
</outputCacheProfiles>
</outputCacheSettings>
</caching>
B. Add the following configuration to the <system.web> section of the web.config file.
<caching>
<sqlCacheDependency enabled=”true” pollTime=”10000″>
<databases>
<add name=”ContosoDatabase” connectionStringName=”cnnContoso” />
</databases>
</sqlCacheDependency>
</caching>
C. Add the following @ Page directive to pages that query the database.
<%@ OutputCache Duration=”10″ VaryByParam=”cnnContoso” %>
D. Add the following @ Page directive to pages that query the database.
<%@ OutputCache Duration=”10000″ VaryByParam=”cnnContoso” %>
Answer: B
http://www.passleader.com/70-515.html
QUESTION 111
You are developing an ASP.NET Web page that contains input controls, validation controls, and a button named btnSubmit. The page has the following code-behind. (Line numbers are included for reference only.)
01 public partial class _Default : System.Web.UI.Page
02 {
03 protected void SaveToDatabase()
04 {
05
06 }
07
08 protected void btnSubmit_Click(object sender, EventArgs e)
09 {
10
11 }
12 }
You need to ensure that all data that is submitted passes validation before the data is saved in a database. What should you do?
A. Add the following method override.
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
if (Page.IsValid) this.SaveToDatabase();
}
B. Add the following method override.
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (Page.IsValid) this.SaveToDatabase();
}
C. Add the following method override.
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
if (Page.IsValid) this.SaveToDatabase();
}
D. Add the following code segment at line 10.
if (Page.IsValid) this.SaveToDatabase();
Answer: D
QUESTION 112
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 Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim s As String = Master.CityName
End Sub
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 113
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:
Partial Public Class Custom Inherits System.Web.UI.MasterPage
Public Property Region As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
End Class
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.
Dim custom As Custom = Me.ParentlblRegion.Text = custom.Region
B. Add the following code segment to the Page_Load method of the page code-behind file.
Dim custom As Custom = Me.MasterlblRegion.Text = custom.Region
C. Add the following code segment to the Page_Load method of the Custom.Master.vb code-behind file.
Dim lblRegion As Label = Page.FindControl(“lblRegion”)lblRegion.Text = Me.Region
D. Add the following code segment to the Page_Load method of the Custom.Master.vb code-behind file.
Dim lblRegion As Label = Master.FindControl(“lblRegion”)lblRegion.Text = Me.Region
Answer: B
QUESTION 114
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 Sub SelectedLanguageChanged(ByVal sender As Object, ByVal e As EventArgs) Handles ddlLanguage.SelectedIndexChanged
Page.UICulture = ddlLanguage.SelectedValue
End Sub
B. Protected Overrides Sub InitializeCulture()
Page.UICulture = Request.Form(“ddlLanguage”)
End Sub
C. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Page.Culture = Request.Form(“ddlLanguage”)
End Sub
D. Protected Overrides Sub InitializeCulture()
Page.Culture = ddlLanguage.SelectedValue
End Sub
Answer: B
QUESTION 115
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. Dim numOfActiveBugs As Integer? = DirectCast(Cache(“ActiveBugs”), Integer?)
If Not numOfActiveBugs.HasValue Then
Dim result As Int32 = GetActiveBugs()
Cache.Insert(“ActiveBugs”, result, Nothing, DateTime.Now.AddSeconds(30), Cache.NoSlidingExpiration)
numOfActiveBugs = result
End If
ActiveBugs = numOfActiveBugs.Value
B. Dim numOfActiveBugs As Integer = CInt(Cache.Get(“ActiveBugs”))
If numOfActiveBugs <> 0 Then
Dim result As Integer = GetActiveBugs()
Cache.Insert(“ActiveBugs”, result, Nothing, DateTime.Now.AddSeconds(30), Cache.NoSlidingExpiration)
numOfActiveBugs = result
End If
ActiveBugs = numOfActiveBugs
C. Dim numOfActiveBugs As Integer = 0
If Cache(“ActiveBugs”) Is Nothing Then
Dim result As Integer = GetActiveBugs()
Cache.Add(“ActiveBugs”, result, Nothing, DateTime.Now.AddSeconds(30),Cache.NoSlidingExpiration,CacheItemPriority.Normal, Nothing)
numOfActiveBugs = resultv End If
ActiveBugs = numOfActiveBugs
D. Dim numOfActiveBugs As Integer = DirectCast(Cache(“ActiveBugs”), Integer?)
If Not numOfActiveBugs.HasValue Then
Dim result As Integer = GetActiveBugs()
Cache.Insert(“ActiveBugs”, result, Nothing, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(30))
numOfActiveBugs = result
End If
ActiveBugs = numOfActiveBugs.Value
Answer: A
QUESTION 116
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, Nothing, DateTime.Now.AddSeconds(60), TimeSpan.FromSeconds(15))
B. Cache.Insert(“Trigger”, DateTime.Now, Nothing, DateTime.Now.AddSeconds(60), Cache.NoSlidingExpiration)
Dim cd As CacheDependency = New CacheDependency(Nothing, New String() {“Trigger”})
Cache.Insert(“ActiveBugs”, result, cd, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(15))
C. Cache.Insert(“ActiveBugs”, result, Nothing, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(15))
Dim cd As CacheDependency = New CacheDependency(Nothing, New String() {“ActiveBugs”})
Cache.Insert(“Trigger”, DateTime.Now, cd, DateTime.Now.AddSeconds(60), Cache.NoSlidingExpiration)
D. Dim cd As CacheDependency = New CacheDependency(Nothing, New String() {“Trigger”})
Cache.Insert(“Trigger”, DateTime.Now, Nothing, DateTime.Now.AddSeconds(60), Cache.NoSlidingExpiration)
Cache.Insert(“ActiveBugs”, result, cd, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(15))
Answer: B
QUESTION 117
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 Property FirstName As String Public Property LastName As String End Class
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. Serializable
C. DataContract
Answer: B
QUESTION 118
You need to dynamically add TestUserControl.ascx to TestPage.aspx. Which code segment should you use?
A. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim userControl As Control = Page.LoadControl(“TestUserControl.ascx”)
Page.Form.Controls.Add(userControl)
End Sub
B. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim userControl As Control = Page.FindControl(“TestUserControl.ascx”)
Page.Form.Controls.Add(userControl)
End Sub
C. Private Sub TestPage_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
Dim userControl As Control = Page.LoadControl(“TestUserControl.ascx”)
Page.Form.Controls.Add(userControl)
End Sub
D. Private Sub TestPage_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
Dim userControl As Control = Page.FindControl
(“TestUserControl.ascx”Page.Form.Controls.Add(userControl)
End Sub
Answer: A
QUESTION 119
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.vb code-behind file.
Public ReadOnly Property CityName As String
Get
Return “New York”
End Get
End Property
B. Add the following line of code to the TestUserControl.ascx.vb code-behind file.
Protected ReadOnly CityName As String = “New York”
C. Add the following code segment to the TestPage.aspx.vb code-behind file.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim s As String = testControl.CityName
End Sub
D. Add the following code segment to the TestPage.aspx.vb code-behind file.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim s As String = testControl.Attributes(“CityName”)
End Sub
Answer: AC
QUESTION 120
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 Sub TestMethod()
…
End Sub
You define the following delegate.
Public Delegate Sub 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.vb.
Public Event MyEvent As MyEventHandler
B. Add the following line of code to TestUserControl.ascx.vb.
Public MyEvent As MyEventHandler
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
http://www.passleader.com/70-515.html