70-515VB Exam
Exam Number/Code : 70-515VB
Exam Name : Web Applications Development with Microsoft VB.NET Framework 4 Practice Test
Questions and Answers : 102 Q&As
Question: 1
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: 2
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: 3
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.SelectedIndexChangedPage.UICulture = ddlLanguage.SelectedValueEnd 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.LoadPage.Culture = Request.Form("ddlLanguage")End Sub
D. Protected Overrides Sub InitializeCulture()Page.Culture = ddlLanguage.SelectedValueEnd Sub
Answer: B
Question: 4
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: 5
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. Private Sub Page_PreInit(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.PreInitIf Not IsPostBack ThengvCustomers.DataSource = GetCustomers()gvCustomers.DataBind()End If End Sub
B. Protected Sub Page_Load(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.LoadgvCustomers.DataSource = GetCustomers()gvCustomers.DataBind() End Sub
C. Private Sub gvCustomers_DataBinding(ByVal sender As Object,ByVal e As System.EventArgs) Handles gvCustomers.DataBindinggvCustomers.DataSource = GetCustomers()gvCustomers.DataBind() End Sub
D. Private Sub Page_PreRender(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.PreRenderIf Not IsPostBack ThengvCustomers.DataSource = GetCustomers()gvCustomers.DataBind()End If End Sub
Answer: B
详情请访问ciscodk的官网