1. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web page that contains the following two XML fragments. (Line numbers are included for

reference only.)

01 <script runat="server">

02

03 </script>

04 <asp:ListView ID="ListView1" runat="server"

05      DataSourceID="SqlDataSource1"

06

07      >

08 <ItemTemplate>

09       <td>

10          <asp:Label ID="LineTotalLabel" runat="server"

11           Text='<%# Eval("LineTotal") %>' />

12       </td>

13 </ItemTemplate>

The SqlDataSource1 object retrieves the data from a Microsoft SQL Server 2005 database table. The

database table has a column named LineTotal.

You need to ensure that when the size of the LineTotal column value is greater than seven characters, the

column is displayed in red color.

What should you do?

A. Insert the following code segment at line 06.

OnItemDataBound="FmtClr"

Insert the following code segment at line 02.

protected void FmtClr

(object sender, ListViewItemEventArgs e)

{

     Label LineTotal = (Label)

     e.Item.FindControl("LineTotalLabel");


    | English | Chinese | Japan | Korean |           -2-             Test Information Co., Ltd. All rights reserved.
if ( LineTotal.Text.Length > 7)

     { LineTotal.ForeColor = Color.Red; }

     else

     {LineTotal.ForeColor = Color.Black; }

}

B. Insert the following code segment at line 06.

OnItemDataBound="FmtClr"

Insert the following code segment at line 02.

protected void FmtClr

(object sender, ListViewItemEventArgs e)

{

     Label LineTotal = (Label)

     e.Item.FindControl("LineTotal");

     if ( LineTotal.Text.Length > 7)

     {LineTotal.ForeColor = Color.Red; }

     else

     {LineTotal.ForeColor = Color.Black; }

}

C. Insert the following code segment at line 06.

OnDataBinding="FmtClr"

Insert the following code segment at line 02.

protected void FmtClr(object sender, EventArgs e)

{

     Label LineTotal = new Label();

     LineTotal.ID = "LineTotal";

     if ( LineTotal.Text.Length > 7)

     {LineTotal.ForeColor = Color.Red; }

     else

     { LineTotal.ForeColor = Color.Black; }


    | English | Chinese | Japan | Korean |          -3-   Test Information Co., Ltd. All rights reserved.
}

D. Insert the following code segment at line 06.

OnDataBound="FmtClr"

Insert the following code segment at line 02.

protected void FmtClr(object sender, EventArgs e)

{

     Label LineTotal = new Label();

     LineTotal.ID = "LineTotalLabel";

     if ( LineTotal.Text.Length > 7)

     {LineTotal.ForeColor = Color.Red; }

     else

     {LineTotal.ForeColor = Color.Black; }

}

Answer: A



2. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web page that contains the following two XML fragments. (Line numbers are included for

reference only.)

01 <script runat="server">

02

03 </script>

04 <asp:ListView ID="ListView1" runat="server"

05      DataSourceID="SqlDataSource1"

06

07      >

08 <ItemTemplate>

09       <td>

10          <asp:Label ID="LineTotalLabel" runat="server"

11           Text='<%# Eval("LineTotal") %>' />


    | English | Chinese | Japan | Korean |           -4-           Test Information Co., Ltd. All rights reserved.
12     </td>

13 </ItemTemplate>

The SqlDataSource1 object retrieves the data from a Microsoft SQL Server 2005 database table. The

database table has a column named LineTotal.

You need to ensure that when the size of the LineTotal column value is greater than seven characters, the

column is displayed in red color.

What should you do?

A. Insert the following code segment at line 06.

OnItemDataBound="FmtClr"

Insert the following code segment at line 02.

Protected Sub FmtClr(ByVal sender As Object, _ByVal e As ListViewItemEventArgs)

  Dim LineTotal As Label = _

     DirectCast(e.Item.FindControl("LineTotalLabel"), Label)

  If LineTotal IsNot Nothing Then

      If LineTotal.Text.Length > 7 Then

        LineTotal.ForeColor = Color.Red

      Else

        LineTotal.ForeColor = Color.Black

      End If

  End If

End Sub

B. Insert the following code segment at line 06.

OnItemDataBound="FmtClr"

Insert the following code segment at line 02.

Protected Sub FmtClr(ByVal sender As Object, _ByVal e As ListViewItemEventArgs)

  Dim LineTotal As Label = _

     DirectCast(e.Item.FindControl("LineTotal"), Label)

  If LineTotal.Text.Length > 7 Then

      LineTotal.ForeColor = Color.Red


 | English | Chinese | Japan | Korean |              -5-             Test Information Co., Ltd. All rights reserved.
Else

     LineTotal.ForeColor = Color.Black

  End If

End Sub

C. Insert the following code segment at line 06.

OnDataBinding="FmtClr"

Insert the following code segment at line 02.

Protected Sub FmtClr(ByVal sender As Object, _ByVal e As EventArgs)

  Dim LineTotal As New Label()

  LineTotal.ID = "LineTotal"

  If LineTotal.Text.Length > 7 Then

     LineTotal.ForeColor = Color.Red

  Else

     LineTotal.ForeColor = Color.Black

  End If

End Sub

D. Insert the following code segment at line 06.

OnDataBound="FmtClr"

Insert the following code segment at line 02.

Protected Sub FmtClr(ByVal sender As Object, _ByVal e As EventArgs)

  Dim LineTotal As New Label()

  LineTotal.ID = "LineTotalLabel"

  If LineTotal.Text.Length > 7 Then

     LineTotal.ForeColor = Color.Red

  Else

     LineTotal.ForeColor = Color.Black

  End If

End Sub

Answer: A


 | English | Chinese | Japan | Korean |            -6-           Test Information Co., Ltd. All rights reserved.
3. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web form and add the following code fragment.

<asp:Repeater                                   ID="rptData"                                          runat="server"

DataSourceID="SqlDataSource1"ItemDataBound="rptData_ItemDataBound">

  <ItemTemplate>

       <asp:Label ID="lblQuantity" runat="server"

        Text='<%# Eval("QuantityOnHand") %>' />

  </ItemTemplate>

</asp:Repeater>

The SqlDataSource1 DataSource control retrieves the Quantity column values from a table named

Products.

You write the following code segment to create the rptData_ItemDataBound event handler. (Line numbers

are included for reference only.)

01 protected void rptData_ItemDataBound(object sender,

02     RepeaterItemEventArgs e)

03 {

04

05      if(lbl != null)

06      if(int.Parse(lbl.Text) < 10)

07      lbl.ForeColor = Color.Red;

08 }

You need to retrieve a reference to the lblQuantity Label control into a variable named lbl.

Which code segment should you insert at line 04?

A. Label lbl = Page.FindControl("lblQuantity") as Label;

B. Label lbl = e.Item.FindControl("lblQuantity") as Label;

C. Label lbl = rptData.FindControl("lblQuantity") as Label;

D. Label lbl = e.Item.Parent.FindControl("lblQuantity") as Label;

Answer: B


 | English | Chinese | Japan | Korean |              -7-               Test Information Co., Ltd. All rights reserved.
4.You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web form and add the following code fragment.

<asp:Repeater ID="rptData" runat="server"

DataSourceID="SqlDataSource1"

  ItemDataBound="rptData_ItemDataBound">

     <ItemTemplate>

      <asp:Label ID="lblQuantity" runat="server"

  Text='<%# Eval("QuantityOnHand") %>' />

     </ItemTemplate>

</asp:Repeater>

The SqlDataSource1 DataSource control retrieves the Quantity column values from a table named

Products.

You write the following code segment to create the rptData_ItemDataBound event handler. (Line numbers

are included for reference only.)

01 Protected Sub rptData_ItemDataBound(ByVal sender As Object, _

02 ByVal e As RepeaterItemEventArgs)

03

04 If lbl IsNot Nothing Then

05 If Integer.Parse(lbl.Text) < 10 Then

06 lbl.ForeColor = Color.Red

07 End If

08 End If

09 End Sub

You need to retrieve a reference to the lblQuantity Label control into a variable named lbl.

Which code segment should you insert at line 03?

A. Dim lbl As Label = _

TryCast(Page.FindControl("lblQuantity"), Label)

B. Dim lbl As Label = _


 | English | Chinese | Japan | Korean |             -8-                Test Information Co., Ltd. All rights reserved.
TryCast(e.Item.FindControl("lblQuantity"), Label)

C. Dim lbl As Label = _

TryCast(rptData.FindControl("lblQuantity"), Label)

D. Dim lbl As Label = _

TryCast(e.Item.Parent.FindControl("lblQuantity"), Label)

Answer: B



5. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

Your application has a user control named UserCtrl.ascx. You write the following code fragment to create

a Web page named Default.aspx.

<%@ Page Language="C#" AutoEventWireup="true"

CodeFile="Default.aspx.cs" Inherits="_Default" %>

<html>

...

<body>

      <form id="form1" runat="server">

       <div>

        <asp:Label ID="lblHeader" runat="server"></asp:Label>

        <asp:Label ID="lbFooter" runat="server"></asp:Label>

       </div>

      </form>

</body>

</html>

You need to dynamically add the UserCtrl.ascx control between the lblHeader and lblFooter Label

controls.

What should you do?

A. Write the following code segment in the Init event of the Default.aspx Web page.

Control ctrl = LoadControl("UserCtrl.ascx");

this.Controls.AddAt(1, ctrl);


 | English | Chinese | Japan | Korean |              -9-             Test Information Co., Ltd. All rights reserved.
B. Write the following code segment in the Init event of the Default.aspx Web page.

Control ctrl = LoadControl("UserCtrl.ascx");

lblHeader.Controls.Add(ctrl);

C. Add a Literal control named Ltrl between the lblHeader and lblFooter label controls.

Write the following code segment in the Init event of the Default.aspx Web page.

Control ctrl = LoadControl("UserCtrl.ascx");

D. Add a PlaceHolder control named PlHldr between the lblHeader and lblFooter label controls.

Write the following code segment in the Init event of the Default.aspx Web page.

Control ctrl = LoadControl("UserCtrl.ascx");

PlHldr.Controls.Add(ctrl);

Answer: D



6. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

Your application has a user control named UserCtrl.ascx. You write the following code fragment to create

a Web page named Default.aspx.

<%@ Page Language="VB" AutoEventWireup="true"

CodeFile="Default.aspx.vb" Inherits="_Default" %>

<html>

...

<body>

      <form id="form1" runat="server">

       <div>

         <asp:Label ID="lblHeader" runat="server"></asp:Label>

         <asp:Label ID="lbFooter" runat="server"></asp:Label>

       </div>

      </form>

</body>

</html>

You need to dynamically add the UserCtrl.ascx control between the lblHeader and lblFooter Label


 | English | Chinese | Japan | Korean |             - 10 -             Test Information Co., Ltd. All rights reserved.
controls.

What should you do?

A. Write the following code segment in the Init event of the Default.aspx Web page.

Dim ctrl As Control = LoadControl("UserCtrl.ascx")

Me.Controls.AddAt(1, ctrl)

B. Write the following code segment in the Init event of the Default.aspx Web page.

Dim ctrl As Control = LoadControl("UserCtrl.ascx")

lblHeader.Controls.Add(ctrl)

C. Add a Literal control named Ltrl between the lblHeader and lblFooter label controls.

Write the following code segment in the Init event of the Default.aspx Web page.

Dim ctrl As Control = LoadControl("UserCtrl.ascx")

D. Add a PlaceHolder control named PlHldr between the lblHeader and lblFooter label controls.

Write the following code segment in the Init event of the Default.aspx Web page.

Dim ctrl As Control = LoadControl("UserCtrl.ascx")

PlHldr.Controls.Add(ctrl)

Answer: D



7. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create two user controls named UserCtrlA.ascx and UserCtrlB.ascx. The user controls postback to

the server.

You create a new Web page that has the following ASPX code.

<asp:CheckBox ID="Chk" runat="server"

oncheckedchanged="Chk_CheckedChanged" AutoPostBack="true" />

<asp:PlaceHolder ID="PlHolder" runat="server"></asp:PlaceHolder>

To dynamically create the user controls, you write the following code segment for the Web page.

public void LoadControls()

{

     if (ViewState["CtrlA"] != null)

      {


    | English | Chinese | Japan | Korean |           - 11 -            Test Information Co., Ltd. All rights reserved.
Control c;

         if ((bool)ViewState["CtrlA"] == true)

         { c = LoadControl("UserCtrlA.ascx"); }

     else

         { c = LoadControl("UserCtrlB.ascx"); }

         c.ID = "Ctrl";

         PlHolder.Controls.Add(c);

}

}

protected void Chk_CheckedChanged(object sender, EventArgs e)

{

ViewState["CtrlA"] = Chk.Checked;

PlHolder.Controls.Clear();

LoadControls();

}

You need to ensure that the user control that is displayed meets the following requirements:

¡¤It is recreated during postback

¡¤It retains its state.

Which method should you add to the Web page?

A. protected override object SaveViewState()

{

     LoadControls();

     return base.SaveViewState();

}

B. protected override void Render(HtmlTextWriter writer)

{

     LoadControls();

     base.Render(writer);

}


    | English | Chinese | Japan | Korean |         - 12 -             Test Information Co., Ltd. All rights reserved.
C. protected override void OnLoadComplete(EventArgs e)

{

     base.OnLoadComplete(e);

     LoadControls();

}

D. protected override void LoadViewState(object savedState)

{

     base.LoadViewState(savedState);

     LoadControls();

}

Answer: D



8. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create two user controls named UserCtrlA.ascx and UserCtrlB.ascx. The user controls postback to

the server.

You create a new Web page that has the following ASPX code.

<asp:CheckBox ID="Chk" runat="server"

oncheckedchanged="Chk_CheckedChanged" AutoPostBack="true" />

<asp:PlaceHolder ID="PlHolder" runat="server"></asp:PlaceHolder>

To dynamically create the user controls, you write the following code segment for the Web page.

Public Sub LoadControls()

     If ViewState("CtrlA") IsNot Nothing Then

        Dim c As Control

        If CBool(ViewState("CtrlA")) = True Then

          c = LoadControl("UserCtrlA.ascx")

        Else

          c = LoadControl("UserCtrlB.ascx")

        End If

        c.ID = "Ctrl"


    | English | Chinese | Japan | Korean |         - 13 -            Test Information Co., Ltd. All rights reserved.
PlHolder.Controls.Add(c)

  End If

End Sub

Protected Sub Chk_CheckedChanged(ByVal sender As Object, _

ByVal e As EventArgs)

ViewState("CtrlA") = Chk.Checked

PlHolder.Controls.Clear()

LoadControls()

End Sub

You need to ensure that the user control that is displayed meets the following requirements:

¡¤It is recreated during postback

¡¤It retains its state.

Which method should you add to the Web page?

A. Protected Overloads Overrides Function _

SaveViewState() As Object

LoadControls()

Return MyBase.SaveViewState()

End Function

B. Protected Overloads Overrides _

Sub Render(ByVal writer As HtmlTextWriter)

LoadControls()

MyBase.Render(writer)

End Sub

C. Protected Overloads Overrides Sub _

OnLoadComplete(ByVal e As EventArgs)

MyBase.OnLoadComplete(e)

LoadControls()

End Sub

D. Protected Overloads Overrides Sub _


 | English | Chinese | Japan | Korean |            - 14 -             Test Information Co., Ltd. All rights reserved.
LoadViewState(ByVal savedState As Object)

MyBase.LoadViewState(savedState)

LoadControls()

End Sub

Answer: D



9. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create the following controls:

¡¤A composite custom control named MyControl.

¡¤A templated custom control named OrderFormData.

You write the following code segment to override the method named CreateChildControls() in the

MyControl class. (Line numbers are included for reference only.)

01 protected override void

02 CreateChildControls() {

03 Controls.Clear();

04 OrderFormData oFData = new

05 ?OrderFormData("OrderForm");

06

07 }

You need to add the OrderFormData control to the MyControl control.

Which code segment should you insert at line 06?

A. Controls.Add(oFData);

B. Template.InstantiateIn(this);

     Template.InstantiateIn(oFData);

C. Controls.Add(oFData);

     this.Controls.Add(oFData);

D. this.TemplateControl = (TemplateControl)Template;

     oFData.TemplateControl = (TemplateControl)Template;

     Controls.Add(oFData);


 | English | Chinese | Japan | Korean |            - 15 -             Test Information Co., Ltd. All rights reserved.
Answer: B



10. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create the following controls:

¡¤A composite custom control named MyControl.

¡¤A templated custom control named OrderFormData.

You write the following code segment to override the method named CreateChildControls() in the

MyControl class. (Line numbers are included for reference only.)

01 Protected Overloads Overrides Sub CreateChildControls()

02 Controls.Clear()

03 Dim oFData As New OrderFormData("OrderForm")

04

05 End Sub

You need to add the OrderFormData control to the MyControl control.

Which code segment should you insert at line 04?

A. Controls.Add(oFData)

B. Template.InstantiateIn(Me)

     Template.InstantiateIn(oFData)

C. Controls.Add(oFData)

     Me.Controls.Add(oFData)

D. Me.TemplateControl = DirectCast(Template, TemplateControl)

     oFData.TemplateControl = DirectCast(Template, TemplateControl)

     Controls.Add(oFData)

Answer: B



11. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a composite custom control named MyControl.

You need to add an instance of the OrderFormData control to the MyControl control.

Which code segment should you use?


 | English | Chinese | Japan | Korean |            - 16 -             Test Information Co., Ltd. All rights reserved.
A. protected override void CreateChildControls() {

Controls.Clear();

OrderFormData oFData = new OrderFormData("OrderForm");

Controls.Add(oFData);

}

B. protected override void

RenderContents(HtmlTextWriter writer) {

OrderFormData oFData = new OrderFormData("OrderForm");

oFData.RenderControl(writer);

}

C. protected override void EnsureChildControls() {

Controls.Clear();

OrderFormData oFData = new OrderFormData("OrderForm");

oFData.EnsureChildControls();

if (!ChildControlsCreated)

CreateChildControls();

}

D. protected override ControlCollection

CreateControlCollection() {

ControlCollection controls = new ControlCollection(this);

OrderFormData oFData = new OrderFormData("OrderForm");

controls.Add(oFData);

return controls;

}

Answer: A



12. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a composite custom control named MyControl.

You need to add an instance of the OrderFormData control to the MyControl control.


    | English | Chinese | Japan | Korean |           - 17 -         Test Information Co., Ltd. All rights reserved.
Which code segment should you use?

A. Protected Overloads Overrides Sub _

 CreateChildControls()

  Controls.Clear()

  Dim oFData As New OrderFormData("OrderForm")

  Controls.Add(oFData)

End Sub

B. Protected Overloads Overrides Sub _

 RenderContents(ByVal writer As HtmlTextWriter)

  Dim oFData As New OrderFormData("OrderForm")

  oFData.RenderControl(writer)

End Sub

C. Protected Overloads Overrides Sub _

 EnsureChildControls()

  Controls.Clear()

  Dim oFData As New OrderFormData("OrderForm")

  oFData.EnsureChildControls()

  If Not ChildControlsCreated Then

    CreateChildControls()

  End If

End Sub

D. Protected Overloads Overrides Function _

 CreateControlCollection() As ControlCollection

  Dim controls As New ControlCollection(Me)

  Dim oFData As New OrderFormData("OrderForm")

  controls.Add(oFData)

  Return controls

End Function

Answer: A


| English | Chinese | Japan | Korean |            - 18 -   Test Information Co., Ltd. All rights reserved.
13.You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a custom control named OrderForm.

You write the following code segment.

public delegate void

CheckOrderFormEventHandler(EventArgs e);

private static readonly object CheckOrderFormKey

= new object();

public event CheckOrderFormEventHandler

CheckOrderForm {

     add {

         Events.AddHandler(CheckOrderFormKey, value);

     }

         remove {

         Events.RemoveHandler(CheckOrderFormKey,

     value);

     }

}

You need to provide a method that enables the OrderForm control to raise the CheckOrderForm event.

Which code segment should you use?

A. protected virtual void OnCheckOrderForm(EventArgs e) {

     CheckOrderFormEventHandler checkOrderForm =

         (CheckOrderFormEventHandler)Events[

     typeof(CheckOrderFormEventHandler)];

     if (checkOrderForm != null)

     checkOrderForm(e);

}

B. protected virtual void OnCheckOrderForm(EventArgs e) {

     CheckOrderFormEventHandler checkOrderForm =


    | English | Chinese | Japan | Korean |         - 19 -          Test Information Co., Ltd. All rights reserved.
Events[CheckOrderFormKey] as CheckOrderFormEventHandler;

     if (checkOrderForm != null)

     checkOrderForm(e);

}

C. CheckOrderFormEventHandler checkOrderForm =

    new CheckOrderFormEventHandler(checkOrderFormCallBack);

protected virtual void OnCheckOrderForm(EventArgs e) {

     if (checkOrderForm != null)

     checkOrderForm(e);

}

D. CheckOrderFormEventHandler checkOrderForm =

new CheckOrderFormEventHandler(checkOrderFormCallBack);

protected virtual void OnCheckOrderForm(EventArgs e) {

     if (checkOrderForm != null)

     RaiseBubbleEvent(checkOrderForm, e);

}

Answer: B



14. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a custom control named OrderForm.

You write the following code segment.

Public Delegate Sub _

CheckOrderFormEventHandler(ByVal e As EventArgs)

Private Shared ReadOnly CheckOrderFormKey As New Object()

public event CheckOrderFormEventHandler

Public Custom Event CheckOrderForm As CheckOrderFormEventHandler

     AddHandler(ByVal value As CheckOrderFormEventHandler)

        Events.[AddHandler](CheckOrderFormKey, value)

     End AddHandler


    | English | Chinese | Japan | Korean |       - 20 -             Test Information Co., Ltd. All rights reserved.
RemoveHandler(ByVal value As CheckOrderFormEventHandler)

    Events.[RemoveHandler](CheckOrderFormKey, value)

  End RemoveHandler

  RaiseEvent(ByVal e As EventArgs)

  End RaiseEvent

End Event

You need to provide a method that enables the OrderForm control to raise the CheckOrderForm event.

Which code segment should you use?

A. Protected Overridable Sub _

 OnCheckOrderForm(ByVal e As EventArgs)

  Dim checkOrderForm As CheckOrderFormEventHandler = _

   DirectCast(Events(GetType(CheckOrderFormEventHandler)), _

   CheckOrderFormEventHandler)

  RaiseEvent CheckOrderForm(e)

End Sub

B. Protected Overridable Sub _

 OnCheckOrderForm(ByVal e As EventArgs)

  Dim checkOrderForm As CheckOrderFormEventHandler = _

  TryCast(Events(CheckOrderFormKey), _

  CheckOrderFormEventHandler)

  RaiseEvent CheckOrderForm(e)

End Sub

C. Private checkOrderForm As New _

 CheckOrderFormEventHandler(AddressOf _

 checkOrderFormCallBack)

Protected Overridable Sub _

 OnCheckOrderForm(ByVal e As EventArgs)

  If checkOrderForm IsNot Nothing Then

    checkOrderForm(e)


| English | Chinese | Japan | Korean |          - 21 -             Test Information Co., Ltd. All rights reserved.
End If

End Sub

D. Private checkOrderForm As New _

    CheckOrderFormEventHandler(AddressOf _

    checkOrderFormCallBack)

Protected Overridable Sub _

    OnCheckOrderForm(ByVal e As EventArgs)

     If checkOrderForm IsNot Nothing Then

        RaiseBubbleEvent(checkOrderForm, e)

     End If

End Sub

Answer: B



15. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You add a TextBox control named TextBox1.

You write the following code segment for validation.

protected void CustomValidator1_ServerValidate(

    object source, ServerValidateEventArgs args) {

     DateTime dt = String.IsNullOrEmpty(args.Value)

      DateTime.Now : Convert.ToDateTime(args.Value);

     args.IsValid = (DateTime.Now - dt).Days < 10;

}

You need to validate the value of TextBox1.

Which code fragment should you add to the Web page?

A.       <asp:CustomValidator        ID="CustomValidator1"      runat="server"    ControlToValidate="TextBox1"

ValidateEmptyText="True"

onservervalidate="CustomValidator1_ServerValidate">

</asp:CustomValidator>

B.                            <asp:RequiredFieldValidator                          ID="RequiredFieldValidator1"


    | English | Chinese | Japan | Korean |             - 22 -               Test Information Co., Ltd. All rights reserved.
runat="server"ControlToValidate="TextBox1"

InitialValue="<%= DateTime.Now; %>" >

</asp:RequiredFieldValidator>

C.    <asp:CustomValidator         ID="CustomValidator1"      runat="server"      ControlToValidate="TextBox1"

ValidateEmptyText="True"

onservervalidate="CustomValidator1_ServerValidate">

</asp:CustomValidator>

D.        <asp:CompareValidator           ID="CompareValidator1"             runat="server"                 Type="Date"

EnableClientScript="true"

 ControlToValidate="TextBox1" Operator="DataTypeCheck" >

</asp:CompareValidator>

E.   <asp:CustomValidator        ID="CustomValidator1"     runat="server"          ControlToValidate="TextBox1"

onservervalidate="CustomValidator1_ServerValidate">

</asp:CustomValidator>

F.           <asp:RequiredFieldValidator             ID="RequiredFieldValidator1"                        runat="server"

ControlToValidate="TextBox1" EnableClientScript="false" InitialValue="<%= DateTime.Now; %>" >

</asp:RequiredFieldValidator>

G.    <asp:CustomValidator        ID="CustomValidator1"       runat="server"      ControlToValidate="TextBox1"

ValidateEmptyText="True" onservervalidate="CustomValidator1_ServerValidate">

</asp:CustomValidator>

H.        <asp:CompareValidator           ID="CompareValidator1"             runat="server"                 Type="Date"

EnableClientScript="true" ControlToValidate="TextBox1" ValueToCompare="<%= DateTime.Now; %>">

</asp:CompareValidator>

Answer: B



16. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You add a TextBox control named TextBox1.

You write the following code segment for validation.

Protected Sub _


 | English | Chinese | Japan | Korean |              - 23 -                 Test Information Co., Ltd. All rights reserved.
CustomValidator1_ServerValidate(ByVal source As Object, _

     ByVal args As ServerValidateEventArgs)

     Dim dt As DateTime = _

      IIf([String].IsNullOrEmpty(args.Value), _

      DateTime.Now, Convert.ToDateTime(args.Value))

     args.IsValid = (DateTime.Now - dt).Days < 10

End Sub

You need to validate the value of TextBox1.

Which code fragment should you add to the Web page?

A.      <asp:CustomValidator      ID="CustomValidator1"       runat="server"      ControlToValidate="TextBox1"

ValidateEmptyText="True"

onservervalidate="CustomValidator1_ServerValidate">

</asp:CustomValidator>

B.             <asp:RequiredFieldValidator           ID="RequiredFieldValidator1"                         runat="server"

ControlToValidate="TextBox1"

InitialValue="<%= DateTime.Now; %>" >

</asp:RequiredFieldValidator>

C.      <asp:CustomValidator       ID="CustomValidator1"      runat="server"      ControlToValidate="TextBox1"

ValidateEmptyText="True"

onservervalidate="CustomValidator1_ServerValidate">

</asp:CustomValidator>

D.          <asp:CompareValidator          ID="CompareValidator1"            runat="server"                 Type="Date"

EnableClientScript="true"

 ControlToValidate="TextBox1" Operator="DataTypeCheck" >

</asp:CompareValidator>

E.     <asp:CustomValidator      ID="CustomValidator1"     runat="server"          ControlToValidate="TextBox1"

onservervalidate="CustomValidator1_ServerValidate">

</asp:CustomValidator>

F.             <asp:RequiredFieldValidator           ID="RequiredFieldValidator1"                        runat="server"


 | English | Chinese | Japan | Korean |              - 24 -                 Test Information Co., Ltd. All rights reserved.
ControlToValidate="TextBox1" EnableClientScript="false" InitialValue="<%= DateTime.Now; %>" >

</asp:RequiredFieldValidator>

G.         <asp:CustomValidator      ID="CustomValidator1"       runat="server"    ControlToValidate="TextBox1"

ValidateEmptyText="True" onservervalidate="CustomValidator1_ServerValidate">

</asp:CustomValidator>

H.            <asp:CompareValidator           ID="CompareValidator1"          runat="server"                 Type="Date"

EnableClientScript="true" ControlToValidate="TextBox1" ValueToCompare="<%= DateTime.Now; %>">

</asp:CompareValidator>

Answer: B



17. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You derive a new validation control from the BaseValidator class.

The validation logic for the control is implemented in the Validate method in the following manner.

protected static bool Validate(string value) {

     ...

}

You need to override the method that validates the value of the related control.

Which override method should you use?

A. protected override bool EvaluateIsValid() {

     string value = GetControlValidationValue(

     this.Attributes["AssociatedControl"]);

     bool isValid = Validate(value);

     return isValid;

}

B. protected override bool ControlPropertiesValid() {

     string value =

      GetControlValidationValue(this.ValidationGroup);

     bool isValid = Validate(value);

     return isValid;


    | English | Chinese | Japan | Korean |              - 25 -               Test Information Co., Ltd. All rights reserved.
}

C. protected override bool EvaluateIsValid() {

     string value =

      GetControlValidationValue(this.ControlToValidate);

     bool isValid = Validate(value);

     return isValid;

}

D. protected override bool ControlPropertiesValid() {

     string value = GetControlValidationValue(

     this.Attributes["ControlToValidate"]);

     bool isValid = Validate(value);

     this.PropertiesValid = isValid;

     return true;

}

Answer: C



18. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You derive a new validation control from the BaseValidator class.

The validation logic for the control is implemented in the Validate method in the following manner.

Protected Overloads Function Validate( _

    ByVal value As String) As Boolean

     ...

End Function

You need to override the method that validates the value of the related control.

Which override method should you use?

A. Protected Overloads Overrides Function EvaluateIsValid() As Boolean

     Dim value As String = _

      GetControlValidationValue(Me.Attributes("AssociatedControl"))

     Dim isValid As Boolean = Validate(value)


    | English | Chinese | Japan | Korean |           - 26 -            Test Information Co., Ltd. All rights reserved.
Return isValid

End Function

B. Protected Overloads Overrides _

 Function ControlPropertiesValid() As Boolean

  Dim value As String = _

   GetControlValidationValue(Me.ValidationGroup)

  Dim isValid As Boolean = Validate(value)

  Return isValid

End Function

C. Protected Overloads Overrides Function EvaluateIsValid() As Boolean

  Dim value As String = _

   GetControlValidationValue(Me.ControlToValidate)

  Dim isValid As Boolean = Validate(value)

  Return isValid

End Function

D. Protected Overloads Overrides Function ControlPropertiesValid() As Boolean

  Dim value As String = _

   GetControlValidationValue(Me.Attributes("ControlToValidate"))

  Dim isValid As Boolean = Validate(value)

  Me.PropertiesValid = isValid

  Return True

End Function

Answer: C



19. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You add an XmlDataSource control named XmlDataSource1 to the Web page. XmlDataSource1 is bound

to an XML document with the following structure.

<?xml version="1.0" encoding="utf-8" ?>

<clients>


| English | Chinese | Japan | Korean |             - 27 -           Test Information Co., Ltd. All rights reserved.
<client ID="1" Name="John Evans" />

     <client ID="2" Name="Mike Miller"/>

     ...

</clients>

You also write the following code segment in the code-behind file of the Web page.

protected void BulletedList1_Click(

?object sender, BulletedListEventArgs e) {

     //...

}

You need to add a BulletedList control named BulletedList1 to the Web page that is bound to

XmlDataSource1.

Which code fragment should you use?

A. <asp:BulletedList ID="BulletedList1" runat="server"

           DisplayMode="LinkButton" DataSource="XmlDataSource1"

           DataTextField="Name" DataValueField="ID"

           onclick="BulletedList1_Click">

      </asp:BulletedList>

B. <asp:BulletedList ID="BulletedList1" runat="server"

           DisplayMode="HyperLink" DataSourceID="XmlDataSource1"

           DataTextField="Name" DataMember="ID"

           onclick="BulletedList1_Click">

      </asp:BulletedList>

C. <asp:BulletedList ID="BulletedList1" runat="server"

           DisplayMode="LinkButton" DataSourceID="XmlDataSource1"

           DataTextField="Name" DataValueField="ID"

           onclick="BulletedList1_Click">

      </asp:BulletedList>

D. <asp:BulletedList ID="BulletedList1" runat="server"

           DisplayMode="HyperLink" DataSourceID="XmlDataSource1"


    | English | Chinese | Japan | Korean |            - 28 -         Test Information Co., Ltd. All rights reserved.
DataTextField="ID" DataValueField="Name"

        onclick="BulletedList1_Click">

   </asp:BulletedList>

Answer: C



20. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You add an XmlDataSource control named XmlDataSource1 to the Web page. XmlDataSource1 is bound

to an XML document with the following structure.

<?xml version="1.0" encoding="utf-8" ?>

<clients>

  <client ID="1" Name="John Evans" />

  <client ID="2" Name="Mike Miller"/>

  ...

</clients>

You also write the following code segment in the code-behind file of the Web page.

Protected Sub BulletedList1_Click(ByVal sender As _

?Object, ByVal e As BulletedListEventArgs)

  '...

End Sub

You need to add a BulletedList control named BulletedList1 to the Web page that is bound to

XmlDataSource1.

Which code fragment should you use?

A. <asp:BulletedList ID="BulletedList1" runat="server"

 DisplayMode="LinkButton" DataSource="XmlDataSource1"

 DataTextField="Name" DataValueField="ID"

 onclick="BulletedList1_Click">

</asp:BulletedList>

B. <asp:BulletedList ID="BulletedList1" runat="server"

 DisplayMode="HyperLink" DataSourceID="XmlDataSource1"


 | English | Chinese | Japan | Korean |            - 29 -            Test Information Co., Ltd. All rights reserved.
DataTextField="Name" DataMember="ID"

 onclick="BulletedList1_Click">

</asp:BulletedList>

C. <asp:BulletedList ID="BulletedList1" runat="server"

 DisplayMode="LinkButton" DataSourceID="XmlDataSource1"

 DataTextField="Name" DataValueField="ID"

 onclick="BulletedList1_Click">

</asp:BulletedList>

D. <asp:BulletedList ID="BulletedList1" runat="server"

 DisplayMode="HyperLink" DataSourceID="XmlDataSource1"

 DataTextField="ID" DataValueField="Name"

 onclick="BulletedList1_Click">

</asp:BulletedList>

Answer: C



21. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code fragment.

<asp:ListBox SelectionMode="Multiple"

 ID="ListBox1" runat="server">

</asp:ListBox>

<asp:ListBox ID="ListBox2" runat="server">

</asp:ListBox>

<asp:Button ID="Button1" runat="server"

?Text="Button" onclick="Button1_Click" />

You need to ensure that when you click the Button1 control, a selected list of items move from the

ListBox1 control to the ListBox2 control.

Which code segment should you use?

A. foreach (ListItem li in ListBox1.Items) {

  if (li.Selected) {


 | English | Chinese | Japan | Korean |            - 30 -           Test Information Co., Ltd. All rights reserved.
ListBox2.Items.Add(li);

         ListBox1.Items.Remove(li);

     }

}

B. foreach (ListItem li in ListBox1.Items) {

     if (li.Selected) {

         li.Selected = false;

         ListBox2.Items.Add(li);

         ListBox1.Items.Remove(li);

     }

}

C. foreach (ListItem li in ListBox1.Items) {

     if (li.Selected) {

         li.Selected = false;

         ListBox2.Items.Add(li);

     }

}

D. foreach (ListItem li in ListBox2.Items) {

     if (ListBox1.Items.Contains(li))

     ListBox1.Items.Remove(li);

}

E. foreach (ListItem li in ListBox1.Items) {

     if (li.Selected) {

         li.Selected = false;

         ListBox2.Items.Add(li);

     }

}

F. foreach (ListItem li in ListBox1.Items) {

     if (ListBox2.Items.Contains(li))


    | English | Chinese | Japan | Korean |     - 31 -   Test Information Co., Ltd. All rights reserved.
ListBox1.Items.Remove(li);

}

Answer: C



22. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code fragment.

<asp:ListBox SelectionMode="Multiple"

?ID="ListBox1" runat="server">

</asp:ListBox>

<asp:ListBox ID="ListBox2" runat="server">

</asp:ListBox>

<asp:Button ID="Button1" runat="server"

    Text="Button" onclick="Button1_Click" />

You need to ensure that when you click the Button1 control, a selected list of items move from the

ListBox1 control to the ListBox2 control.

Which code segment should you use?

A. For Each li As ListItem In ListBox1.Items

     If li.Selected Then

        ListBox2.Items.Add(li)

        ListBox1.Items.Remove(li)

     End If

Next

B. For Each li As ListItem In ListBox1.Items

     If li.Selected Then

        li.Selected = False

        ListBox2.Items.Add(li)

        ListBox1.Items.Remove(li)

     End If

Next


    | English | Chinese | Japan | Korean |       - 32 -             Test Information Co., Ltd. All rights reserved.
C. For Each li As ListItem In ListBox1.Items

  If li.Selected Then

     li.Selected = False

     ListBox2.Items.Add(li)

  End If

Next

D. For Each li As ListItem In ListBox2.Items

  If ListBox1.Items.Contains(li) Then

     ListBox1.Items.Remove(li)

  End If

Next

E. For Each li As ListItem In ListBox1.Items

  If li.Selected Then

     li.Selected = False

     ListBox2.Items.Add(li)

  End If

Next

F. For Each li As ListItem In ListBox1.Items

  If ListBox2.Items.Contains(li) Then

     ListBox1.Items.Remove(li)

  End If

Next

Answer: C



23. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code fragment.

<asp:DropDownList AutoPostBack="true"

?ID="DropDownList1" runat="server"

?onselectedindexchanged=


 | English | Chinese | Japan | Korean |          - 33 -             Test Information Co., Ltd. All rights reserved.
?"DropDownList1_SelectedIndexChanged">

  <asp:ListItem>1</asp:ListItem>

  <asp:ListItem>2</asp:ListItem>

  <asp:ListItem>3</asp:ListItem>

</asp:DropDownList>

You also add a MultiView control named MultiView1 to the Web page. MultiView1 has three child View

controls.

You need to ensure that you can select the View controls by using the DropDownList1 DropDownList

control.

Which code segment should you use?

A. int idx = DropDownList1.SelectedIndex;

MultiView1.ActiveViewIndex = idx;

B. int idx = DropDownList1.SelectedIndex;

MultiView1.Views[idx].Visible = true;

C. int idx = int.Parse(DropDownList1.SelectedValue);

MultiView1.ActiveViewIndex = idx;

D. int idx = int.Parse(DropDownList1.SelectedValue);

MultiView1.Views[idx].Visible = true;

Answer: A



24. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code fragment.

<asp:DropDownList AutoPostBack="true"

 ID="DropDownList1" runat="server"

 onselectedindexchanged=

 "DropDownList1_SelectedIndexChanged">

  <asp:ListItem>1</asp:ListItem>

  <asp:ListItem>2</asp:ListItem>

  <asp:ListItem>3</asp:ListItem>


 | English | Chinese | Japan | Korean |           - 34 -            Test Information Co., Ltd. All rights reserved.
</asp:DropDownList>

You also add a MultiView control named MultiView1 to the Web page. MultiView1 has three child View

controls.

You need to ensure that you can select the View controls by using the DropDownList1 DropDownList

control.

Which code segment should you use?

A. Dim idx As Integer = DropDownList1.SelectedIndex

MultiView1.ActiveViewIndex = idx

B. Dim idx As Integer = DropDownList1.SelectedIndex

MultiView1.Views(idx).Visible = True

C. Dim idx As Integer = Integer.Parse(DropDownList1.SelectedValue)

MultiView1.ActiveViewIndex = idx

D. Dim idx As Integer = Integer.Parse(DropDownList1.SelectedValue)

MultiView1.Views(idx).Visible = True

Answer: A



25. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

To add a Calendar server control to a Web page, you write the following code fragment.

<asp:Calendar SelectionMode="DayWeek"

    ID="Calendar1" runat="server">

</asp:Calendar>

You need to disable the non-week days in the Calendar control.

What should you do?

A. Add the following code segment to the Calendar1 DayRender event handler.

if (e.Day.IsWeekend) {

     e.Day.IsSelectable = false;

}

B. Add the following code segment to the Calendar1 DayRender event handler.

if (e.Day.IsWeekend) {


    | English | Chinese | Japan | Korean |        - 35 -             Test Information Co., Ltd. All rights reserved.
if (Calendar1.SelectedDates.Contains(e.Day.Date))

     Calendar1.SelectedDates.Remove(e.Day.Date);

}

C. Add the following code segment to the Calendar1 SelectionChanged event handler.

List<DateTime> list = new List<DateTime>();

foreach (DateTime st in (sender as Calendar).SelectedDates) {

     if (st.DayOfWeek == DayOfWeek.Saturday ||

     st.DayOfWeek == DayOfWeek.Sunday) {

         list.Add(st);

     }

}

foreach (DateTime dt in list) {

     (sender as Calendar).SelectedDates.Remove(dt);

}

D. Add the following code segment to the Calendar1 DataBinding event handler.

List<DateTime> list = new List<DateTime>();

foreach (DateTime st in (sender as Calendar).SelectedDates) {

     if (st.DayOfWeek == DayOfWeek.Saturday ||

     st.DayOfWeek == DayOfWeek.Sunday) {

         list.Add(st);

     }

}

foreach (DateTime dt in list) {

     (sender as Calendar).SelectedDates.Remove(dt);

}

Answer: A



26. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

To add a Calendar server control to a Web page, you write the following code fragment.


    | English | Chinese | Japan | Korean |         - 36 -            Test Information Co., Ltd. All rights reserved.
<asp:Calendar SelectionMode="DayWeek"

 ID="Calendar1" runat="server">

</asp:Calendar>

You need to disable the non-week days in the Calendar control.

What should you do?

A. Add the following code segment to the Calendar1 DayRender event handler.

If e.Day.IsWeekend Then

  e.Day.IsSelectable = False

End If

B. Add the following code segment to the Calendar1 DayRender event handler.

If e.Day.IsWeekend Then

  If Calendar1.SelectedDates.Contains(e.Day.Date) Then

    Calendar1.SelectedDates.Remove(e.Day.Date)

  End If

End If

C. Add the following code segment to the Calendar1 SelectionChanged event handler.

Dim list As New List(Of DateTime)()

For Each st As DateTime In TryCast(sender, Calendar).SelectedDates

  If st.DayOfWeek = DayOfWeek.Saturday OrElse _

   st.DayOfWeek = DayOfWeek.Sunday Then

    list.Add(st)

  End If

Next

For Each dt As DateTime In list

  TryCast(sender, Calendar).SelectedDates.Remove(dt)

Next

D. Add the following code segment to the Calendar1 DataBinding event handler.

Dim list As New List(Of DateTime)()

For Each st As DateTime In TryCast(sender, Calendar).SelectedDates


| English | Chinese | Japan | Korean |            - 37 -             Test Information Co., Ltd. All rights reserved.
If st.DayOfWeek = DayOfWeek.Saturday OrElse _

      st.DayOfWeek = DayOfWeek.Sunday Then

        list.Add(st)

     End If

Next

For Each dt As DateTime In list

     TryCast(sender, Calendar).SelectedDates.Remove(dt)

Next

Answer: A



27. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You define the following class.

public class Product {

     public decimal Price { get; set; }

}

Your application contains a Web form with a Label control named lblPrice.

You use a StringReader variable named xmlStream to access the following XML fragment.

<Product>

     <Price>35</Price>

</Product>

You need to display the price of the product from the XML fragment in the lblPrice Label control.

Which code segment should you use?

A. DataTable dt = new DataTable();

dt.ExtendedProperties.Add("Type", "Product");

dt.ReadXml(xmlStream);

lblPrice.Text = dt.Rows[0]["Price"].ToString();

B. XmlReader xr = XmlReader.Create(xmlStream);

Product boughtProduct =

    xr.ReadContentAs(typeof(Product), null) as Product;


    | English | Chinese | Japan | Korean |          - 38 -             Test Information Co., Ltd. All rights reserved.
lblPrice.Text = boughtProduct.Price.ToString();

C. XmlSerializer xs = new XmlSerializer(typeof(Product));

Product boughtProduct =

 xs.Deserialize(xmlStream) as Product;

lblPrice.Text = boughtProduct.Price.ToString();

D. XmlDocument xDoc = new XmlDocument();

xDoc.Load(xmlStream);

Product boughtProduct = xDoc.OfType<Product>().First();

lblPrice.Text = boughtProduct.Price.ToString();

Answer: C



28. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You define the following class.

Public Class Product

  Public Property Price() As Decimal

     Get

     End Get

     Set(ByVal value As Decimal)

     End Set

  End Property

End Class

Your application contains a Web form with a Label control named lblPrice.

You use a StringReader variable named xmlStream to access the following XML fragment.

<Product>

  <Price>35</Price>

</Product>

You need to display the price of the product from the XML fragment in the lblPrice Label control.

Which code segment should you use?

A. Dim dt As New DataTable()


 | English | Chinese | Japan | Korean |             - 39 -             Test Information Co., Ltd. All rights reserved.
dt.ExtendedProperties.Add("Type", "Product")

dt.ReadXml(xmlStream)

lblPrice.Text = dt.Rows(0)("Price").ToString()

B. Dim xr As XmlReader = XmlReader.Create(xmlStream)

Dim boughtProduct As Product = TryCast( _

 xr.ReadContentAs(GetType(Product), Nothing), Product)

lblPrice.Text = boughtProduct.Price.ToString()

C. Dim xs As New XmlSerializer(GetType(Product))

Dim boughtProduct As Product = TryCast( _

 xs.Deserialize(xmlStream), Product)

lblPrice.Text = boughtProduct.Price.ToString()

D. Dim xDoc As New XmlDocument()

xDoc.Load(xmlStream)

Dim boughtProduct As Product = xDoc.OfType(Of Product)().First()

lblPrice.Text = boughtProduct.Price.ToString()

Answer: C



29. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You add a Web form that contains the following code fragment.

<asp:GridView ID="gvProducts" runat="server"

 AllowSorting="True" DataSourceID="Products">

</asp:GridView>

<asp:ObjectDataSource ID="Products" runat="server"

 SelectMethod="GetData" TypeName="DAL" />

</asp:ObjectDataSource>

You write the following code segment for the GetData method of the DAL class. (Line numbers are

included for reference only.)

01 public object GetData() {

02    SqlConnection cnn = new SqlConnection(     -)


 | English | Chinese | Japan | Korean |           - 40 -            Test Information Co., Ltd. All rights reserved.
03     string strQuery = "SELECT * FROM Products";

04

05 }

You need to ensure that the user can use the sorting functionality of the gvProducts GridView control.

Which code segment should you insert at line 04?

A. SqlCommand cmd = new SqlCommand(strQuery, cnn);

cnn.Open();

return cmd.ExecuteReader();

B. SqlCommand cmd = new SqlCommand(strQuery, cnn);

cnn.Open();

return cmd.ExecuteReader(CommandBehavior.KeyInfo);

C. SqlDataAdapter da = new SqlDataAdapter(strQuery, cnn);

DataSet ds = new DataSet();

da.Fill(ds);

return ds;

D. SqlDataAdapter da = new SqlDataAdapter(strQuery, cnn);

DataSet ds = new DataSet();

da.Fill(ds);

ds.ExtendedProperties.Add("Sortable", true);

return ds.Tables[0].Select();

Answer: C



30. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You add a Web form that contains the following code fragment.

<asp:GridView ID="gvProducts" runat="server"

 AllowSorting="True" DataSourceID="Products">

</asp:GridView>

<asp:ObjectDataSource ID="Products" runat="server"

 SelectMethod="GetData" TypeName="DAL" />


 | English | Chinese | Japan | Korean |            - 41 -              Test Information Co., Ltd. All rights reserved.
</asp:ObjectDataSource>

You write the following code segment for the GetData method of the DAL class. (Line numbers are

included for reference only.)

01 Public Function GetData() As Object

02 Dim cnn As New SqlConnection(          -

03 Dim strQuery As String = "SELECT * FROM Products"

04

05 End Function

You need to ensure that the user can use the sorting functionality of the gvProducts GridView control.

Which code segment should you insert at line 04?

A. Dim cmd As New SqlCommand(strQuery, cnn)

cnn.Open()

Return cmd.ExecuteReader()

B. Dim cmd As New SqlCommand(strQuery, cnn)

cnn.Open()

Return cmd.ExecuteReader(CommandBehavior.KeyInfo)

C. Dim da As New SqlDataAdapter(strQuery, cnn)

Dim ds As New DataSet()

da.Fill(ds)

Return ds

D. Dim da As New SqlDataAdapter(strQuery, cnn)

Dim ds As New DataSet()

da.Fill(ds)

ds.ExtendedProperties.Add("Sortable", True)

Return ds.Tables(0).Select()

Answer: C



31. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a class that contains the following code segment. (Line numbers are included for reference


 | English | Chinese | Japan | Korean |            - 42 -              Test Information Co., Ltd. All rights reserved.
only.)

01 public object GetCachedProducts(sqlConnection conn) {

02

03       if (Cache["products"] == null) {

04           SqlCommand cmd = new SqlCommand(

05            "SELECT * FROM Products", conn);

07           conn.Open();

08           Cache.Insert("products", GetData(cmd));

09           conn.Close();

10       }

11       return Cache["products"];

12 }

13

14 public object GetData(SqlCommand prodCmd) {

15

16 }

Each time a Web form has to access a list of products, the GetCachedProducts method is called to

provide this list from the Cache object.

You need to ensure that the list of products is always available in the Cache object.

Which code segment should you insert at line 15?

A. return prodCmd.ExecuteReader();

     SqlDataReader dr;

     prodCmd.CommandTimeout = int.MaxValue;

B. dr = prodCmd.ExecuteReader();

     return dr;

C. SqlDataAdapter da = new SqlDataAdapter();

     da.SelectCommand = prodCmd;

     DataSet ds = new DataSet();

     return ds.Tables[0];


 | English | Chinese | Japan | Korean |                - 43 -           Test Information Co., Ltd. All rights reserved.
D. SqlDataAdapter da = new SqlDataAdapter(prodCmd);

     DataSet ds = new DataSet();

     da.Fill(ds);

     return ds;

Answer: D



32. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a class that contains the following code segment. (Line numbers are included for reference

only.)

01 Public Function GetCachedProducts( _

      ByVal conn As SqlConnection) As Object

02

03       If Cache("products") Is Nothing Then

04         Dim cmd As New SqlCommand("SELECT * FROM Products", conn)

05         conn.Open()

06         Cache.Insert("products", GetData(cmd))

07         conn.Close()

08       End If

09       Return Cache("products")

10 End Function

11

12 Public Function GetData(ByVal prodCmd As SqlCommand) As Object

13

14 End Function

Each time a Web form has to access a list of products, the GetCachedProducts method is called to

provide this list from the Cache object.

You need to ensure that the list of products is always available in the Cache object.

Which code segment should you insert at line 13?

A. Return prodCmd.ExecuteReader()


 | English | Chinese | Japan | Korean |             - 44 -              Test Information Co., Ltd. All rights reserved.
Dim dr As SqlDataReader

prodCmd.CommandTimeout = Integer.MaxValue

B. dr = prodCmd.ExecuteReader()

Return dr

C. Dim da As New SqlDataAdapter()

da.SelectCommand = prodCmd

Dim ds As New DataSet()

Return ds.Tables(0)

D. Dim da As New SqlDataAdapter(prodCmd)

Dim ds As New DataSet()

da.Fill(ds)

Return ds

Answer: D



33. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code segment in the code-behind file to create a Web form. (Line numbers are

included for reference only.)

01 string strQuery = "select * from Products;"

02 + "select * from Categories";

03 SqlCommand cmd = new SqlCommand(strQuery, cnn);

04 cnn.Open();

05 SqlDataReader rdr = cmd.ExecuteReader();

06

07 rdr.Close();

08 cnn.Close();

You need to ensure that the gvProducts and gvCategories GridView controls display the data that is

contained in the following two database tables:

¡¤The Products database tabl

¡¤The Categories database tabl


 | English | Chinese | Japan | Korean |           - 45 -            Test Information Co., Ltd. All rights reserved.
Which code segment should you insert at line 06?

A. gvProducts.DataSource = rdr;

   gvProducts.DataBind();

   gvCategories.DataSource = rdr;

   gvCategories.DataBind();

B. gvProducts.DataSource = rdr;

   gvCategories.DataSource = rdr;

   gvProducts.DataBind();

   gvCategories.DataBind();

C. gvProducts.DataSource = rdr;

   rdr.NextResult();

   gvCategories.DataSource = rdr;

   gvProducts.DataBind();

   gvCategories.DataBind();

D. gvProducts.DataSource = rdr;

   gvCategories.DataSource = rdr;

   gvProducts.DataBind();

   rdr.NextResult();

   gvCategories.DataBind();

Answer: D



34. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code segment in the code-behind file to create a Web form. (Line numbers are

included for reference only.)

01 Dim strQuery As String = "select * from Products;" + _

     "select * from Categories"

02 Dim cmd As New SqlCommand(strQuery, cnn)

03 cnn.Open()

04 Dim rdr As SqlDataReader = cmd.ExecuteReader()


 | English | Chinese | Japan | Korean |            - 46 -           Test Information Co., Ltd. All rights reserved.
05

06 rdr.Close()

07 cnn.Close()

You need to ensure that the gvProducts and gvCategories GridView controls display the data that is

contained in the following two database tables:

¡¤The Products database tabl

¡¤The Categories database tabl

Which code segment should you insert at line 05?

A. gvProducts.DataSource = rdr

     gvProducts.DataBind()

     gvCategories.DataSource = rdr

     gvCategories.DataBind()

B. gvProducts.DataSource = rdr

     gvCategories.DataSource = rdr

     gvProducts.DataBind()

     gvCategories.DataBind()

C. gvProducts.DataSource = rdr

     rdr.NextResult()

     gvCategories.DataSource = rdr

     gvProducts.DataBind()

     gvCategories.DataBind()

D. gvProducts.DataSource = rdr

     gvCategories.DataSource = rdr

     gvProducts.DataBind()

     rdr.NextResult()

     gvCategories.DataBind()

Answer: D



35. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.


 | English | Chinese | Japan | Korean |            - 47 -           Test Information Co., Ltd. All rights reserved.
You create a Web form that contains the following code fragment.

<asp:TextBox runat="server" ID="txtSearch" />

<asp:Button runat="server" ID="btnSearch" Text="Search"

?OnClick="btnSearch_Click" />

<asp:GridView runat="server" ID="gridCities" />

You write the following code segment in the code-behind file. (Line numbers are included for reference

only.)

01 protected void Page_Load(object sender, EventArgs e)

02 {

03       DataSet objDS = new DataSet();

04       SqlDataAdapter objDA = new SqlDataAdapter(objCmd);

05       objDA.Fill(objDS);

06       gridCities.DataSource = objDs;

07       gridCities.DataBind();

08       Session["ds"] = objDS;

09 }

10 protected void btnSearch_Click(object sender, EventArgs e)

11 {

12

13 }

You need to ensure that when the btnSearch Button control is clicked, the records in the gridCities

GridView control are filtered by using the value of the txtSearch TextBox.

Which code segment you should insert at line 12?

A. DataSet ds = gridCities.DataSource as DataSet;

  DataView dv = ds.Tables[0].DefaultView;

  dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'";

  gridCities.DataSource = dv;

  gridCities.DataBind();

B. DataSet ds = Session["ds"] as DataSet;


 | English | Chinese | Japan | Korean |             - 48 -             Test Information Co., Ltd. All rights reserved.
DataView dv = ds.Tables[0].DefaultView;

  dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'";

  gridCities.DataSource = dv;

  gridCities.DataBind();

C. DataTable dt = Session["ds"] as DataTable;

  DataView dv = dt.DefaultView;

  dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'";

  gridCities.DataSource = dv;

  gridCities.DataBind();

D. DataSet ds = Session["ds"] as DataSet;

  DataTable dt = ds.Tables[0];

  DataRow[] rows = dt.Select("CityName LIKE '" + txtSearch.Text + "%'");

  gridCities.DataSource = rows;

  gridCities.DataBind();

Answer: B



36. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web form that contains the following code fragment.

<asp:TextBox runat="server" ID="txtSearch" />

<asp:Button runat="server" ID="btnSearch" Text="Search"

?OnClick="btnSearch_Click" />

<asp:GridView runat="server" ID="gridCities" />

You write the following code segment in the code-behind file. (Line numbers are included for reference

only.)

01 Protected Sub Page_Load(ByVal sender As Object, _

02 ?ByVal e As EventArgs)

03       Dim objDS As New DataSet()

04       Dim objDA As New SqlDataAdapter(objCmd)

05       objDA.Fill(objDS)


 | English | Chinese | Japan | Korean |            - 49 -            Test Information Co., Ltd. All rights reserved.
06    gridCities.DataSource = objDS

07    gridCities.DataBind()

08    Session("ds") = objDS

09 End Sub

10 Protected Sub btnSearch_Click(ByVal sender As Object, _

11    ByVal e As EventArgs)

12

13 End Sub

You need to ensure that when the btnSearch Button control is clicked, the records in the gridCities

GridView control are filtered by using the value of the txtSearch TextBox.

Which code segment you should insert at line 12?

Dim ds As DataSet = TryCast(gridCities.DataSource, DataSet)

Dim dv As DataView = ds.Tables(0).DefaultView

dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'"

gridCities.DataSource = dv

gridCities.DataBind()

Dim ds As DataSet = TryCast(Session("ds"), DataSet)

Dim dv As DataView = ds.Tables(0).DefaultView

dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'"

gridCities.DataSource = dv

gridCities.DataBind()

Dim dt As DataTable = TryCast(Session("ds"), DataTable)

Dim dv As DataView = dt.DefaultView

dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'"

gridCities.DataSource = dv

gridCities.DataBind()

Dim ds As DataSet = TryCast(Session("ds"), DataSet)

Dim dt As DataTable = ds.Tables(0)

Dim rows As DataRow() = _


 | English | Chinese | Japan | Korean |             - 50 -             Test Information Co., Ltd. All rights reserved.
?dt.[Select]("CityName LIKE '" + txtSearch.Text + "%'")

gridCities.DataSource = rows

gridCities.DataBind()

Answer: B



37. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The

application consumes a Microsoft Windows Communication Foundation (WCF) service.

The WCF service exposes the following method.

[WebInvoke]

string UpdateCustomerDetails(string custID);

The application hosts the WCF service by using the following code segment.

WebServiceHost host = new WebServiceHost(typeof(CService),

 new Uri("http://win/"));

ServiceEndpoint ep = host.AddServiceEndpoint(typeof(ICService),

 new WebHttpBinding(), "");

You need to invoke the UpdateCustomerDetails method.

Which code segment should you use?

A. WebChannelFactory<ICService> wcf = new

 WebChannelFactory<ICService>(new Uri("http: //win"))

ICService channel = wcf.CreateChannel();

string s = channel.UpdateCustomerDetails("CustID12");

B. WebChannelFactory<ICService> wcf = new

 WebChannelFactory<ICService>(new Uri("http:

  //win/UpdateCustomerDetails"))

ICService channel = wcf.CreateChannel();

string s = channel.UpdateCustomerDetails("CustID12");

C. ChannelFactory<ICService> cf = new

 ChannelFactory<ICService>(new

 WebHttpBinding(), "http: //win/UpdateCustomerDetails")


| English | Chinese | Japan | Korean |             - 51 -           Test Information Co., Ltd. All rights reserved.
ICService channel = cf.CreateChannel();

string s = channel.UpdateCustomerDetails("CustID12");

D. ChannelFactory<ICService> cf = new

 ChannelFactory<ICService>(new

 BasicHttpBinding(), "http: //win ")

cf.Endpoint.Behaviors.Add(new WebHttpBehavior());

ICService channel = cf.CreateChannel();

string s = channel.UpdateCustomerDetails("CustID12");

Answer: A



38. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The

application consumes a Microsoft Windows Communication Foundation (WCF) service.

The WCF service exposes the following method.

<WebInvoke()> _

Function UpdateCustomerDetails(ByVal custID As String) As String

The application hosts the WCF service by using the following code segment.

Dim host As New WebServiceHost(GetType(CService), _

 New Uri("http://win/"))

Dim ep As ServiceEndpoint = host.AddServiceEndpoint( _

 GetType(ICService), New WebHttpBinding(), "")

You need to invoke the UpdateCustomerDetails method.

Which code segment should you use?

A. dim wcf As New WebChannelFactory(Of ICService)( _

 New Uri("http: //win"))

Dim channel As ICService = wcf.CreateChannel()

Dim s As String = channel.UpdateCustomerDetails("CustID12")

B. dim wcf As New WebChannelFactory(Of ICService)( _

 New Uri("http: //win/UpdateCustomerDetails"))

Dim channel As ICService = wcf.CreateChannel()


| English | Chinese | Japan | Korean |           - 52 -             Test Information Co., Ltd. All rights reserved.
Dim s As String = channel.UpdateCustomerDetails("CustID12")

C. Dim cf As New ChannelFactory(Of ICService)( _

 New WebHttpBinding(), "http: //win/UpdateCustomerDetails")

Dim channel As ICService = cf.CreateChannel()

Dim s As String = channel.UpdateCustomerDetails("CustID12")

D. Dim cf As New ChannelFactory(Of ICService)( _

 New BasicHttpBinding(), "http: //win ")

cf.Endpoint.Behaviors.Add(New WebHttpBehavior())

Dim channel As ICService = cf.CreateChannel()

Dim s As String = channel.UpdateCustomerDetails("CustID12")

Answer: A



39. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Microsoft Windows Communication Foundation (WCF) service that exposes the following

service contract. (Line numbers are included for reference only.)

01 [ServiceContract]

02 public interface IBlogService

03 {

04     [OperationContract]

05     [WebGet(ResponseFormat=WebMessageFormat.Xml)]

06     Rss20FeedFormatter GetBlog();

07 }

You configure the WCF service to use the WebHttpBinding class, and to be exposed at the following URL:

http://www.contoso.com/BlogService

You need to store the result of the GetBlog operation in an XmlDocument variable named xmlBlog in a

Web form.

Which code segment should you use?

A. string url = @"http: //www.contoso.com/BlogService/GetBlog";

XmlReader blogReader = XmlReader.Create(url);


 | English | Chinese | Japan | Korean |             - 53 -          Test Information Co., Ltd. All rights reserved.
xmlBlog.Load(blogReader);

B. string url = @"http: //www.contoso.com/BlogService";

XmlReader blogReader = XmlReader.Create(url);

xmlBlog.Load(blogReader);

C. Uri blogUri = new Uri(@"http: //www.contoso.com/BlogService");

ChannelFactory<IBlogService> blogFactory = new

 ChannelFactory<IBlogService>(blogUri);

IBlogService blogSrv = blogFactory.CreateChannel();

Rss20FeedFormatter feed = blogSrv.GetBlog();

xmlBlog.LoadXml(feed.ToString());

D. Uri blogUri = new Uri(@"http: //www.contoso.com/BlogService/GetBlog");

ChannelFactory<IBlogService> blogFactory = new

 ChannelFactory<IBlogService>(blogUri);

IBlogService blogSrv = blogFactory.CreateChannel();

Rss20FeedFormatter feed = blogSrv.GetBlog();

xmlBlog.LoadXml(feed.Feed.ToString());

Answer: A



40. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Microsoft Windows Communication Foundation (WCF) service that exposes the following

service contract. (Line numbers are included for reference only.)

01 <ServiceContract()> _

02 Public Interface IBlogService

03    <OperationContract()> _

04    <WebGet(ResponseFormat := WebMessageFormat.Xml)> _

05    Function GetBlog() As Rss20FeedFormatter

06 End Interface

You configure the WCF service to use the WebHttpBinding class and to be exposed at the following URL:

http://www.contoso.com/BlogService


| English | Chinese | Japan | Korean |              - 54 -          Test Information Co., Ltd. All rights reserved.
You need to store the result of the GetBlog operation in an XmlDocument variable named xmlBlog in a

Web form.

Which code segment should you use?

A. Dim url As String = "http: //www.contoso.com/BlogService/GetBlog"

Dim blogReader As XmlReader = XmlReader.Create(url)

xmlBlog.Load(blogReader)

B. Dim url As String = "http: //www.contoso.com/BlogService"

Dim blogReader As XmlReader = XmlReader.Create(url)

xmlBlog.Load(blogReader)

C. Dim binding As New BasicHttpBinding()

Dim blogUri As New _

 EndpointAddress("http: //www.contoso.com/BlogService")

Dim blogFactory As New _

 ChannelFactory(Of IBlogService)(binding, blogUri)

Dim blogSrv As IBlogService = blogFactory.CreateChannel()

Dim feed As Rss20FeedFormatter = blogSrv.GetBlog()

xmlBlog.LoadXml(feed.ToString())

D. Dim binding As New BasicHttpBinding()

Dim blogUri As New _

 EndpointAddress("http: //www.contoso.com/BlogService/GetBlog")

Dim blogFactory As New _

 ChannelFactory(Of IBlogService)(binding, blogUri)

Dim blogSrv As IBlogService = blogFactory.CreateChannel()

Dim feed As Rss20FeedFormatter = blogSrv.GetBlog()

xmlBlog.LoadXml(feed.Feed.ToString())

Answer: A



41. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You plan to add a custom parameter in the SqlDataSource control.


| English | Chinese | Japan | Korean |            - 55 -               Test Information Co., Ltd. All rights reserved.
You write the following code fragment.

<asp:SqlDataSource ID="SqlDataSource1" runat="server"

    InsertCommand="INSERT INTO [Employee] ([Field1], [Field2],

    [PostedDate]) VALUES (@Field1, @Field2, @PostedDate)">

     <InsertParameters>

        <asp:Parameter Name="Field1" />

        <asp:Parameter Name="Field2" />

        <custom:DayParameter?Name="PostedDate" />

     </InsertParameters>

</asp:SqlDataSource>

You write the following code segment to create a custom parameter class.

public class DayParameter : Parameter {

}

You need to ensure that the custom parameter returns the current date and time.

Which code segment should you add to the DayParameter class?

A. protected DayParameter()

: base("Value", TypeCode.DateTime, DateTime.Now.ToString())

{

}

B. protected override void LoadViewState(object savedState)

{

     ((StateBag)savedState).Add("Value", DateTime.Now);

}

C. protected override object Evaluate(HttpContext context, Control control) {

     return DateTime.Now;

}

D. protected override Parameter Clone()

{

     Parameter pm = new DayParameter();


    | English | Chinese | Japan | Korean |         - 56 -              Test Information Co., Ltd. All rights reserved.
pm.DefaultValue = DateTime.Now;

     return pm;

}

Answer: C



42. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You plan to add a custom parameter in the SqlDataSource control.

You write the following code fragment.

<asp:SqlDataSource ID="SqlDataSource1" runat="server"

    InsertCommand="INSERT INTO [Employee] ([Field1], [Field2],

    [PostedDate]) VALUES (@Field1, @Field2, @PostedDate)">

     <InsertParameters>

        <asp:Parameter Name="Field1" />

        <asp:Parameter Name="Field2" />

        <custom:DayParameter?Name="PostedDate" />

     </InsertParameters>

</asp:SqlDataSource>

You write the following code segment to create a custom parameter class.

Public Class DayParameter

     Inherits Parameter

End Class

You need to ensure that the custom parameter returns the current date and time.

Which code segment should you add to the DayParameter class?

A. Protected Sub New()

     MyBase.New("Value", TypeCode.DateTime, DateTime.Now.ToString())

End Sub

B. Protected Overloads Overrides Sub _

    LoadViewState(ByVal savedState As Object)

     DirectCast(savedState, _


    | English | Chinese | Japan | Korean |        - 57 -             Test Information Co., Ltd. All rights reserved.
StateBag).Add("Value", DateTime.Now)

End Sub

C. Protected Overloads Overrides Function _

    Evaluate(ByVal context As HttpContext, _

    ByVal control As Control) As Object

     Return DateTime.Now

End Function

D. Protected Overloads Overrides Function _

    Clone() As Parameter

     Dim pm As Parameter = New DayParameter()

     pm.DefaultValue = DateTime.Now

     Return pm

End Function

Answer: C



43. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The

application has an ASPX page named ErrorPage.aspx.

You plan to manage the unhandled application exceptions.

You need to perform the following tasks:

¡¤Display the ErrorPage.aspx page

¡¤Write the exceptioninformation in the Event log file.

Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. Add the following code fragment to the Web.config file.

<customErrors mode="On" defaultRedirect="ErrorPage.aspx" />

B. Add the following code fragment to the Web.config file.

<customErrors mode="Off" defaultRedirect="ErrorPage.aspx" />

C. Add the following code segment to the Global.asax file.

void Application_Error(object sender, EventArgs e)

{


    | English | Chinese | Japan | Korean |            - 58 -        Test Information Co., Ltd. All rights reserved.
Exception exc = Server.GetLastError();

     //Write Exception details to event log

}

D. Add the following code segment to the ErrorPage.aspx file.

void Page_Error(object sender, EventArgs e)

{

     Exception exc = Server.GetLastError();

     //Write Exception details to event log

     Server.ClearError();

}

Answer: AC



44. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The

application has an ASPX page named ErrorPage.aspx.

You plan to manage the unhandled application exceptions.

You need to perform the following tasks:

¡¤Display the ErrorPage.aspx page

¡¤Write the exception information in the Event log file

Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. Add the following code fragment to the Web.config file.

<customErrors mode="On" defaultRedirect="ErrorPage.aspx" />

B. Add the following code fragment to the Web.config file.

<customErrors mode="Off" defaultRedirect="ErrorPage.aspx" />

C. Add the following code segment to the Global.asax file.

Public Sub Application_Error(ByVal sender As Object, _

    ByVal e As EventArgs)

     Dim exc As Exception = Server.GetLastError()

     'Write Exception details to event log

End Sub


    | English | Chinese | Japan | Korean |            - 59 -        Test Information Co., Ltd. All rights reserved.
D. Add the following code segment to the ErrorPage.aspx file.

Public Sub Page_Error(ByVal sender As Object, _

 ByVal e As EventArgs)

  Dim exc As Exception = Server.GetLastError()

  'Write Exception details to event log

  Server.ClearError()

End Sub

Answer: AC



45. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The

application contains two Web pages named OrderDetails.aspx and OrderError.htm.

If the application throws unhandled errors in the OrderDetails.aspx Web page, a stack trace is displayed

to remote users.

You need to ensure that the OrderError.htm Web page is displayed for unhandled errors only in the

OrderDetails.aspx Web page.

What should you do?

A. Set the Page attribute for the OrderDetails.aspx Web page in the following manner.

<%@ Page Language="C#" AutoEventWireup="true"

 CodeFile="OrderDetails.aspx.cs" Inherits="OrderDetails" %>

Add the following section to the Web.config file.

<customErrors mode="Off" defaultRedirect="OrderError.htm">

</customErrors>

B. Set the Page attribute for the OrderDetails.aspx Web page in the following manner.

<%@ Page Language="C#" AutoEventWireup="true"

 CodeFile="OrderDetails.aspx.cs" Inherits="OrderDetails" Debug="true" %>

Add the following section to the Web.config file.

<customErrors mode="On" defaultRedirect="OrderError.htm">

C. Set the Page attribute for the OrderDetails.aspx Web page in the following manner.

<%@ Page Language="C#" AutoEventWireup="true"


 | English | Chinese | Japan | Korean |             - 60 -           Test Information Co., Ltd. All rights reserved.
CodeFile="OrderDetails.aspx.cs" Inherits="OrderDetails"

 ErrorPage="~/OrderError.htm" Debug="false" %>

Add the following section to the Web.config file.

<customErrors mode="On">

</customErrors>

D. Set the Page attribute for the OrderDetails.aspx Web page in the following manner.

<%@ Page Language="C#" AutoEventWireup="true"

 CodeFile="OrderDetails.aspx.cs" Inherits="OrderDetails" Debug="true"

 ErrorPage="~/OrderError.htm" %>

Add the following section to the Web.config file.

<customErrors mode="Off">

</customErrors>

Answer: C



46. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The

application contains two Web pages named OrderDetails.aspx and OrderError.htm.

If the application throws unhandled errors in the OrderDetails.aspx Web page, a stack trace is displayed

to remote users.

You need to ensure that the OrderError.htm Web page is displayed for unhandled errors only in the

OrderDetails.aspx Web page.

What should you do?

A. Set the Page attribute for the OrderDetails.aspx Web page in the following manner.

<%@ Page Language="VB" AutoEventWireup="true"

 CodeFile="OrderDetails.aspx.vb" Inherits="OrderDetails" %>

Add the following section to the Web.config file.

<customErrors mode="Off" defaultRedirect="OrderError.htm">

</customErrors>

B. Set the Page attribute for the OrderDetails.aspx Web page in the following manner.

<%@ Page Language="VB" AutoEventWireup="true"


 | English | Chinese | Japan | Korean |             - 61 -           Test Information Co., Ltd. All rights reserved.
CodeFile="OrderDetails.aspx.vb" Inherits="OrderDetails" Debug="true" %>

Add the following section to the Web.config file.

<customErrors mode="On" defaultRedirect="OrderError.htm">

C. Set the Page attribute for the OrderDetails.aspx Web page in the following manner.

<%@ Page Language="VB" AutoEventWireup="true"

 CodeFile="OrderDetails.aspx.vb" Inherits="OrderDetails"

 ErrorPage="~/OrderError.htm" Debug="false" %>

Add the following section to the Web.config file.

<customErrors mode="On">

</customErrors>

D. Set the Page attribute for the OrderDetails.aspx Web page in the following manner.

<%@ Page Language="VB" AutoEventWireup="true"

 CodeFile="OrderDetails.aspx.vb" Inherits="OrderDetails" Debug="true"

 ErrorPage="~/OrderError.htm" %>

Add the following section to the Web.config file.

<customErrors mode="Off">

</customErrors>

Answer: C



47. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code fragment.

<asp:ScriptManager ID="ScriptManager1" runat="server" />

<asp:UpdatePanel ID="updateLabels" runat="server"

UpdateMode="Conditional">

<ContentTemplate>

  <asp:Label ID="Label1" runat="server" />

  <asp:Label ID="Label2" runat="server" />

  <asp:Button ID="btnSubmit" runat="server" Text="Submit"

  onclick="btnSubmit_Click" />


 | English | Chinese | Japan | Korean |             - 62 -           Test Information Co., Ltd. All rights reserved.
</ContentTemplate>

</asp:UpdatePanel>

<asp:Label id="Label3" runat="server" />

You need to ensure that when you click the btnSubmit Button control, each Label control value is

asynchronously updatable.

Which code segment should you use?

A. protected void btnSubmit_Click(object sender, EventArgs e)

{

     Label1.Text = "Label1 updated value";

     Label2.Text = "Label2 updated value";

     Label3.Text = "Label3 updated value";

}

B. protected void btnSubmit_Click(object sender, EventArgs e)

{

     Label1.Text = "Label1 updated value";

     Label2.Text = "Label2 updated value";

     ScriptManager1.RegisterDataItem(Label3, "Label3 updated value");

}

C. protected void btnSubmit_Click(object sender, EventArgs e)

{

     ScriptManager1.RegisterDataItem(Label1, "Label1 updated value");

     ScriptManager1.RegisterDataItem(Label2, "Label2 updated value");

     Label3.Text = "Label3 updated value";

}

D. protected void btnSubmit_Click(object sender, EventArgs e)

{

     Label1.Text = "Label1 updated value";

     Label2.Text = "Label2 updated value";

     ScriptManager1.RegisterAsyncPostBackControl(Label3);


    | English | Chinese | Japan | Korean |         - 63 -               Test Information Co., Ltd. All rights reserved.
Label3.Text = "Label3 updated value";

}

Answer: B



48. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code fragment.

<asp:ScriptManager ID="ScriptManager1" runat="server" />

<asp:UpdatePanel ID="updateLabels" runat="server"

UpdateMode="Conditional">

<ContentTemplate>

     <asp:Label ID="Label1" runat="server" />

     <asp:Label ID="Label2" runat="server" />

     <asp:Button ID="btnSubmit" runat="server" Text="Submit"

     onclick="btnSubmit_Click" />

     </ContentTemplate>

</asp:UpdatePanel>

<asp:Label id="Label3" runat="server" />

You need to ensure that when you click the btnSubmit Button control, each Label control value is

asynchronously updatable.

Which code segment should you use?

A. Protected Sub btnSubmit_Click(ByVal sender As Object, _

    ByVal e As EventArgs)

     Label1.Text = "Label1 updated value"

     Label2.Text = "Label2 updated value"

     Label3.Text = "Label3 updated value"

End Sub

B. Protected Sub btnSubmit_Click(ByVal sender As Object, _

    ByVal e As EventArgs)

     Label1.Text = "Label1 updated value"


    | English | Chinese | Japan | Korean |         - 64 -           Test Information Co., Ltd. All rights reserved.
Label2.Text = "Label2 updated value"

  ScriptManager1.RegisterDataItem(Label3, _

     "Label3 updated value")

End Sub

C. Protected Sub btnSubmit_Click(ByVal sender As Object, _

 ByVal e As EventArgs)

  ScriptManager1.RegisterDataItem(Label1, _

     "Label1 updated value")

  ScriptManager1.RegisterDataItem(Label2, _

     "Label2 updated value")

  Label3.Text = "Label3 updated value"

End Sub

D. Protected Sub btnSubmit_Click(ByVal sender As Object, _

 ByVal e As EventArgs)

  Label1.Text = "Label1 updated value"

  Label2.Text = "Label2 updated value"

  ScriptManager1.RegisterAsyncPostBackControl(Label3)

  Label3.Text = "Label3 updated value"

End Sub

Answer: B



49. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web form in the application by using the following code fragment. (Line numbers are

included for reference only.)

01 <script runat="server">

02     protected void Button_Handler(object sender, EventArgs e)

03     {

04         // some long-processing operation.

05     }


 | English | Chinese | Japan | Korean |           - 65 -            Test Information Co., Ltd. All rights reserved.
06 </script>

07 <div>

08        <asp:ScriptManager ID="defaultScriptManager"

09         runat="server" />

10

11        <asp:UpdatePanel ID="defaultPanel"

12         UpdateMode="Conditional" runat="server">

13          <ContentTemplate>

14             <!-- more content here -->

15             <asp:Button ID="btnSubmit" runat="server"

16              Text="Submit" OnClick="Button_Handler" />

17          </ContentTemplate>

18        </asp:UpdatePanel>

19 </div>

You plan to create a client-side script code by using ASP.NET AJAX.

You need to ensure that while a request is being processed, any subsequent Click events on the

btnSubmit Button control are suppressed.

Which code fragment should you insert at line 10?

A. <script type="text/javascript" language="javascript">

  var rm = Sys.WebForms.PageRequestManager.getInstance();

  rm.add_beginRequest(checkPostback);

  function checkPostback(sender, args) {

      if (rm.get_isInAsyncPostBack() &&

          args.get_postBackElement().id == 'btnSubmit') {

           rm.abortPostBack();

           alert('A previous request is still in progress.');

      }

  }

</script>


 | English | Chinese | Japan | Korean |                     - 66 -    Test Information Co., Ltd. All rights reserved.
B. <script type="text/javascript" language="javascript">

  var rm = Sys.WebForms.PageRequestManager.getInstance();

  rm.add_initializeRequest(checkPostback);

  function checkPostback(sender, args) {

      if (rm.get_isInAsyncPostBack() &&

          args.get_postBackElement().id == 'btnSubmit') {

           rm.abortPostBack();

           alert('A previous request is still in progress.');

      }

  }

</script>

C. <script type="text/javascript" language="javascript">

  var rm = Sys.WebForms.PageRequestManager.getInstance();

  rm.add_initializeRequest(checkPostback);

  function checkPostback(sender, args) {

      if (rm.get_isInAsyncPostBack() &&

      args.get_postBackElement().id == 'btnSubmit') {

           args.set_cancel(true);

           alert('A previous request is still in progress.');

      }

  }

</script>

D. <script type="text/javascript" language="javascript">

  var rm = Sys.WebForms.PageRequestManager.getInstance();

  rm.add_beginRequest(checkPostback);

  function checkPostback(sender, args) {

      var request = args.get_request();

      if (rm.get_isInAsyncPostBack() &&

          args.get_postBackElement().id == 'btnSubmit') {


 | English | Chinese | Japan | Korean |                     - 67 -   Test Information Co., Ltd. All rights reserved.
request.completed(new Sys.CancelEventArgs());

          alert('A previous request is still in progress.');

      }

  }

</script>

Answer: C



50. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web form in the application by using the following code fragment. (Line numbers are

included for reference only.)

01 <script runat="server">

02        Protected Sub Button_Handler(ByVal sender As Object, _

03         ByVal e As EventArgs)

04          ' some long-processing operation.

05        End Sub

06 </script>

07 <div>

08        <asp:ScriptManager ID="defaultScriptManager"

09         runat="server" />

10

11        <asp:UpdatePanel ID="defaultPanel"

12         UpdateMode="Conditional" runat="server">

13          <ContentTemplate>

14            <!-- more content here -->

15            <asp:Button ID="btnSubmit" runat="server"

16             Text="Submit" OnClick="Button_Handler" />

17          </ContentTemplate>

18        </asp:UpdatePanel>

19 </div>


 | English | Chinese | Japan | Korean |                    - 68 -   Test Information Co., Ltd. All rights reserved.
You plan to create a client-side script code by using ASP.NET AJAX.

You need to ensure that while a request is being processed, any subsequent Click events on the

btnSubmit Button control are suppressed.

Which code fragment should you insert at line 10?

A. <script type="text/javascript" language="javascript">

  var rm = Sys.WebForms.PageRequestManager.getInstance();

  rm.add_beginRequest(checkPostback);

  function checkPostback(sender, args) {

      if (rm.get_isInAsyncPostBack() &&

          args.get_postBackElement().id == 'btnSubmit') {

           rm.abortPostBack();

           alert('A previous request is still in progress.');

      }

  }

</script>

B. <script type="text/javascript" language="javascript">

  var rm = Sys.WebForms.PageRequestManager.getInstance();

  rm.add_initializeRequest(checkPostback);

  function checkPostback(sender, args) {

      if (rm.get_isInAsyncPostBack() &&

          args.get_postBackElement().id == 'btnSubmit') {

           rm.abortPostBack();

           alert('A previous request is still in progress.');

      }

  }

</script>

C. <script type="text/javascript" language="javascript">

  var rm = Sys.WebForms.PageRequestManager.getInstance();

  rm.add_initializeRequest(checkPostback);


 | English | Chinese | Japan | Korean |                     - 69 -    Test Information Co., Ltd. All rights reserved.
function checkPostback(sender, args) {

      if (rm.get_isInAsyncPostBack() &&

      args.get_postBackElement().id == 'btnSubmit') {

           args.set_cancel(true);

           alert('A previous request is still in progress.');

      }

  }

</script>

D. <script type="text/javascript" language="javascript">

  var rm = Sys.WebForms.PageRequestManager.getInstance();

  rm.add_beginRequest(checkPostback);

  function checkPostback(sender, args) {

      var request = args.get_request();

      if (rm.get_isInAsyncPostBack() &&

          args.get_postBackElement().id == 'btnSubmit') {

           request.completed(new Sys.CancelEventArgs());

           alert('A previous request is still in progress.');

      }

  }

</script>

Answer: C



51. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code segment to create a JavaScript file named CalculatorScript.js.

function divide(a, b) {

  if (b == 0) {

      var errorMsg = Messages.DivideByZero;

      alert(errorMsg);

      return null;


 | English | Chinese | Japan | Korean |                     - 70 -    Test Information Co., Ltd. All rights reserved.
}

return a/b;

}

You embed the CalculatorScript.js file as a resource in a Class Library project. The namespace for this

project is Calculator.Resources. The JavaScript function retrieves messages from a resource file named

MessageResources.resx by using the JavaScript Messages object.

You add an AJAX Web form in the ASP.NET application. You reference the Class Library in the application.

You add an ASP.NET AJAX ScriptReference element to the AJAX Web form.

You need to ensure that the JavaScript function can access the error messages that are defined in the

resource file.

Which code segment should you add in the AssemblyInfo.cs file?

A. [assembly: ScriptResource

    ("CalculatorScript", "MessageResources", "Messages")]

B. [assembly: ScriptResource

    ("CalculatorScript.js", "MessageResources.resx", "Messages")]

C. [assembly: ScriptResource

    ("Calculator.Resources.CalculatorScript.js", "Calculator.Resources.MessageResources", "Messages")]

D. [assembly: ScriptResource

    ("Calculator.Resources.CalculatorScript",            "Calculator.Resources.MessageResources.resx",

"Messages")]

Answer: C



52. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code segment to create a JavaScript file named CalculatorScript.js.

function divide(a, b) {

     if (b == 0) {

         var errorMsg = Messages.DivideByZero;

         alert(errorMsg);

         return null;


    | English | Chinese | Japan | Korean |          - 71 -            Test Information Co., Ltd. All rights reserved.
}

return a/b;

}

You embed the CalculatorScript.js file as a resource in a Class Library project. The namespace for this

project is Calculator.Resources. The JavaScript function retrieves messages from a resource file named

MessageResources.resx by using the JavaScript Messages object.

You add an AJAX Web form in the ASP.NET application. You reference the Class Library in the application.

You add an ASP.NET AJAX ScriptReference element to the AJAX Web form.

You need to ensure that the JavaScript function can access the error messages that are defined in the

resource file.

Which code segment should you add in the AssemblyInfo.vb file?

A. <assembly: ScriptResource

    ("CalculatorScript", "MessageResources", "Messages")>

B. <assembly: ScriptResource

    ("CalculatorScript.js", "MessageResources.resx", "Messages")>

C. <assembly: ScriptResource

    ("Calculator.Resources.CalculatorScript.js", "Calculator.Resources.MessageResources", "Messages")>

D. <assembly: ScriptResource

    ("Calculator.Resources.CalculatorScript",               "Calculator.Resources.MessageResources.resx",

"Messages")>

Answer: C



53. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create an AJAX-enabled Web form by using the following code fragment.

<asp:ScriptManager ID="scrMgr" runat="server" />

<asp:UpdatePanel runat="server" ID="updFirstPanel"

    UpdateMode="Conditional">

     <ContentTemplate>

         <asp:TextBox runat="server" ID="txtInfo" />


    | English | Chinese | Japan | Korean |             - 72 -            Test Information Co., Ltd. All rights reserved.
<asp:Button runat="server" ID="btnSubmit"

        Text="Submit" />

  </ContentTemplate>

</asp:UpdatePanel>

<asp:UpdatePanel runat="server" ID="updSecondPanel"

 UpdateMode="Conditional">

  <ContentTemplate>

       ...

  </ContentTemplate>

</asp:UpdatePanel>

When the updFirstPanel UpdatePanel control is updated, a dynamic client script is registered.

You write the following code segment in the code-behind file of the Web form. (Line numbers are included

for reference only.)

01 protected void Page_Load(object sender, EventArgs e)

02 {

03       if(IsPostBack)

04       {

05           string generatedScript = ScriptGenerator.GenerateScript();

06

07       }

08 }

You need to ensure that the client-script code is registered only when an asynchronous postback is issued

on the updFirstPanel UpdatePanel control.

Which code segment should you insert at line 06?

A. ClientScript.RegisterClientScriptBlock(typeof(TextBox),

 "txtInfo_Script", generatedScript);

B. ScriptManager.RegisterClientScriptBlock(this, typeof(Page),

 "txtInfo_Script", generatedScript, false);

C. ClientScript.RegisterClientScriptBlock(typeof(Page),


 | English | Chinese | Japan | Korean |                - 73 -             Test Information Co., Ltd. All rights reserved.
"txtInfo_Script", generatedScript);

D. ScriptManager.RegisterClientScriptBlock(txtInfo,

 typeof(TextBox), "txtInfo_Script", generatedScript, false);

Answer: D



54. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create an AJAX-enabled Web form by using the following code fragment.

<asp:ScriptManager ID="scrMgr" runat="server" />

<asp:UpdatePanel runat="server" ID="updFirstPanel"

 UpdateMode="Conditional">

  <ContentTemplate>

     <asp:TextBox runat="server" ID="txtInfo" />

     <asp:Button runat="server" ID="btnSubmit"

      Text="Submit" />

  </ContentTemplate>

</asp:UpdatePanel>

<asp:UpdatePanel runat="server" ID="updSecondPanel"

 UpdateMode="Conditional">

  <ContentTemplate>

     ...

  </ContentTemplate>

</asp:UpdatePanel>

When the updFirstPanel UpdatePanel control is updated, a dynamic client script is registered.

You write the following code segment in the code-behind file of the Web form. (Line numbers are included

for reference only.)

01 Protected Sub Page_Load(ByVal sender As Object, _

     ByVal e As EventArgs)

02     If Not IsPostBack Then

03         Dim generatedScript As String = _


 | English | Chinese | Japan | Korean |               - 74 -          Test Information Co., Ltd. All rights reserved.
ScriptGenerator.GenerateScript()

04

05         End If

06 End Sub

You need to ensure that the client-script code is registered only when an asynchronous postback is issued

on the updFirstPanel UpdatePanel control.

Which code segment should you insert at line 04?

A. ClientScript.RegisterClientScriptBlock(GetType(TextBox), _

    "txtInfo_Script", generatedScript)

B. ScriptManager.RegisterClientScriptBlock(Me, _

    GetType(Page), "txtInfo_Script", generatedScript, False)

C. ClientScript.RegisterClientScriptBlock(GetType(Page), _

    "txtInfo_Script", generatedScript)

D. ScriptManager.RegisterClientScriptBlock(txtInfo, _

    GetType(TextBox), "txtInfo_Script", generatedScript, False)

Answer: D



55. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

The application contains the following code segment.

public class CapabilityEvaluator

{

     public static bool ChkScreenSize(

         System.Web.Mobile.MobileCapabilities cap,

         String arg)

     {

          int screenSize = cap.ScreenCharactersWidth *

           cap.ScreenCharactersHeight;

          return screenSize < int.Parse(arg);

     }


    | English | Chinese | Japan | Korean |               - 75 -       Test Information Co., Ltd. All rights reserved.
}

You add the following device filter element to the Web.config file.

<filter name="FltrScreenSize"

type="MyWebApp.CapabilityEvaluator,MyWebApp"

method="ChkScreenSize" />

You need to write a code segment to verify whether the size of the device display is less than 80

characters.

Which code segment should you use?

A. MobileCapabilities currentMobile;

currentMobile = Request.Browser as MobileCapabilities;

if(currentMobile.HasCapability("FltrScreenSize","80"))

{

}

B. MobileCapabilities currentMobile;

currentMobile = Request.Browser as MobileCapabilities;

if(currentMobile.HasCapability(

    "FltrScreenSize","").ToString()=="80")

{

}

C. MobileCapabilities currentMobile;

currentMobile = Request.Browser as MobileCapabilities;

if (currentMobile.HasCapability(

    "CapabilityEvaluator.ChkScreenSize", "80"))

{

}

D. MobileCapabilities currentMobile;

currentMobile = Request.Browser as MobileCapabilities;

if (currentMobile.HasCapability(

    "CapabilityEvaluator.ChkScreenSize", "").ToString()=="80")


    | English | Chinese | Japan | Korean |           - 76 -           Test Information Co., Ltd. All rights reserved.
{

}

Answer: A



56. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

The application contains the following code segment.

Public Class CapabilityEvaluator

     Public Shared Function ChkScreenSize( _

      ByVal cap As System.Web.Mobile.MobileCapabilities, _

      ByVal arg As String) As Boolean

        Dim screenSize As Integer = cap.ScreenCharactersWidth * _

         cap.ScreenCharactersHeight

        Return screenSize < Integer.Parse(arg)

     End Function

End Class

You add the following device filter element to the Web.config file.

<filter name="FltrScreenSize"

type="MyWebApp.CapabilityEvaluator,MyWebApp"

method="ChkScreenSize" />

You need to write a code segment to verify whether the size of the device display is less than 80

characters.

Which code segment should you use?

A. Dim currentMobile As MobileCapabilities

currentMobile = TryCast(Request.Browser, MobileCapabilities)

If currentMobile.HasCapability("FltrScreenSize", "80") Then

     End If

B. Dim currentMobile As MobileCapabilities

currentMobile = TryCast(Request.Browser, MobileCapabilities)

If currentMobile.HasCapability( _


    | English | Chinese | Japan | Korean |           - 77 -           Test Information Co., Ltd. All rights reserved.
"FltrScreenSize", "").ToString() = "80" Then

     End If

C. Dim currentMobile As MobileCapabilities

currentMobile = TryCast(Request.Browser, MobileCapabilities)

If currentMobile.HasCapability( _

    "CapabilityEvaluator.ChkScreenSize", "80") Then

     End If

D. Dim currentMobile As MobileCapabilities

currentMobile = TryCast(Request.Browser, MobileCapabilities)

If currentMobile.HasCapability( _

    "CapabilityEvaluator.ChkScreenSize", "").ToString() = "80" Then

     End If

Answer: A



57. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The

application has a mobile Web form that contains the following ObjectList control.

<mobile:ObjectList ID="ObjectListCtrl" OnItemCommand="ObjectListCtrl_ItemCommand"

Runat="server">

     <Command Name="CmdDisplayDetails" Text="Details" />

     <Command Name="CmdRemove" Text="Remove" />

</mobile:ObjectList>

You create an event handler named ObjectListCtrl_ItemCommand.

You need to ensure that the ObjectListCtrl_ItemCommand handler detects the selection of the

CmdDisplayDetails item.

Which code segment should you write?

A. public void ObjectListCtrl_ItemCommand(

     object sender, ObjectListCommandEventArgs e)

{

     if (e.CommandName == "CmdDisplayDetails")


    | English | Chinese | Japan | Korean |            - 78 -           Test Information Co., Ltd. All rights reserved.
{

     }

}

B. public void ObjectListCtrl_ItemCommand(

     object sender, ObjectListCommandEventArgs e)

{

     if (e.CommandArgument.ToString() == "CmdDisplayDetails")

     {

     }

}

C. public void ObjectListCtrl_ItemCommand(

     object sender, ObjectListCommandEventArgs e)

{

     ObjectListCommand cmd = sender as ObjectListCommand;

         if (cmd.Name == "CmdDisplayDetails")

     {

     }

}

D. public void ObjectListCtrl_ItemCommand(

     object sender, ObjectListCommandEventArgs e)

{

     ObjectListCommand cmd = e.CommandSource as ObjectListCommand;

     if (cmd.Name == "CmdDisplayDetails")

          {

     }

}

Answer: A



58. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The


    | English | Chinese | Japan | Korean |          - 79 -         Test Information Co., Ltd. All rights reserved.
application has a mobile Web form that contains the following ObjectList control.

<mobile:ObjectList ID="ObjectListCtrl" OnItemCommand="ObjectListCtrl_ItemCommand"

Runat="server">

  <Command Name="CmdDisplayDetails" Text="Details" />

  <Command Name="CmdRemove" Text="Remove" />

</mobile:ObjectList>

You create an event handler named ObjectListCtrl_ItemCommand.

You need to ensure that the ObjectListCtrl_ItemCommand handler detects the selection of the

CmdDisplayDetails item.

Which code segment should you write?

A. Public Sub ObjectListCtrl_ItemCommand( _

 ByVal sender As Object, ByVal e As ObjectListCommandEventArgs)

  If e.CommandName = "CmdDisplayDetails" Then

  End If

End Sub

B. Public Sub ObjectListCtrl_ItemCommand( _

 ByVal sender As Object, ByVal e As ObjectListCommandEventArgs)

  If e.CommandArgument.ToString() = "CmdDisplayDetails" Then

  End If

End Sub

C. Public Sub ObjectListCtrl_ItemCommand( _

 ByVal sender As Object, ByVal e As ObjectListCommandEventArgs)

  Dim cmd As ObjectListCommand = TryCast(sender, ObjectListCommand)

  If cmd.Name = "CmdDisplayDetails" Then

  End If

End Sub

D. Public Sub ObjectListCtrl_ItemCommand( _

 ByVal sender As Object, ByVal e As ObjectListCommandEventArgs)

  Dim cmd As ObjectListCommand = TryCast( _


| English | Chinese | Japan | Korean |             - 80 -              Test Information Co., Ltd. All rights reserved.
e.CommandSource, ObjectListCommand)

  If cmd.Name = "CmdDisplayDetails" Then

  End If

End Sub

Answer: A



59. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

All the content pages in the application use a single master page. The master page uses a static

navigation menu to browse the site.

You need to ensure that the content pages can optionally replace the static navigation menu with their

own menu controls.

What should you do?

A. ¡¤Add the following code fragment to the master page

<asp:PlaceHolder ID="MenuPlaceHolder" runat="server">

  <div id="menu">

    <!-- Menu code here -->

  </div>

</asp:PlaceHolder>

B. ¡¤Add the following code segment to the Page_Load event of the content page

PlaceHolder placeHolder =

 Page.Master.FindControl("MenuPlaceHolder") as PlaceHolder;

Menu menuControl = new Menu();

placeHolder.Controls.Add(menuControl);

C. ¡¤Add the following code fragment to the master page

<asp:ContentPlaceHolder ID="MenuPlaceHolder" runat="server">

  <!-- Menu code here -->

</asp:ContentPlaceHolder>

D. ¡¤Add the following code fragment to the content page

<asp:Content ContentPlaceHolderID="MenuPlaceHolder">


| English | Chinese | Japan | Korean |            - 81 -            Test Information Co., Ltd. All rights reserved.
<asp:menu ID="menuControl" runat="server">      - < asp m
                                                    /    : enu

</asp:Content>

E. ¡¤Add the following code fragment to the master page

<asp:ContentPlaceHolder ID="MenuPlaceHolder" runat="server">

  <!-- Menu code here -->

</asp:ContentPlaceHolder>

F. ¡¤Add the following code segment to the Page_Load event of the content page

ContentPlaceHolder placeHolder =

 Page.Master.FindControl("MenuPlaceHolder") as ContentPlaceHolder;

Menu menuControl = new Menu();

placeHolder.Controls.Add(menuControl);

G. ¡¤Add the following code fragment to the master page

<asp:PlaceHolder ID="MenuPlaceHolder" runat="server">

  <!-- Menu code here -->

</asp:PlaceHolder>

H. ¡¤Add the following code fragment to the content page

<asp:Content PlaceHolderID="MenuPlaceHolder">

  <asp:menu ID="menuControl" runat="server">      - < asp m
                                                    /    : enu

</asp:Content>

Answer: B



60. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

All the content pages in the application use a single master page. The master page uses a static

navigation menu to browse the site.

You need to ensure that the content pages can optionally replace the static navigation menu with their

own menu controls.

What should you do?

A. ¡¤Add the following code fragment to the mastr page.

<asp:PlaceHolder ID="MenuPlaceHolder runat="server">


| English | Chinese | Japan | Korean |            - 82 -            Test Information Co., Ltd. All rights reserved.
<div id="menu">

    <!-- Menu code here -->

  </div>

</asp:PlaceHolder>

B. ¡¤Add the following code segment to the Page_Load event of the content page

Dim placeHolder As PlaceHolder = TryCast( _

 Page.Master.FindControl("MenuPlaceHolder"), PlaceHolder)

Dim menuControl As New Menu()

placeHolder.Controls.Add(menuControl)

C. ¡¤Add the following code fragment to the master page

<asp:ContentPlaceHolder ID="MenuPlaceHolder runat="server">

  <!-- Menu code here -->

</asp:ContentPlaceHolder>

D. ¡¤Add the following code fragment to the content page

<asp:Content ContentPlaceHolderID="MenuPlaceHolder">

  <asp:menu ID="menuControl" runat="server">      - < asp m
                                                    /    : enu

</asp:Content>

E. ¡¤Add the following code fragmet to the master page.

<asp:ContentPlaceHolder ID="MenuPlaceHolder runat="server">

  <!-- Menu code here -->

</asp:ContentPlaceHolder>

F. ¡¤Add the following code segment to the Page_Load event of the content page

Dim placeHolder As ContentPlaceHolder = _

 TryCast(Page.Master.FindControl("MenuPlaceHolder"), _

 ContentPlaceHolder)

Dim menuControl As New Menu()

placeHolder.Controls.Add(menuControl)

G. ¡¤Add the following code fragment to the master page

<asp:PlaceHolder ID="MenuPlaceHolder runat="server">


| English | Chinese | Japan | Korean |            - 83 -            Test Information Co., Ltd. All rights reserved.
<!-- Menu code here -->

</asp:PlaceHolder>

H. ¡¤Add the following code fragment to the content page

<asp:Content PlaceHolderID="MenuPlaceHolder">

  <asp:menu ID="menuControl" runat="server">       - < asp m
                                                     /    : enu

</asp:Content>

Answer: B



61. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

The application allows users to post comments to a page that can be viewed by other users.

You add a SqlDataSource control named SqlDS1. You write the following code segment. (Line numbers

are included for reference only.)

01 private void SaveComment()

02 {

03     string ipaddr;

04

05     SqlDS1.InsertParameters["IPAddress"].DefaultValue = ipaddr;

06     ...

07     SqlDS1.Insert();

08 }

You need to ensure that the IP Address of each user who posts a comment is captured along with the

user's comment.

Which code segment should you insert at line 04?

A. ipaddr = Server["REMOTE_ADDR"].ToString();

B. ipaddr = Session["REMOTE_ADDR"].ToString();

C. ipaddr = Application["REMOTE_ADDR"].ToString();

D. ipaddr = Request.ServerVariables["REMOTE_ADDR"].ToString();

Answer: D




 | English | Chinese | Japan | Korean |            - 84 -            Test Information Co., Ltd. All rights reserved.
62. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

The application allows users to post comments to a page that can be viewed by other users.

You add a SqlDataSource control named SqlDS1. You write the following code segment. (Line numbers

are included for reference only.)

01 Private Sub SaveComment()

02    Dim ipaddr As String

03

04    SqlDS1.InsertParameters("IPAddress").DefaultValue = ipaddr

05    ' ...

06    SqlDS1.Insert()

07 End Sub

You need to ensure that the IP Address of each user who posts a comment is captured along with the

user's comment.

Which code segment should you insert at line 03?

A. ipaddr = Server("REMOTE_ADDR").ToString()

B. ipaddr = Session("REMOTE_ADDR").ToString()

C. ipaddr = Application("REMOTE_ADDR").ToString()

D. ipaddr = Request.ServerVariables("REMOTE_ADDR").ToString()

Answer: D



63. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web page named Default.aspx in the root of the application. You add an

ImageResources.resx resource file in the App_GlobalResources folder. The ImageResources.resx file

contains a localized resource named LogoImageUrl.

You need to retrieve the value of LogoImageUrl.

Which code segment should you use?

A. string logoImageUrl = (string)GetLocalResource("LogoImageUrl");

B. string logoImageUrl = (string)GetGlobalResource("Default", "LogoImageUrl");

C. string logoImageUrl = (string)GetGlobalResource("ImageResources", "LogoImageUrl");


 | English | Chinese | Japan | Korean |            - 85 -            Test Information Co., Ltd. All rights reserved.
D. string logoImageUrl = (string)GetLocalResource("ImageResources.LogoImageUrl");

Answer: C



64. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web page named Default.aspx in the root of the application. You add an

ImageResources.resx resource file in the App_GlobalResources folder. The ImageResources.resx file

contains a localized resource named LogoImageUrl.

You need to retrieve the value of LogoImageUrl.

Which code segment should you use?

A. Dim logoImageUrl As String = DirectCast( _GetLocalResource("LogoImageUrl"), String)

B. Dim logoImageUrl As String = DirectCast( _GetGlobalResource("Default", "LogoImageUrl"), String)

C. Dim logoImageUrl As String = DirectCast( _GetGlobalResource("ImageResources", "LogoImageUrl"),

String)

D. Dim logoImageUrl As String = DirectCast( _GetLocalResource("ImageResources.LogoImageUrl"),

String)

Answer: C



65. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a custom Web user control named SharedControl. The control will be compiled as a library.

You write the following code segment for the SharedControl control. (Line numbers are included for

reference only.)

01 protected override void OnInit(EventArgs e)

02 {

03     base.OnInit(e);

04

05 }

All the master pages in the ASP.NET application contain the following directive.

<%@ Master Language="C#" EnableViewState="false" %>

You need to ensure that the state of the SharedControl control can persist on the pages that reference a


 | English | Chinese | Japan | Korean |             - 86 -             Test Information Co., Ltd. All rights reserved.
master page.

Which code segment should you insert at line 04?

A. Page.RegisterRequiresPostBack(this);

B. Page.RegisterRequiresControlState(this);

C. Page.UnregisterRequiresControlState(this);

D. Page.RegisterStartupScript("SharedControl","server");

Answer: B



66. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a custom Web user control named SharedControl. The control will be compiled as a library.

You write the following code segment for the SharedControl control. (Line numbers are included for

reference only.)

01 Protected Overloads Overrides Sub OnInit(ByVal e As EventArgs)

02    MyBase.OnInit(e)

03

04 End Sub

All the master pages in the ASP.NET application contain the following directive.

<%@ Master Language="VB" EnableViewState="false" %>

You need to ensure that the state of the SharedControl control can persist on the pages that reference a

master page.

Which code segment should you insert at line 03?

A. Page.RegisterRequiresPostBack(Me)

B. Page.RegisterRequiresControlState(Me)

C. Page.UnregisterRequiresControlState(Me)

D. Page.RegisterStartupScript("SharedControl", "server")

Answer: B



67. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web page that has a GridView control named GridView1. The GridView1 control displays the


 | English | Chinese | Japan | Korean |            - 87 -              Test Information Co., Ltd. All rights reserved.
data from a database named Region and a table named Location.

You write the following code segment to populate the GridView1 control. (Line numbers are included for

reference only.)

01 protected void Page_Load(object sender, EventArgs e)

02 {

03     string connstr;

04

05     SqlDependency.Start(connstr);

06     using (SqlConnection connection =

07         new SqlConnection(connstr))

08     {

09          SqlCommand sqlcmd = new SqlCommand();

10          DateTime expires = DateTime.Now.AddMinutes(30);

11         SqlCacheDependency dependency = new

12          SqlCacheDependency("Region", "Location");

13          Response.Cache.SetExpires(expires);

14          Response.Cache.SetValidUntilExpires(true);

15          Response.AddCacheDependency(dependency);

16

17          sqlcmd.Connection = connection;

18          GridView1.DataSource = sqlcmd.ExecuteReader();

19          GridView1.DataBind();

20     }

21 }

You need to ensure that the proxy servers can cache the content of the GridView1 control.

Which code segment should you insert at line 16?

A. Response.Cache.SetCacheability(HttpCacheability.Private);

B. Response.Cache.SetCacheability(HttpCacheability.Public);

C. Response.Cache.SetCacheability(HttpCacheability.Server);


 | English | Chinese | Japan | Korean |             - 88 -           Test Information Co., Ltd. All rights reserved.
D. Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate);

Answer: B



68. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web page that has a GridView control named GridView1. The GridView1 control displays the

data from a database named Region and a table named Location.

You write the following code segment to populate the GridView1 control. (Line numbers are included for

reference only.)

01 Protected Sub Page_Load(ByVal sender As Object, _

     ByVal e As EventArgs)

02    Dim connstr As String

03    ...

04    SqlDependency.Start(connstr)

05    Using connection As New SqlConnection(connstr)

06          Dim sqlcmd As New SqlCommand()

07          Dim expires As DateTime = DateTime.Now.AddMinutes(30)

08          Dim dependency As SqlCacheDependency = _

09           New SqlCacheDependency("Region", "Location")

10          Response.Cache.SetExpires(expires)

11          Response.Cache.SetValidUntilExpires(True)

12          Response.AddCacheDependency(dependency)

13

14          sqlcmd.Connection = connection

15          GridView1.DataSource = sqlcmd.ExecuteReader()

16          GridView1.DataBind()

17    End Using

18 End Sub

You need to ensure that the proxy servers can cache the content of the GridView1 control.

Which code segment should you insert at line 13?


 | English | Chinese | Japan | Korean |            - 89 -            Test Information Co., Ltd. All rights reserved.
A. Response.Cache.SetCacheability(HttpCacheability.Private)

B. Response.Cache.SetCacheability(HttpCacheability.Public)

C. Response.Cache.SetCacheability(HttpCacheability.Server)

D. Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate)

Answer: B



69. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a page that contains the following control.

<asp:Calendar EnableViewState="false"ID="calBegin" runat="server" />

You write the following code segment in the code-behind file for the page.

void LoadDate(object sender, EventArgs e) {

     if (IsPostBack) {

         calBegin.SelectedDate =

          (DateTime)ViewState["date"];

     }

}

void SaveDate(object sender, EventArgs e) {

     ViewState["date"] = calBegin.SelectedDate;

}

You need to ensure that the calBegin Calendar control maintains the selected date.

Which code segment should you insert in the constructor of the page?

A. this.Load += new EventHandler(LoadDate);

this.Unload += new EventHandler(SaveDate);

B. this.Init += new EventHandler(LoadDate);

this.Unload += new EventHandler(SaveDate);

C. this.Init += new EventHandler(LoadDate);

this.PreRender += new EventHandler(SaveDate);

D. this.Load += new EventHandler(LoadDate);

this.PreRender += new EventHandler(SaveDate);


    | English | Chinese | Japan | Korean |          - 90 -             Test Information Co., Ltd. All rights reserved.
Answer: D



70. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a page that contains the following control.

<asp:Calendar EnableViewState="false"ID="calBegin" runat="server" />

You write the following code segment in the code-behind file for the page.

Private Sub LoadDate(ByVal sender As Object, _ByVal e As EventArgs)

  If IsPostBack Then

     calBegin.SelectedDate = _

      DirectCast(ViewState("date"), DateTime)

  End If

End Sub

Private Sub SaveDate(ByVal sender As Object, _ByVal e As EventArgs)

  ViewState("date") = calBegin.SelectedDate

End Sub

You need to ensure that the calBegin Calendar control maintains the selected date.

Which code segment should you insert in the constructor of the page?

A. AddHandler Me.Load, AddressOf LoadDate

AddHandler Me.Unload, AddressOf SaveDate

B. AddHandler Me.Init, AddressOf LoadDate

AddHandler Me.Unload, AddressOf SaveDate

C. AddHandler Me.Init, AddressOf LoadDate

AddHandler Me.PreRender, AddressOf SaveDate

D. AddHandler Me.Load, AddressOf LoadDate

AddHandler Me.PreRender, AddressOf SaveDate

Answer: D



71. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a page that contains the following code fragment.


 | English | Chinese | Japan | Korean |             - 91 -             Test Information Co., Ltd. All rights reserved.
<asp:ListBox ID="lstLanguages"AutoPostBack="true" runat="server" />

You write the following code segment in the code-behind file for the page.

void BindData(object sender, EventArgs e) {

     lstLanguages.DataSource =

      CultureInfo.GetCultures(CultureTypes.AllCultures);

     lstLanguages.DataTextField = "EnglishName";

     lstLanguages.DataBind();

}

You need to ensure that the lstLanguages ListBox control maintains the selection of the user during

postback.

Which line of code should you insert in the constructor of the page?

A. this.Init += new EventHandler(BindData);

B. this.PreRender += new EventHandler(BindData);

C. lstLanguages.PreRender += new EventHandler(BindData);

D. lstLanguages.SelectedIndexChanged += new EventHandler(BindData);

Answer: A



72. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a page that contains the following code fragment.

<asp:ListBox ID="lstLanguages"AutoPostBack="true" runat="server" />

You write the following code segment in the code-behind file for the page.

Private Sub BindData(ByVal sender As Object, _ByVal e As EventArgs)

     lstLanguages.DataSource = _

      CultureInfo.GetCultures(CultureTypes.AllCultures)

     lstLanguages.DataTextField = "EnglishName"

     lstLanguages.DataBind()

End Sub

You need to ensure that the lstLanguages ListBox control maintains the selection of the user during

postback.


    | English | Chinese | Japan | Korean |           - 92 -            Test Information Co., Ltd. All rights reserved.
Which line of code should you insert in the constructor of the page?

A. AddHandler Me.Init, AddressOf BindData

B. AddHandler Me.PreRender, AddressOf BindData

C. AddHandler lstLanguages.PreRender, AddressOf BindData

D. AddHandler lstLanguages.SelectedIndexChanged, AddressOf BindData

Answer: A



73. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The

application runs on Microsoft IIS 6.0.

You create a page named oldPage.aspx.

You need to ensure that the following requirements are met when a user attempts to access the page:

¡¤The browser diplays the URL of the oldPage.aspx page.

¡¤The browser displays the page named newPage.aspx

Which code segment should you use?

A. Server.Transfer("newPage.aspx");

B. Response.Redirect("newPage.aspx");

C. if (Request.Url.UserEscaped) {

     Server.TransferRequest("newPage.aspx");

}

else {

     Response.Redirect("newPage.aspx", true);

}

D. if (Request.Url.UserEscaped) {

     Response.RedirectLocation = "oldPage.aspx";

     Response.Redirect("newPage.aspx", true);

}

else {

     Response.Redirect("newPage.aspx");

}


    | English | Chinese | Japan | Korean |         - 93 -              Test Information Co., Ltd. All rights reserved.
Answer: A



74. You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ASP.NET. The

application runs on Microsoft IIS 6.0.

You create a page named oldPage.aspx.

You need to ensure that the following requirements are met when a user attempts to access the page:

¡¤The browser displays the URL of the oldPage.aspx page

¡¤The browser displays the page named newPage.aspx

Which code segment should you use?

A. Server.Transfer("newPage.aspx")

B. Response.Redirect("newPage.aspx")

C. If Request.Url.UserEscaped Then

  Server.TransferRequest("newPage.aspx")

Else

  Response.Redirect("newPage.aspx", True)

End If

D. If Request.Url.UserEscaped Then

  Response.RedirectLocation = "oldPage.aspx"

  Response.Redirect("newPage.aspx", True)

Else

  Response.Redirect("newPage.aspx")

End If

Answer: A



75. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web page named enterName.aspx. The Web page contains a TextBox control named

txtName. The Web page cross posts to a page named displayName.aspx that contains a Label control

named lblName.

You need to ensure that the lblName Label control displays the text that was entered in the txtName


 | English | Chinese | Japan | Korean |          - 94 -             Test Information Co., Ltd. All rights reserved.
TextBox control.

Which code segment should you use?

A. lblName.Text = Request.QueryString["txtName"];

B. TextBox txtName = FindControl("txtName") as TextBox;

   lblName.Text = txtName.Text;

C. TextBox txtName = Parent.FindControl("txtName") as TextBox;

   lblName.Text = txtName.Text;

D. TextBox txtName = PreviousPage.FindControl("txtName") as TextBox;

   lblName.Text = txtName.Text;

Answer: D



76. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web page named enterName.aspx. The Web page contains a TextBox control named

txtName. The Web page cross posts to a page named displayName.aspx that contains a Label control

named lblName.

You need to ensure that the lblName Label control displays the text that was entered in the txtName

TextBox control.

Which code segment should you use?

A. lblName.Text = Request.QueryString("txtName")

B. Dim txtName As TextBox = _TryCast(FindControl("txtName"), TextBox)

   lblName.Text = txtName.Text

C. Dim txtName As TextBox = _TryCast(Parent.FindControl("txtName"), TextBox)

   lblName.Text = txtName.Text

D. Dim txtName As TextBox = _TryCast(PreviousPage.FindControl("txtName"), TextBox)

   lblName.Text = txtName.Text

Answer: D



77. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code segment to create a class named MultimediaDownloader that implements the


| English | Chinese | Japan | Korean |             - 95 -           Test Information Co., Ltd. All rights reserved.
IHttpHandler interface.

namespace Contoso.Web.UI

{

     public class MultimediaDownloader : IHttpHandler

     {

          ...

     }

}

The MultimediaDownloader class performs the following tasks:

¡¤It returns the content of the multimedia files from the Web server

¡¤It processes requests for the files that have the .media file extension

The .media file extension is mapped to the aspnet_isapi.dll file in Microsoft IIS 6.0.

You need to configure the MultimediaDownloader class in the Web.config file of the application.

Which code fragment should you use?

A. <httpHandlers>

     <add verb="*.media" path="*" validate="false"

         type="Contoso.Web.UI.MultimediaDownloader" />

</httpHandlers>

B. <httpHandlers>

     <add verb="HEAD" path="*.media" validate="true"

         type="Contoso.Web.UI.MultimediaDownloader" />

</httpHandlers>

C. <httpHandlers>

     <add verb="*" path="*.media" validate="false"

         type="Contoso.Web.UI.MultimediaDownloader" />

</httpHandlers>

D. <httpHandlers>

     <add verb="GET,POST" path="*" validate="true"

         type="Contoso.Web.UI.MultimediaDownloader" />


    | English | Chinese | Japan | Korean |           - 96 -                 Test Information Co., Ltd. All rights reserved.
</httpHandlers>

Answer: C



78. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code segment to create a class named MultimediaDownloader that implements the

IHttpHandler interface.

Namespace Contoso.Web.UI

  Public Class MultimediaDownloader

     Implements IHttpHandler

     ...

  End Class

End Namespace

The MultimediaDownloader class performs the following tasks:

¡¤It returns the content of the multimedia files from the Web server

¡¤It processes requests for the files that have the .media file extension

The .media file extension is mapped to the aspnet_isapi.dll file in Microsoft IIS 6.0.

You need to configure the MultimediaDownloader class in the Web.config file of the application.

Which code fragment should you use?

A. <httpHandlers>

  <add verb="*.media" path="*" validate="false"

   type="Contoso.Web.UI.MultimediaDownloader" />

</httpHandlers>

B. <httpHandlers>

  <add verb="HEAD" path="*.media" validate="true"

   type="Contoso.Web.UI.MultimediaDownloader" />

</httpHandlers>

C. <httpHandlers>

  <add verb="*" path="*.media" validate="false"

   type="Contoso.Web.UI.MultimediaDownloader" />


 | English | Chinese | Japan | Korean |              - 97 -                 Test Information Co., Ltd. All rights reserved.
</httpHandlers>

D. <httpHandlers>

     <add verb="GET,POST" path="*" validate="true"

      type="Contoso.Web.UI.MultimediaDownloader" />

</httpHandlers>

Answer: C



79. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a class that implements the IHttpHandler interface. You implement the ProcessRequest

method by using the following code segment. (Line numbers are included for reference only.)

01 public void ProcessRequest(HttpContext ctx) {

02

03 }

You need to ensure that the image named Alert.jpg is displayed in the browser when the handler is

requested.

Which code segment should you insert at line 02?

A. StreamReader sr = new StreamReader(File.OpenRead(ctx.Server.MapPath("Alert.jpg")));

ctx.Response.Pics(sr.ReadToEnd());

sr.Close();

B. StreamReader sr = new StreamReader(File.OpenRead(ctx.Server.MapPath("Alert.jpg")));

ctx.Response.Pics("image/jpg");

ctx.Response.TransmitFile(sr.ReadToEnd());

sr.Close();

C. ctx.Response.ContentType = "image/jpg";

FileStream fs = File.OpenRead(ctx.Server.MapPath("Alert.jpg"));

int b;

while ((b = fs.ReadByte()) != -1) {

     ctx.Response.OutputStream.WriteByte((byte)b);

}


    | English | Chinese | Japan | Korean |           - 98 -          Test Information Co., Ltd. All rights reserved.
fs.Close();

D. ctx.Response.TransmitFile("image/jpg");

FileStream fs = File.OpenRead(ctx.Server.MapPath("Alert.jpg"));

int b;

while ((b = fs.ReadByte()) != -1) {

     ctx.Response.OutputStream.WriteByte((byte)b);

}

fs.Close();

Answer: C



80. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a class that implements the IHttpHandler interface. You implement the ProcessRequest

method by using the following code segment. (Line numbers are included for reference only.)

01 Public Sub ProcessRequest(ByVal ctx As HttpContext)

02

03 End Sub

You need to ensure that the image named Alert.jpg is displayed in the browser when the handler is

requested.

Which code segment should you insert at line 02?

A. Dim sr As New StreamReader( _File.OpenRead(ctx.Server.MapPath("Alert.jpg")))

ctx.Response.Pics(sr.ReadToEnd())

sr.Close()

B. Dim sr As New StreamReader( _File.OpenRead(ctx.Server.MapPath("Alert.jpg")))

ctx.Response.Pics("image/jpg")

ctx.Response.TransmitFile(sr.ReadToEnd())

sr.Close()

C. ctx.Response.ContentType = "image/jpg"

Dim fs As FileStream = File.OpenRead( _ctx.Server.MapPath("Alert.jpg"))

Dim b As Integer


    | English | Chinese | Japan | Korean |           - 99 -          Test Information Co., Ltd. All rights reserved.
While (b = fs.ReadByte()) <> -1

  ctx.Response.OutputStream.WriteByte(CByte(b))

End While

Fs.Close()

D. ctx.Response.TransmitFile("image/jpg")

Dim fs As FileStream = File.OpenRead( _ctx.Server.MapPath("Alert.jpg"))

Dim b As Integer

While (b = fs.ReadByte()) <> -1

  ctx.Response.OutputStream.WriteByte(CByte(b))

End While

Fs.Close()

Answer: C



81. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5.

The computer that hosts the ASP.NET Web application contains a local instance of Microsoft SQL Server

2005. The instance uses Windows Authentication. You plan to configure the membership providers and

the role management providers.

You need to install the database elements for both the providers on the local computer.

What should you do?

A. Run the sqlcmd.exe -S localhost E command from the command line.

B. Run the aspnet_regiis.exe -s localhost command from the command line.

C. Run the sqlmetal.exe /server:localhost command from the command line.

D. Run the aspnet_regsql.exe -E -S localhost -A mr command from the command line.

Answer: D



82. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5.

The computer that hosts the ASP.NET Web application contains a local instance of Microsoft SQL Server

2005. The instance uses Windows Authentication. You plan to configure the membership providers and

the role management providers.


| English | Chinese | Japan | Korean |             - 100 -             Test Information Co., Ltd. All rights reserved.
You need to install the database elements for both the providers on the local computer.

What should you do?

A. Run the sqlcmd.exe -S localhost E command from the command line.

B. Run the aspnet_regiis.exe -s localhost command from the command line.

C. Run the sqlmetal.exe /server:localhost command from the command line.

D. Run the aspnet_regsql.exe -E -S localhost -A mr command from the command line.

Answer: D



83. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5.

You use Windows Authentication for the application. You set up NTFS file system permissions for the

Sales group to access a particular file. You discover that all the users are able to access the file.

You need to ensure that only the Sales group users can access the file.

What additional step should you perform?

A. Remove the rights from the ASP.NET user to the file.

B. Remove the rights from the application pool identity to the file.

C. Add the <identity impersonate="true"/> section to the Web.config file.

D. Add the <authentication mode="[None]"> section to the Web.config file.

Answer: C



84. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5.

You use Windows Authentication for the application. You set up NTFS file system permissions for the

Sales group to access a particular file. You discover that all the users are able to access the file.

You need to ensure that only the Sales group users can access the file.

What additional step should you perform?

A. Remove the rights from the ASP.NET user to the file.

B. Remove the rights from the application pool identity to the file.

C. Add the <identity impersonate="true"/> section to the Web.config file.

D. Add the <authentication mode="[None]"> section to the Web.config file.

Answer: C


 | English | Chinese | Japan | Korean |               - 101 -              Test Information Co., Ltd. All rights reserved.
85. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5.

You plan to set up authentication for the Web application. The application must support users from

untrusted domains.

You need to ensure that anonymous users cannot access the application.

Which code fragment should you add to the Web.config file?

A. <system.web>

  <authentication mode="Forms">

    <forms loginUrl="login.aspx" />

  </authentication>

  <authorization>

    <deny users="?" />

  </authorization>

</system.web>

B. <system.web>

  <authentication mode="Forms">

    <forms loginUrl="login.aspx" />

  </authentication>

  <authorization>

    <deny users="*" />

  </authorization>

</system.web>

C. <system.web>

  <authentication mode="Windows">

  </authentication>

  <authorization>

    <deny users="?" />

  </authorization>

</system.web>


| English | Chinese | Japan | Korean |           - 102 -            Test Information Co., Ltd. All rights reserved.
D. <system.web>

  <authentication mode="Windows">

  </authentication>

  <authorization>

    <deny users="*" />

  </authorization>

</system.web>

Answer: A



86. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5.

You plan to set up authentication for the Web application. The application must support users from

untrusted domains.

You need to ensure that anonymous users cannot access the application.

Which code fragment should you add to the Web.config file?

A. <system.web>

  <authentication mode="Forms">

    <forms loginUrl="login.aspx" />

  </authentication>

  <authorization>

    <deny users="?" />

  </authorization>

</system.web>

B. <system.web>

  <authentication mode="Forms">

    <forms loginUrl="login.aspx" />

  </authentication>

  <authorization>

    <deny users="*" />

  </authorization>


| English | Chinese | Japan | Korean |           - 103 -            Test Information Co., Ltd. All rights reserved.
</system.web>

C. <system.web>

  <authentication mode="Windows">

  </authentication>

  <authorization>

     <deny users="?" />

  </authorization>

</system.web>

D. <system.web>

  <authentication mode="Windows">

  </authentication>

  <authorization>

     <deny users="*" />

  </authorization>

</system.web>

Answer: A



87. You are maintaining a Microsoft ASP.NET Web Application that was created by using the

Microsoft .NET Framework version 3.5.

You obtain the latest version of the project from the source control repository. You discover that an

assembly reference is missing when you attempt to compile the project on your computer.

You need to compile the project on your computer.

What should you do?

A. Add a reference path in the property pages of the project to the location of the missing assembly.

B. Add a working directory in the property pages of the project to the location of the missing assembly.

C. Change the output path in the property pages of the project to the location of the missing assembly.

D. Delete the assembly reference. Add a reference to the missing assembly by browsing for it on your

computer.

Answer: A


 | English | Chinese | Japan | Korean |             - 104 -              Test Information Co., Ltd. All rights reserved.
88. You are maintaining a Microsoft ASP.NET Web Application that was created by using the

Microsoft .NET Framework version 3.5.

You obtain the latest version of the project from the source control repository. You discover that an

assembly reference is missing when you attempt to compile the project on your computer.

You need to compile the project on your computer.

What should you do?

A. Add a reference path in the property pages of the project to the location of the missing assembly.

B. Add a working directory in the property pages of the project to the location of the missing assembly.

C. Change the output path in the property pages of the project to the location of the missing assembly.

D. Delete the assembly reference. Add a reference to the missing assembly by browsing for it on your

computer.

Answer: A



89. You have a Microsoft ASP.NET Framework version 1.0 application. The application does not use any

features that are deprecated in the Microsoft .NET Framework version 3.5. The application runs on

Microsoft IIS 6.0.

You need to configure the application to use the ASP.NET Framework version 3.5 without recompiling the

application.

What should you do?

A. Edit the ASP.NET runtime version in IIS 6.0.

B. Edit the System.Web section handler version number in the machine.config file.

C. Add the requiredRuntime configuration element to the Web.config file and set the version attribute to

v3.5.

D. Add the supportedRuntime configuration element in the Web.config file and set the version attribute to

v3.5.

Answer: A



90. You have a Microsoft ASP.NET Framework version 1.0 application. The application does not use any


 | English | Chinese | Japan | Korean |             - 105 -              Test Information Co., Ltd. All rights reserved.
features that are deprecated in the Microsoft .NET Framework version 3.5. The application runs on

Microsoft IIS 6.0.

You need to configure the application to use the ASP.NET Framework version 3.5 without recompiling the

application.

What should you do?

A. Edit the ASP.NET runtime version in IIS 6.0.

B. Edit the System.Web section handler version number in the machine.config file.

C. Add the requiredRuntime configuration element to the Web.config file and set the version attribute to

v3.5.

D. Add the supportedRuntime configuration element in the Web.config file and set the version attribute to

v3.5.

Answer: A



91. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5.

The application uses ASP.NET AJAX, and you plan to deploy it in a Web farm environment.

You need to configure SessionState for the application.

Which code fragment should you use?

A. <sessionState mode="InProc"cookieless="UseCookies"/>

B. <sessionState mode="InProc"cookieless="UseDeviceProfile"/>

C.          <sessionState             mode="SQLServer"cookieless="false"sqlConnectionString="Integrated

Security=SSPI;data source=MySqlServer;"/>

D.         <sessionState            mode="SQLServer"cookieless="UseUri"sqlConnectionString="Integrated

Security=SSPI;data source=MySqlServer;"/>

Answer: C



92. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5.

The application uses ASP.NET AJAX, and you plan to deploy it in a Web farm environment.

You need to configure SessionState for the application.

Which code fragment should you use?


 | English | Chinese | Japan | Korean |              - 106 -            Test Information Co., Ltd. All rights reserved.
A. <sessionState mode="InProc"cookieless="UseCookies"/>

B. <sessionState mode="InProc"cookieless="UseDeviceProfile"/>

C.          <sessionState             mode="SQLServer"cookieless="false"sqlConnectionString="Integrated

Security=SSPI;data source=MySqlServer;"/>

D.         <sessionState            mode="SQLServer"cookieless="UseUri"sqlConnectionString="Integrated

Security=SSPI;data source=MySqlServer;"/>

Answer: C



93. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5.

You deploy the application on a Microsoft IIS 6.0 Web server. The server runs on a worker process

isolation mode, and it hosts the .NET Framework version 1.1 Web applications.

When you attempt to browse the application, the following error message is received:

"It is not possible to run different versions of ASP.NET in the same IIS process. Please use the IIS

Administration Tool to reconfigure your server to run the application in a separate process."

You need to ensure that the following requirements are met:

¡¤All the applications run on the server

¡¤All the applications remain in process isolation mode

¡¤All the applications do not change their configuration.

Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. Create a new application pool and add the new application to the pool.

B. Configure the IIS 6.0 to run the WWW service in the IIS 5.0 isolation mode.

C. Configure the new application to use the .NET Framework version 2.0 in the IIS 6.0 Manager.

D. Set autoConfig="false" on the <processModel> property in the machine.config file.

E. Disable the Recycle worker processes option in the Application Pool Properties dialog box.

Answer: AC



94. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5.

You deploy the application on a Microsoft IIS 6.0 Web server. The server runs on a worker process

isolation mode, and it hosts the .NET Framework version 1.1 Web applications.


 | English | Chinese | Japan | Korean |              - 107 -             Test Information Co., Ltd. All rights reserved.
When you attempt to browse the application, the following error message is received:

"It is not possible to run different versions of ASP.NET in the same IIS process. Please use the IIS

Administration Tool to reconfigure your server to run the application in a separate process."

You need to ensure that the following requirements are met:

¡¤All the applications run on the server

¡¤All the applications remain in process isolation mode

¡¤All the applicatios do not change their configurations.

Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. Create a new application pool and add the new application to the pool.

B. Configure the IIS 6.0 to run the WWW service in the IIS 5.0 isolation mode.

C. Configure the new application to use the .NET Framework version 2.0 in the IIS 6.0 Manager.

D. Set autoConfig="false" on the <processModel> property in the machine.config file.

E. Disable the Recycle worker processes option in the Application Pool Properties dialog box.

Answer: AC



95. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

The application has a Web form file named MovieReviews.aspx.

The MovieReviews.aspx file connects to a LinqDataSource DataSource named LinqDataSource1 that

has a primary key named MovieID.

The application has a DetailsView control named DetailsView1.

The MovieReviews.aspx file contains the following code fragment. (Line numbers are included for

reference only.)

01 <asp:DetailsView ID="DetailsView1" runat="server"

02 DataSourceID="LinqDataSource1"

03

04 />

05      <Fields>

06        <asp:BoundField DataField="MovieID" HeaderText="MovieID"

07         InsertVisible="False"


 | English | Chinese | Japan | Korean |              - 108 -             Test Information Co., Ltd. All rights reserved.
08        ReadOnly="True" SortExpression="MovieID" />

09       <asp:BoundField DataField="Title" HeaderText="Title"

10        SortExpression="Title" />

11      <asp:BoundField DataField="Theater" HeaderText="Theater"

12        SortExpression="Theater" />

13       <asp:CommandField ShowDeleteButton="false"

14       ShowEditButton="True" ShowInsertButton="True" />

15    </Fields>

16 </asp:DetailsView>

You need to ensure that the users can insert and update content in the DetailsView1 control. You also

need to prevent duplication of the link button controls for the Edit and New operations.

Which code segment should you insert at line 03?

A. AllowPaging="false"

AutoGenerateRows="false"

B. AllowPaging="true"

AutoGenerateRows="false"

DataKeyNames="MovieID"

C. AllowPaging="true"

AutoGenerateDeleteButton="false"

AutoGenerateEditButton="true"

AutoGenerateInsertButton="true"

AutoGenerateRows="false"

D. AllowPaging="false"

AutoGenerateDeleteButton="false"

AutoGenerateEditButton="true"

AutoGenerateInsertButton="true"

AutoGenerateRows="false"

DataKeyNames="MovieID"

Answer: B


 | English | Chinese | Japan | Korean |             - 109 -              Test Information Co., Ltd. All rights reserved.
96. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

The application has a Web form file named MovieReviews.aspx.

The MovieReviews.aspx file connects to a LinqDataSource DataSource named LinqDataSource1 that

has a primary key named MovieID.

The application has a DetailsView control named DetailsView1.

The MovieReviews.aspx file contains the following code fragment. (Line numbers are included for

reference only.)

01 <asp:DetailsView ID="DetailsView1" runat="server"

02 DataSourceID="LinqDataSource1"

03

04 />

05      <Fields>

06        <asp:BoundField DataField="MovieID" HeaderText="MovieID"

07         InsertVisible="False"

08         ReadOnly="True" SortExpression="MovieID" />

09        <asp:BoundField DataField="Title" HeaderText="Title"

10         SortExpression="Title" />

11        <asp:BoundField DataField="Theater" HeaderText="Theater"

12         SortExpression="Theater" />

13        <asp:CommandField ShowDeleteButton="false"

14 ShowEditButton="True" ShowInsertButton="True" />

15      </Fields>

16 </asp:DetailsView>

You need to ensure that the users can insert and update content in the DetailsView1 control. You also

need to prevent duplication of the link button controls for the Edit and New operations.

Which code segment should you insert at line 03?

A. AllowPaging="false"

AutoGenerateRows="false"


 | English | Chinese | Japan | Korean |             - 110 -              Test Information Co., Ltd. All rights reserved.
B. AllowPaging="true"

AutoGenerateRows="false"

DataKeyNames="MovieID"

C. AllowPaging="true"

AutoGenerateDeleteButton="false"

AutoGenerateEditButton="true"

AutoGenerateInsertButton="true"

AutoGenerateRows="false"

D. AllowPaging="false"

AutoGenerateDeleteButton="false"

AutoGenerateEditButton="true"

AutoGenerateInsertButton="true"

AutoGenerateRows="false"

DataKeyNames="MovieID"

Answer: B



97. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a custom-templated server control.

You need to ensure that the child controls of the server control are uniquely identified within the control

hierarchy of the page.

Which interface should you implement?

A. the ITemplatable interface

B. the INamingContainer interface

C. the IRequiresSessionState interface

D. the IPostBackDataHandler interface

Answer: B



98. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a custom-templated server control.


 | English | Chinese | Japan | Korean |             - 111 -             Test Information Co., Ltd. All rights reserved.
You need to ensure that the child controls of the server control are uniquely identified within the control

hierarchy of the page.

Which interface should you implement?

A. the ITemplatable interface

B. the INamingContainer interface

C. the IRequiresSessionState interface

D. the IPostBackDataHandler interface

Answer: B



99. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code fragment. (Line numbers are included for reference only.)

01 <asp:RequiredFieldValidator

02   ID="rfValidator1" runat="server"

03   Display="Dynamic" ControlToValidate="TextBox1"

04

05   >

06

07 </asp:RequiredFieldValidator>

08

09 <asp:ValidationSummary DisplayMode="List"

10   ID="ValidationSummary1" runat="server" />

You need to ensure that the error message displayed in the validation control is also displayed in the

validation summary list.

What should you do?

A. Add the following code segment to line 06.

Required text in TextBox1

B. Add the following code segment to line 04.

Text="Required text in TextBox1"

C. Add the following code segment to line 04.


 | English | Chinese | Japan | Korean |             - 112 -             Test Information Co., Ltd. All rights reserved.
ErrorMessage="Required text in TextBox1"

D. Add the following code segment to line 04.

Text="Required text in TextBox1" ErrorMessage="ValidationSummary1"

Answer: C



100. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code fragment. (Line numbers are included for reference only.)

01 <asp:RequiredFieldValidator

02   ID="rfValidator1" runat="server"

03   Display="Dynamic" ControlToValidate="TextBox1"

04

05   >

06

07 </asp:RequiredFieldValidator>

08

09 <asp:ValidationSummary DisplayMode="List"

10   ID="ValidationSummary1" runat="server" />

You need to ensure that the error message displayed in the validation control is also displayed in the

validation summary list.

What should you do?

A. Add the following code segment to line 06.

Required text in TextBox1

B. Add the following code segment to line 04.

Text="Required text in TextBox1"

C. Add the following code segment to line 04.

ErrorMessage="Required text in TextBox1"

D. Add the following code segment to line 04.

Text="Required text in TextBox1" ErrorMessage="ValidationSummary1"

Answer: C


 | English | Chinese | Japan | Korean |            - 113 -             Test Information Co., Ltd. All rights reserved.
101. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You plan to submit text that contains HTML code to a page in the application.

You need to ensure that the HTML code can be submitted successfully without affecting other applications

that run on the Web server.

What should you do?

A. Add the following attribute to the @Page directive.

EnableEventValidation="true"

B. Add the following attribute to the @Page directive.

ValidateRequest="true"

C. Set the following value in the Web.config file.

<system.web>

  <pages validateRequest="false"/>

</system.web>

D. Set the following value in the Machine.config file.

<system.web>

  <pages validateRequest="false"/>

</system.web>

Answer: C



102. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You plan to submit text that contains HTML code to a page in the application.

You need to ensure that the HTML code can be submitted successfully without affecting other applications

that run on the Web server.

What should you do?

A. Add the following attribute to the @Page directive.

EnableEventValidation="true"

B. Add the following attribute to the @Page directive.

ValidateRequest="true"


 | English | Chinese | Japan | Korean |              - 114 -           Test Information Co., Ltd. All rights reserved.
C. Set the following value in the Web.config file.

<system.web>

  <pages validateRequest="false"/>

</system.web>

D. Set the following value in the Machine.config file.

<system.web>

  <pages validateRequest="false"/>

</system.web>

Answer: C



103. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The

application consumes an ASMX Web service.

The Web service is hosted at the following URL.

http://www.contoso.com/TemperatureService/Convert.asmx

You need to ensure that the client computers can communicate with the service as part of the

<system.serviceModel> configuration.

Which code fragment should you use?

A. <client>

  <endpoint

address="http: //www.contoso.com/TemperatureService/Convert.asmx"

binding="wsHttpBinding"        -/

</client>

B. <client>

  <endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx"

binding="basicHttpBinding"          -/

</client>

C. <client>

  <endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx"

binding="ws2007HttpBinding"              -/


 | English | Chinese | Japan | Korean |              - 115 -         Test Information Co., Ltd. All rights reserved.
</client>

D. <client>

  <endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx"

binding="wsDualHttpBinding"              -/

</client>

Answer: B



104. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The

application consumes an ASMX Web service.

The Web service is hosted at the following URL.

http://www.contoso.com/TemperatureService/Convert.asmx

You need to ensure that the client computers can communicate with the service as part of the

<system.serviceModel> configuration.

Which code fragment should you use?

A. <client>

  <endpoint

address=" http: //www.contoso.com/TemperatureService/Convert.asmx"

binding="wsHttpBinding"        -/

</client>

B. <client>

  <endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx"

binding="basicHttpBinding"          -/

</client>

C. <client>

  <endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx"

binding="ws2007HttpBinding"              -/

</client>

D. <client>

  <endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx"


 | English | Chinese | Japan | Korean |           - 116 -            Test Information Co., Ltd. All rights reserved.
binding="wsDualHttpBinding"         -/

</client>

Answer: B



105. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a file named movies.xml that contains the following code fragment.

<Movies>

  <Movie ID="1" Name="Movie1" Year="2006">

     <Desc Value="Movie desc"/>

  </Movie>

  <Movie ID="2" Name="Movie2" Year="2007">

     <Desc Value="Movie desc"/>

  </Movie>

  <Movie ID="3" Name="Movie3" Year="2008">

     <Desc Value="Movie desc"/>

  </Movie>

</Movies>

You add a Web form to the application.

You write the following code segment in the Web form. (Line numbers are included for reference only.)

01 <form runat="server">

02    <asp:xmldatasource

03     id="XmlDataSource1"

04     runat="server"

05     datafile="movies.xml" />

06

07 </form>

You need to implement the XmlDataSource control to display the XML data in a TreeView control.

Which code segment should you insert at line 06?

A. <asp:TreeView ID="TreeView1" runat="server"DataSourceID="XmlDataSource1">


 | English | Chinese | Japan | Korean |            - 117 -            Test Information Co., Ltd. All rights reserved.
<DataBindings>

    <asp:TreeNodeBinding DataMember="Movie" Text="Name" />

  </DataBindings>

</asp:TreeView>

B. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1">

  <DataBindings>

    <asp:TreeNodeBinding DataMember="Movies" Text="Desc" />

  </DataBindings>

</asp:TreeView>

C. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="MovDataSource1">

  <DataBindings>

    <asp:TreeNodeBinding DataMember="Movie" Text="Name" />

  </DataBindings>

</asp:TreeView>

D. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="MovDataSource1">

  <DataBindings>

    <asp:TreeNodeBinding DataMember="Movies" Text="Desc" />

  </DataBindings>

</asp:TreeView>

Answer: A



106. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a file named movies.xml that contains the following code fragment.

<Movies>

  <Movie ID="1" Name="Movie1" Year="2006">

    <Desc Value="Movie desc"/>

  </Movie>

  <Movie ID="2" Name="Movie2" Year="2007">

    <Desc Value="Movie desc"/>


| English | Chinese | Japan | Korean |            - 118 -             Test Information Co., Ltd. All rights reserved.
</Movie>

  <Movie ID="3" Name="Movie3" Year="2008">

     <Desc Value="Movie desc"/>

  </Movie>

</Movies>

You add a Web form to the application.

You write the following code segment in the Web form. (Line numbers are included for reference only.)

01 <form runat="server">

02    <asp:xmldatasource

03     id="XmlDataSource1"

04     runat="server"

05     datafile="movies.xml" />

06

07 </form>

You need to implement the XmlDataSource control to display the XML data in a TreeView control.

Which code segment should you insert at line 06?

A. <asp:TreeView ID="TreeView1" runat="server"DataSourceID="XmlDataSource1">

  <DataBindings>

     <asp:TreeNodeBinding DataMember="Movie" Text="Name" />

  </DataBindings>

</asp:TreeView>

B. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1">

  <DataBindings>

     <asp:TreeNodeBinding DataMember="Movies" Text="Desc" />

  </DataBindings>

</asp:TreeView>

C. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="MovDataSource1">

  <DataBindings>

     <asp:TreeNodeBinding DataMember="Movie" Text="Name" />


| English | Chinese | Japan | Korean |             - 119 -            Test Information Co., Ltd. All rights reserved.
</DataBindings>

</asp:TreeView>

D. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="MovDataSource1">

  <DataBindings>

     <asp:TreeNodeBinding DataMember="Movies" Text="Desc" />

  </DataBindings>

</asp:TreeView>

Answer: A



107. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a FormView control to access the results of a query. The query contains the following fields:

¡¤EmployeeI

¡¤FirstNam

¡¤LastNam

The user must be able to view and update the FirstName field.

You need to define the control definition for the FirstName field in the FormView control.

Which code fragment should you use?

A. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text="<%# Bind("FirstName") %>" />

B. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text="<%# Eval("FirstName") %>" />

C. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text='<%# Bind("FirstName") %>' />

D. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text='<%# Eval("FirstName") %>' />

Answer: C



108. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a FormView control to access the results of a query. The query contains the following fields:

¡¤EmployeID

¡¤FirstNam

¡¤LastNam

The user must be able to view and update the FirstName field.


 | English | Chinese | Japan | Korean |             - 120 -              Test Information Co., Ltd. All rights reserved.
You need to define the control definition for the FirstName field in the FormView control.

Which code fragment should you use?

A. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text="<%# Bind("FirstName") %>" />

B. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text="<%# Eval("FirstName") %>" />

C. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text='<%# Bind("FirstName") %>' />

D. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text='<%# Eval("FirstName") %>' />

Answer: C



109. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

The application contains a DataSourceControl named CategoriesDataSource that is bound to a Microsoft

SQL Server 2005 table. The CategoryName column is the primary key of the table.

You write the following code fragment in a FormView control. (Line numbers are included for reference

only.)

01 <tr>

02       <td align="right"><b>Category:</b></td>

03         <td><asp:DropDownList ID="InsertCategoryDropDownList"

04

05          DataSourceID="CategoriesDataSource"

06          DataTextField="CategoryName"

07          DataValueField="CategoryID"

08          RunAt="Server" />

09       </td>

10 </tr>

You need to ensure that the changes made to the CategoryID field can be written to the database.

Which code fragment should you insert at line 04?

A. SelectedValue='<%# Eval("CategoryID") %>'

B. SelectedValue='<%# Bind("CategoryID") %>'

C. SelectedValue='<%# Eval("CategoryName") %>'

D. SelectedValue='<%# Bind("CategoryName") %>'


 | English | Chinese | Japan | Korean |             - 121 -              Test Information Co., Ltd. All rights reserved.
Answer: B



110. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

The application contains a DataSourceControl named CategoriesDataSource that is bound to a Microsoft

SQL Server 2005 table. The CategoryName column is the primary key of the table.

You write the following code fragment in a FormView control. (Line numbers are included for reference

only.)

01 <tr>

02       <td align="right"><b>Category:</b></td>

03         <td><asp:DropDownList ID="InsertCategoryDropDownList"

04

05          DataSourceID="CategoriesDataSource"

06          DataTextField="CategoryName"

07          DataValueField="CategoryID"

08          RunAt="Server" />

09       </td>

10 </tr>

You need to ensure that the changes made to the CategoryID field can be written to the database.

Which code fragment should you insert at line 04?

A. SelectedValue='<%# Eval("CategoryID") %>'

B. SelectedValue='<%# Bind("CategoryID") %>'

C. SelectedValue='<%# Eval("CategoryName") %>'

D. SelectedValue='<%# Bind("CategoryName") %>'

Answer: B



111. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web page to display photos and captions. The caption of each photo in the database can be

modified by using the application.

You write the following code fragment.


 | English | Chinese | Japan | Korean |             - 122 -           Test Information Co., Ltd. All rights reserved.
<asp:FormView DataSourceID="ObjectDataSource1" DataKeyNames="PhotoID" runat="server">

  <EditItemTemplate>

     <asp:TextBox Text='<%# Bind("Caption") %>' runat="server"/>

     <asp:Button Text="Update" CommandName="Update"

      runat="server"/>

     <asp:Button Text="Cancel" CommandName="Cancel"

      runat="server"/>

  </EditItemTemplate>

  <ItemTemplate>

     <asp:Label Text='<%# Eval("Caption") %>' runat="server" />

     <asp:Button Text="Edit" CommandName="Edit" runat="server"/>

  </ItemTemplate>

</asp:FormView>

When you access the Web page, the application throws an error.

You need to ensure that the application successfully updates each caption and stores it in the database.

What should you do?

A. Add the ID attribute to the Label control.

B. Add the ID attribute to the TextBox control.

C. Use the Bind function for the Label control instead of the Eval function.

D. Use the Eval function for the TextBox control instead of the Bind function.

Answer: B



112. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web page to display photos and captions. The caption of each photo in the database can be

modified by using the application.

You write the following code fragment.

<asp:FormView DataSourceID="ObjectDataSource1" DataKeyNames="PhotoID" runat="server">

  <EditItemTemplate>

     <asp:TextBox Text='<%# Bind("Caption") %>' runat="server"/>


 | English | Chinese | Japan | Korean |              - 123 -              Test Information Co., Ltd. All rights reserved.
<asp:Button Text="Update" CommandName="Update"

      runat="server"/>

     <asp:Button Text="Cancel" CommandName="Cancel"

      runat="server"/>

  </EditItemTemplate>

  <ItemTemplate>

     <asp:Label Text='<%# Eval("Caption") %>' runat="server" />

     <asp:Button Text="Edit" CommandName="Edit" runat="server"/>

  </ItemTemplate>

</asp:FormView>

When you access the Web page, the application throws an error.

You need to ensure that the application successfully updates each caption and stores it in the database.

What should you do?

A. Add the ID attribute to the Label control.

B. Add the ID attribute to the TextBox control.

C. Use the Bind function for the Label control instead of the Eval function.

D. Use the Eval function for the TextBox control instead of the Bind function.

Answer: B



113. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The

application contains two HTML pages named ErrorPage.htm and PageNotFound.htm.

You need to ensure that the following requirements are met:

¡¤When the userrequests a page that does not exist, the PageNotFound.htm page is displayed.

¡¤When any other error occurs, the ErrorPage.htm page is displayed

Which section should you add to the Web.config file?

A. <customErrors mode="Off" defaultRedirect="ErrorPage.htm">

  <error statusCode="404" redirect="PageNotFound.htm"/>

</customErrors>

B. <customErrors mode="On" defaultRedirect="ErrorPage.htm">


 | English | Chinese | Japan | Korean |              - 124 -              Test Information Co., Ltd. All rights reserved.
<error statusCode="404" redirect="PageNotFound.htm"/>

</customErrors>

C. <customErrors mode="Off">

  <error statusCode="400" redirect="ErrorPage.htm"/>

  <error statusCode="404" redirect="PageNotFound.htm"/>

</customErrors>

D. <customErrors mode="On">

  <error statusCode="400" redirect="ErrorPage.htm"/>

  <error statusCode="404" redirect="PageNotFound.htm"/>

</customErrors>

Answer: B



114. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The

application contains two HTML pages named ErrorPage.htm and PageNotFound.htm.

You need to ensure that the following requirements are met:

¡¤hen the user requests a page that does not exist, the PageNotFound.htm page is displayed.

¡¤When any other error occurs, the ErrorPage.htm page is displayed

Which section should you add to the Web.config file?

A. <customErrors mode="Off" defaultRedirect="ErrorPage.htm">

  <error statusCode="404" redirect="PageNotFound.htm"/>

</customErrors>

B. <customErrors mode="On" defaultRedirect="ErrorPage.htm">

  <error statusCode="404" redirect="PageNotFound.htm"/>

</customErrors>

C. <customErrors mode="Off">

  <error statusCode="400" redirect="ErrorPage.htm"/>

  <error statusCode="404" redirect="PageNotFound.htm"/>

</customErrors>

D. <customErrors mode="On">


| English | Chinese | Japan | Korean |            - 125 -            Test Information Co., Ltd. All rights reserved.
<error statusCode="400" redirect="ErrorPage.htm"/>

  <error statusCode="404" redirect="PageNotFound.htm"/>

</customErrors>

Answer: B



115. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You plan to deploy the application to a test server.

You need to ensure that during the initial request to the application, the code-behind files for the Web

pages are compiled. You also need to optimize the performance of the application.

Which code fragment should you add to the Web.config file?

A. <compilation debug="true">

B. <compilation debug="false">

C. <compilation debug="true" batch="true">

D. <compilation debug="false" batch="false">

Answer: B



116. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You plan to deploy the application to a test server.

You need to ensure that during the initial request to the application, the code-behind files for the Web

pages are compiled. You also need to optimize the performance of the application.

Which code fragment should you add to the Web.config file?

A. <compilation debug="true">

B. <compilation debug="false">

C. <compilation debug="true" batch="true">

D. <compilation debug="false" batch="false">

Answer: B



117. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You host the application on a server named ContosoTest that runs Microsoft IIS 6.0. You set up remote


 | English | Chinese | Japan | Korean |                - 126 -        Test Information Co., Ltd. All rights reserved.
debugging on the ContosoTest server.

You need to debug the application remotely from another computer named ContosoDev.

What should you do?

A. Attach Microsoft Visual Studio.NET to the w3wp.exe process.

B. Attach Microsoft Visual Studio.NET to the inetinfo.exe process.

C. Attach Microsoft Visual Studio.NET to the Msvsmon.exe process.

D. Attach Microsoft Visual Studio.NET to the WebDev.WebServer.exe process.

Answer: A



118. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You host the application on a server named ContosoTest that runs Microsoft IIS 6.0. You set up remote

debugging on the ContosoTest server.

You need to debug the application remotely from another computer named ContosoDev.

What should you do?

A. Attach Microsoft Visual Studio.NET to the w3wp.exe process.

B. Attach Microsoft Visual Studio.NET to the inetinfo.exe process.

C. Attach Microsoft Visual Studio.NET to the Msvsmon.exe process.

D. Attach Microsoft Visual Studio.NET to the WebDev.WebServer.exe process.

Answer: A



119. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

The application resides on a server named ContosoTest that runs Microsoft IIS 5.0.

You use a computer named ContosoDev to log on to the Contoso.com domain with an account named

ContosoUser.

The ContosoTest and ContosoDev servers are members of the Contoso.com domain.

You need to set up the appropriate permission for remote debugging.

What should you do?

A. Set the Remote Debugging Monitor to use Windows Authentication.

B. Add the ContosoUser account to the domain Administrators group.


| English | Chinese | Japan | Korean |             - 127 -            Test Information Co., Ltd. All rights reserved.
C. Add the ContosoUser account to the local Administrators group on the ContosoTest server.

D. Change the ASP.NET worker process on the ContosoTest server to run as the local Administrator

account.

Answer: C



120. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

The application resides on a server named ContosoTest that runs Microsoft IIS 5.0.

You use a computer named ContosoDev to log on to the Contoso.com domain with an account named

ContosoUser.

The ContosoTest and ContosoDev servers are members of the Contoso.com domain.

You need to set up the appropriate permission for remote debugging.

What should you do?

A. Set the Remote Debugging Monitor to use Windows Authentication.

B. Add the ContosoUser account to the domain Administrators group.

C. Add the ContosoUser account to the local Administrators group on the ContosoTest server.

D. Change the ASP.NET worker process on the ContosoTest server to run as the local Administrator

account.

Answer: C



121. You create a Microsoft ASP.NET AJAX application by using the Microsoft .NET Framework version

3.5.

You attach Microsoft Visual Studio 2008 debugger to the Microsoft Internet Explorer instance to debug the

JavaScript code in the AJAX application.

You need to ensure that the application displays the details of the client-side object on the debugger

console.

What should you do?

A. Use the Sys.Debug.fail method.

B. Use the Sys.Debug.trace method.

C. Use the Sys.Debug.assert method.


 | English | Chinese | Japan | Korean |            - 128 -             Test Information Co., Ltd. All rights reserved.
D. Use the Sys.Debug.traceDump method.

Answer: D



122. You create a Microsoft ASP.NET AJAX application by using the Microsoft .NET Framework version

3.5.

You attach Microsoft Visual Studio 2008 debugger to the Microsoft Internet Explorer instance to debug the

JavaScript code in the AJAX application.

You need to ensure that the application displays the details of the client-side object on the debugger

console.

What should you do?

A. Use the Sys.Debug.fail method.

B. Use the Sys.Debug.trace method.

C. Use the Sys.Debug.assert method.

D. Use the Sys.Debug.traceDump method.

Answer: D



123. You create a Microsoft ASP.NET AJAX application by using the Microsoft .NET Framework version

3.5.

A JavaScript code segment in the AJAX application does not exhibit the desired behavior. Microsoft

Internet Explorer displays an error icon in the status bar but does not prompt you to debug the script.

You need to configure the Internet Explorer to prompt you to debug the script.

Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. Clear the Disable Script Debugging (Other) check box.

B. Clear the Disable Script Debugging (Internet Explorer) check box.

C. Select the Show friendly HTTP error messages check box.

D. Select the Enable third-party browser extensions check box.

E. Select the Display a notification about every script error check box.

Answer: BE




 | English | Chinese | Japan | Korean |              - 129 -               Test Information Co., Ltd. All rights reserved.
124. You create a Microsoft ASP.NET AJAX application by using the Microsoft .NET Framework version

3.5.

A JavaScript code segment in the AJAX application does not exhibit the desired behavior. Microsoft

Internet Explorer displays an error icon in the status bar but does not prompt you to debug the script.

You need to configure the Internet Explorer to prompt you to debug the script.

Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. Clear the Disable Script Debugging (Other) check box.

B. Clear the Disable Script Debugging (Internet Explorer) check box.

C. Select the Show friendly HTTP error messages check box.

D. Select the Enable third-party browser extensions check box.

E. Select the Display a notification about every script error check box.

Answer: BE



125. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You plan to capture the timing and performance information of the application.

You need to ensure that the information is accessible only when the user is logged on to the Web server

and not on individual Web pages.

What should you add to the Web.config file?

A. <compilation debug="true" />

B. <compilation debug="false" urlLinePragmas="true" />

C. <trace enabled="true" pageOutput="false" localOnly="true" />

D. <trace enabled="true" writeToDiagnosticsTrace="true" pageOutput="true" localOnly="true" />

Answer: C



126. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You plan to capture the timing and performance information of the application.

You need to ensure that the information is accessible only when the user is logged on to the Web server

and not on individual Web pages.

What should you add to the Web.config file?


 | English | Chinese | Japan | Korean |              - 130 -               Test Information Co., Ltd. All rights reserved.
A. <compilation debug="true" />

B. <compilation debug="false" urlLinePragmas="true" />

C. <trace enabled="true" pageOutput="false" localOnly="true" />

D. <trace enabled="true" writeToDiagnosticsTrace="true" pageOutput="true" localOnly="true" />

Answer: C



127. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

When you access the application in a Web browser, you receive the following error message: "Service

Unavailable".

You need to access the application successfully.

What should you do?

A. Start Microsoft IIS 6.0.

B. Start the Application pool.

C. Set the .NET Framework version.

D. Add the Web.config file for the application.

Answer: B



128. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

When you access the application in a Web browser, you receive the following error message: "Service

Unavailable".

You need to access the application successfully.

What should you do?

A. Start Microsoft IIS 6.0.

B. Start the Application pool.

C. Set the .NET Framework version.

D. Add the Web.config file for the application.

Answer: B



129. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.


 | English | Chinese | Japan | Korean |            - 131 -           Test Information Co., Ltd. All rights reserved.
The application is deployed on a Microsoft IIS 6.0 Web server by using the default ASP.NET version 2.0

application pool and Windows Authentication.

The application contains functionality to upload files to a location on a different server.

Users receive an access denied error message when they attempt to submit a file.

You need to modify the Web.config file to resolve the error.

Which code fragment should you use?

A. <identity impersonate="true" />

B. <anonymousIdentification enabled="true" />

C. <roleManager enabled="true"defaultProvider="AspNetWindowsTokenRolePRovider" />

D. <authorization>

      <allow users="*" />

   </authorization>

Answer: A



130. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

The application is deployed on a Microsoft IIS 6.0 Web server by using the default ASP.NET version 2.0

application pool and Windows Authentication.

The application contains functionality to upload files to a location on a different server.

Users receive an access denied error message when they attempt to submit a file.

You need to modify the Web.config file to resolve the error.

Which code fragment should you use?

A. <identity impersonate="true" />

B. <anonymousIdentification enabled="true" />

C. <roleManager enabled="true"defaultProvider="AspNetWindowsTokenRolePRovider" />

D. <authorization>

      <allow users="*" />

   </authorization>

Answer: A




 | English | Chinese | Japan | Korean |               - 132 -               Test Information Co., Ltd. All rights reserved.
131. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version

3.5.

When you review the application performance counters, you discover that there is an unexpected

increase in the value of the Application Restarts counter.

You need to identify the reasons for this increase.

What are three possible reasons that could cause this increase? (Each correct answer presents a

complete solution. Choose three.)

A. Restart of the Microsoft IIS 6.0 host.

B. Restart of the Microsoft Windows Server 2003 that hosts the Web application.

C. Addition of a new assembly in the Bin directory of the application.

D. Addition of a code segment that requires recompilation to the ASP.NET Web application.

E. Enabling of HTTP compression in the Microsoft IIS 6.0 manager for the application.

F. Modification to the Web.config file in the system.web section for debugging the application.

Answer: CDF



132. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version

3.5.

When you review the application performance counters, you discover that there is an unexpected

increase in the value of the Application Restarts counter.

You need to identify the reasons for this increase.

What are three possible reasons that could cause this increase? (Each correct answer presents a

complete solution. Choose three.)

A. Restart of the Microsoft IIS 6.0 host.

B. Restart of the Microsoft Windows Server 2003 that hosts the Web application.

C. Addition of a new assembly in the Bin directory of the application.

D. Addition of a code segment that requires recompilation to the ASP.NET Web application.

E. Enabling of HTTP compression in the Microsoft IIS 6.0 manager for the application.

F. Modification to the Web.config file in the system.web section for debugging the application.

Answer: CDF


 | English | Chinese | Japan | Korean |               - 133 -            Test Information Co., Ltd. All rights reserved.
133. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You plan to monitor the execution of the application at daily intervals.

You need to modify the application configuration to enable WebEvent monitoring.

What should you do?

A. Enable the Debugging in the Web site option in the ASP.NET configuration settings. Modify the

Request Execution timeout to 10 seconds.

   Register the aspnet_perf.dll performance counter library by using the following command.

B. regsvr32 C:WINDOWSMicrosoft.NETFrameworkv2.0.50727aspnet_perf.dll

   Add the following code fragment to the <healthMonitoring> section of the Web.config file of the

application.

C. <profiles>

  <add name="Default" minInstances="1" maxLimit="Infinite" ?

   minInterval="00:00:10"

   custom="" />

</profiles>

Add the following code fragment to the <system.web> section of the Web.config file of the application.

D. <healthMonitoring enabled="true" heartbeatInterval="10">

  <rules>

     <add name="Heartbeats Default"

      eventName="Heartbeat"

      provider="EventLogProvider"

      profile="Critical"/>

  </rules>

</healthMonitoring>

Answer: D



134. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You plan to monitor the execution of the application at daily intervals.


 | English | Chinese | Japan | Korean |              - 134 -               Test Information Co., Ltd. All rights reserved.
You need to modify the application configuration to enable WebEvent monitoring.

What should you do?

A. Enable the Debugging in the Web site option in the ASP.NET configuration settings. Modify the

Request Execution timeout to 10 seconds.

Register the aspnet_perf.dll performance counter library by using the following command.

B. regsvr32 C:WINDOWSMicrosoft.NETFrameworkv2.0.50727aspnet_perf.dll

Add the following code fragment to the <healthMonitoring> section of the Web.config file of the

application.

C. <profiles>

  <add name="Default" minInstances="1" maxLimit="Infinite"

     minInterval="00:00:10"

     custom="" />

</profiles>

Add the following code fragment to the <system.web> section of the Web.config file of the application.

D. <healthMonitoring enabled="true" heartbeatInterval="10">

  <rules>

      <add name="Heartbeats Default"

       eventName="Heartbeat"

       provider="EventLogProvider"

       profile="Critical"/>

  </rules>

</healthMonitoring>

Answer: D



135. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You add the following code fragment to the Web.config file of the application (Line numbers are included

for reference only).

01 <healthMonitoring>

02     <providers>


 | English | Chinese | Japan | Korean |            - 135 -             Test Information Co., Ltd. All rights reserved.
03     <add name="EventLogProvider"

04      type="System.Web.Management.EventLogWebEventProvider

05      />

06     <add name="WmiWebEventProvider"

07      type="System.Web.Management.WmiWebEventProvider

08      />

09     </providers>

10     <eventMappings>

11

12     </eventMappings>

13     <rules>

14        <add name="Security Rule" eventName="Security Event"

15           provider="WmiWebEventProvider" />

16        <add name="AppError Rule" eventName="AppError Event"

17           provider="EventLogProvider" />

18     </rules>

19 </healthMonitoring>

You need to configure Web Events to meet the following requirements:

¡¤Securit-related Web Events are mapped to Microsoft Windows Management Instrumentation (WMI)

events.

¡¤ W Even s caused by p ob e m w h con gu a on o app ca on code a e l ogged i n o t he Wndo w
    eb  t              r l    s it    fi r ti   r  li ti         r             t       i     s

Application Event Log.

Which code fragment should you insert at line 11?

A. <add name="Security Event"type="System.Web.Management.WebAuditEvent"/>

     <add name="AppError Event"type="System.Web.Management.WebRequestErrorEvent"/>

B. <add name="Security Event"type="System.Web.Management.WebAuditEvent"/>

     <add name="AppError Event"type="System.Web.Management.WebErrorEvent"/>

C. <add name="Security Event"type="System.Web.Management.WebApplicationLifetimeEvent"/>

     <add name="AppError Event"type="System.Web.Management.WebRequestErrorEvent"/>


| English | Chinese | Japan | Korean |              - 136 -            Test Information Co., Ltd. All rights reserved.
D. <add name="Security Event"type="System.Web.Management.WebApplicationLifetimeEvent"/>

     <add name="AppError Event"type="System.Web.Management.WebErrorEvent"/>

Answer: B

136. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You add the following code fragment to the Web.config file of the application (Line numbers are included

for reference only).

01 <healthMonitoring>

02     <providers>

03     <add name="EventLogProvider"

04      type="System.Web.Management.EventLogWebEventProvider

05      />

06     <add name="WmiWebEventProvider"

07      type="System.Web.Management.WmiWebEventProvider

08      />

09     </providers>

10     <eventMappings>

11

12     </eventMappings>

13     <rules>

14        <add name="Security Rule" eventName="Security Event"

15           provider="WmiWebEventProvider" />

16        <add name="AppError Rule" eventName="AppError Event"

17           provider="EventLogProvider" />

18     </rules>

19 </healthMonitoring>

You need to configure Web Events to meet the following requirements:

¡¤Securit-related Web Events are mapped to Microsoft Windows Management Instrumentation (WMI)

events.

¡¤ W Even s caused by p ob e m w h con gu a on o app ca on code a e l ogged i n o t he Wndo w
    eb  t              r l    s it    fi r ti   r  li ti         r             t       i     s


 | English | Chinese | Japan | Korean |           - 137 -              Test Information Co., Ltd. All rights reserved.
Application Event Log.

Which code fragment should you insert at line 11?

A. <add name="Security Event"type="System.Web.Management.WebAuditEvent"/>

     <add name="AppError Event"type="System.Web.Management.WebRequestErrorEvent"/>

B. <add name="Security Event"type="System.Web.Management.WebAuditEvent"/>

     <add name="AppError Event"type="System.Web.Management.WebErrorEvent"/>

C. <add name="Security Event"type="System.Web.Management.WebApplicationLifetimeEvent"/>

     <add name="AppError Event"type="System.Web.Management.WebRequestErrorEvent"/>

D. <add name="Security Event"type="System.Web.Management.WebApplicationLifetimeEvent"/>

     <add name="AppError Event"type="System.Web.Management.WebErrorEvent"/>

Answer: B



137. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code fragment. (Line numbers are included for reference only.)

01 <asp:UpdatePanel ID="upnData" runat="server"

02 ChildrenAsTriggers="false" UpdateMode="Conditional">

03 <Triggers>

04

05 </Triggers>

06 <ContentTemplate>

07    <!-- more content here -->

08    <asp:LinkButton ID="lbkLoad" runat="server" Text="Load"

09 onclick="lbkLoad_Click" />

10    <asp:Button ID="btnSubmit" runat="server" Text="Submit"

11     Width="150px" onclick="btnSubmit_Click" />

12 </ContentTemplate>

13 </asp:UpdatePanel>

14 <asp:Button ID="btnUpdate" runat="server" Text="Update"

15 Width="150px" onclick="btnUpdate_Click" />


| English | Chinese | Japan | Korean |              - 138 -            Test Information Co., Ltd. All rights reserved.
You need to ensure that the requirements shown in the following table are met.




What should you do?

A. Set the value of the ChildrenAsTriggers property in line 02 to false.

Add the following code fragment at line 04.

  <asp:AsyncPostBackTrigger ControlID="btnUpdate" />

  <asp:PostBackTrigger ControlID="btnSubmit" />

B. Set the value of the ChildrenAsTriggers property in line 02 to false.

Add the following code fragment at line 04.

  <asp:AsyncPostBackTrigger ControlID="btnSubmit" />

  <asp:PostBackTrigger ControlID="btnUpdate" />

C. Set the value of the ChildrenAsTriggers property in line 02 to true.

Add the following code fragment at line 04.

  <asp:AsyncPostBackTrigger ControlID="btnSubmit" />

  <asp:PostBackTrigger ControlID="btnUpdate" />

D. Set the value of the ChildrenAsTriggers property in line 02 to true.

Add the following code fragment at line 04.

  <asp:AsyncPostBackTrigger ControlID="btnUpdate" />

  <asp:PostBackTrigger ControlID="btnSubmit" />

Answer: D



138. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code fragment. (Line numbers are included for reference only.)

01 <asp:UpdatePanel ID="upnData" runat="server"

02 ChildrenAsTriggers="false" UpdateMode="Conditional">

03 <Triggers>


 | English | Chinese | Japan | Korean |              - 139 -               Test Information Co., Ltd. All rights reserved.
04

05 </Triggers>

06 <ContentTemplate>

07   <!-- more content here -->

08   <asp:LinkButton ID="lbkLoad" runat="server" Text="Load"

09 onclick="lbkLoad_Click" />

10   <asp:Button ID="btnSubmit" runat="server" Text="Submit"

11    Width="150px" onclick="btnSubmit_Click" />

12 </ContentTemplate>

13 </asp:UpdatePanel>

14 <asp:Button ID="btnUpdate" runat="server" Text="Update"

15 Width="150px" onclick="btnUpdate_Click" />

You need to ensure that the requirements shown in the following table are met.




What should you do?

A. Set the value of the ChildrenAsTriggers property in line 02 to false.

Add the following code fragment at line 04.

  <asp:AsyncPostBackTrigger ControlID="btnUpdate" />

  <asp:PostBackTrigger ControlID="btnSubmit" />

B. Set the value of the ChildrenAsTriggers property in line 02 to false.

Add the following code fragment at line 04.

  <asp:AsyncPostBackTrigger ControlID="btnSubmit" />

  <asp:PostBackTrigger ControlID="btnUpdate" />

C. Set the value of the ChildrenAsTriggers property in line 02 to true.

Add the following code fragment at line 04.

  <asp:AsyncPostBackTrigger ControlID="btnSubmit" />


 | English | Chinese | Japan | Korean |              - 140 -               Test Information Co., Ltd. All rights reserved.
<asp:PostBackTrigger ControlID="btnUpdate" />

D. Set the value of the ChildrenAsTriggers property in line 02 to true.

Add the following code fragment at line 04.

  <asp:AsyncPostBackTrigger ControlID="btnUpdate" />

  <asp:PostBackTrigger ControlID="btnSubmit" />

Answer: D



139. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version

3.5.

You add the following code fragment to an AJAX-enabled Web form. (Line numbers are included for

reference only.)

01 <asp:ScriptManager ID="scrMgr" runat="server" />

02 <asp:UpdatePanel ID="updPanel" runat="server"

03     UpdateMode="Conditional">

04     <ContentTemplate>

05       <asp:Label ID="lblTime" runat="server" />

06       <asp:UpdatePanel ID="updInnerPanel"

07        runat="server" UpdateMode="Conditional">

08         <ContentTemplate>

09            <asp:Timer ID="tmrTimer" runat="server"

10             Interval="1000"

11             OnTick="tmrTimer_Tick" />

12         </ContentTemplate>

13

14       </asp:UpdatePanel>

15     </ContentTemplate>

16

17 </asp:UpdatePanel>

The tmrTimer_Tick event handler sets the Text property of the lblTime Label control to the current time of


 | English | Chinese | Japan | Korean |              - 141 -              Test Information Co., Ltd. All rights reserved.
the server.

You need to configure the appropriate UpdatePanel control to ensure that the lblTime Label Control is

properly updated by the tmrTimer Timer control.

What should you do?

A. Set the UpdateMode="Always" attribute to the updInnerPanel UpdatePanel control in line 07.

B. Set the ChildrenAsTriggers="false" attribute to the updPanel UpdatePanel control in line 02.

C. Add the following code fragment to line 13.

<Triggers>

  <asp:PostBackTrigger ControlID="tmrTimer" />

</Triggers>

D. Add the following code fragment to line 16.

<Triggers>

  <asp:AsyncPostBackTrigger ControlID="tmrTimer"

     EventName="Tick" />

</Triggers>

Answer: D



140. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version

3.5.

You add the following code fragment to an AJAX-enabled Web form. (Line numbers are included for

reference only.)

01 <asp:ScriptManager ID="scrMgr" runat="server" />

02 <asp:UpdatePanel ID="updPanel" runat="server"

03     UpdateMode="Conditional">

04     <ContentTemplate>

05       <asp:Label ID="lblTime" runat="server" />

06       <asp:UpdatePanel ID="updInnerPanel"

07        runat="server" UpdateMode="Conditional">

08         <ContentTemplate>


 | English | Chinese | Japan | Korean |              - 142 -            Test Information Co., Ltd. All rights reserved.
09            <asp:Timer ID="tmrTimer" runat="server"

10             Interval="1000"

11             OnTick="tmrTimer_Tick" />

12         </ContentTemplate>

13

14       </asp:UpdatePanel>

15     </ContentTemplate>

16

17 </asp:UpdatePanel>

The tmrTimer_Tick event handler sets the Text property of the lblTime Label control to the current time of

the server.

You need to configure the appropriate UpdatePanel control to ensure that the lblTime Label Control is

properly updated by the tmrTimer Timer control.

What should you do?

A. Set the UpdateMode="Always" attribute to the updInnerPanel UpdatePanel control in line 07.

B. Set the ChildrenAsTriggers="false" attribute to the updPanel UpdatePanel control in line 02.

C. Add the following code fragment to line 13.

<Triggers>

  <asp:PostBackTrigger ControlID="tmrTimer" />

</Triggers>

D. Add the following code fragment to line 16.

<Triggers>

  <asp:AsyncPostBackTrigger ControlID="tmrTimer"

     EventName="Tick" />

</Triggers>

Answer: D



141. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code segment to create a client-script function. (Line numbers are included for


 | English | Chinese | Japan | Korean |            - 143 -              Test Information Co., Ltd. All rights reserved.
reference only.)

01 function updateLabelControl(labelId, newText) {

02     var label = $find(labelId);

03     label.innerHTML = newText;

04 }

The client script function uses ASP.NET AJAX and updates the text of any Label control in the Web form.

When you test the client script function, you discover that the Label controls are not updated. You receive

the following JavaScript error message in the browser: "'null' is null or not an object."

You need to resolve the error.

What should you do?

A. Replace line 03 with the following line of code.

label.innerText = newText;

B. Replace line 02 with the following line of code.

var label = $get(labelId);

C. Replace line 02 with the following line of code.

var label = Sys.UI.DomElement.getElementById($get(labelId));

D. Replace line 02 with the following line of code.

var label = Sys.UI.DomElement.getElementById($find(labelId));

Answer: B



142. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code segment to create a client-script function. (Line numbers are included for

reference only.)

01 function updateLabelControl(labelId, newText) {

02     var label = $find(labelId);

03     label.innerHTML = newText;

04 }

The client script function uses ASP.NET AJAX and updates the text of any Label control in the Web form.

When you test the client script function, you discover that the Label controls are not updated. You receive


 | English | Chinese | Japan | Korean |               - 144 -              Test Information Co., Ltd. All rights reserved.
the following JavaScript error message in the browser: "'null' is null or not an object."

You need to resolve the error.

What should you do?

A. Replace line 03 with the following line of code.

label.innerText = newText;

B. Replace line 02 with the following line of code.

var label = $get(labelId);

C. Replace line 02 with the following line of code.

var label = Sys.UI.DomElement.getElementById($get(labelId));

D. Replace line 02 with the following line of code.

var label = Sys.UI.DomElement.getElementById($find(labelId));

Answer: B



143. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web form by using ASP.NET AJAX.

You write the following client-script code fragment to handle the exceptions thrown from asynchronous

postbacks. (Line numbers are included for reference only.)

01 <script type="text/javascript">

02    function pageLoad()

03    {

04        var pageMgr =

05         Sys.WebForms.PageRequestManager.getInstance();

06

07    }

08

09    function errorHandler(sender, args)

10    {

11

12    }


 | English | Chinese | Japan | Korean |               - 145 -              Test Information Co., Ltd. All rights reserved.
13 </script>

You need to ensure that the application performs the following tasks:

¡¤Use a common clien-script function named errorHandler.

¡¤Update a Label control that has an ID named lblEror with the error message.

¡¤Prevent the browser from displaying any message box or Javascript error

What should you do?

A. Insert the following code segment at line 06.

pageMgr.add_endRequest(errorHandler);

Insert the following code segment at line 11.

if (args.get_error() != null) {

     $get('lblError').innerHTML = args.get_error().message;

     args.set_errorHandled(true);

}

B. Insert the following code segment at line 06.

pageMgr.add_endRequest(errorHandler);

Insert the following code segment at line 11.

if (args.get_error() != null) {

     $get('lblError').innerHTML = args.get_error().message;

}

C. Insert the following code segment at line 06.

pageMgr.add_pageLoaded(errorHandler);

Insert the following code segment at line 11.

if (args.get_error() != null) {

     $get('lblError').innerHTML = args.get_error().message;

     args.set_errorHandled(true);

}

D. Insert the following code segment at line 06.

pageMgr.add_pageLoaded(errorHandler);

Insert the following code segment at line 11.


    | English | Chinese | Japan | Korean |           - 146 -            Test Information Co., Ltd. All rights reserved.
if (args.get_error() != null) {

     $get('lblError').innerHTML = args.get_error().message;

}

Answer: A



144. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web form by using ASP.NET AJAX.

You write the following client-script code fragment to handle the exceptions thrown from asynchronous

postbacks. (Line numbers are included for reference only.)

01 <script type="text/javascript">

02       function pageLoad()

03       {

04           var pageMgr =

05            Sys.WebForms.PageRequestManager.getInstance();

06

07       }

08

09       function errorHandler(sender, args)

10       {

11

12       }

13 </script>

You need to ensure that the application performs the following tasks:

¡¤Use a common clien-script function named errorHandler.

¡¤Update a Label control tat has an ID named lblError with the error message.

¡¤Prevent the browser from displaying any message box or Javascript error

What should you do?

A. Insert the following code segment at line 06.

pageMgr.add_endRequest(errorHandler);


    | English | Chinese | Japan | Korean |           - 147 -            Test Information Co., Ltd. All rights reserved.
Insert the following code segment at line 11.

if (args.get_error() != null) {

     $get('lblError').innerHTML = args.get_error().message;

     args.set_errorHandled(true);

}

B. Insert the following code segment at line 06.

pageMgr.add_endRequest(errorHandler);

Insert the following code segment at line 11.

if (args.get_error() != null) {

     $get('lblError').innerHTML = args.get_error().message;

}

C. Insert the following code segment at line 06.

pageMgr.add_pageLoaded(errorHandler);

Insert the following code segment at line 11.

if (args.get_error() != null) {

     $get('lblError').innerHTML = args.get_error().message;

     args.set_errorHandled(true);

}

D. Insert the following code segment at line 06.

pageMgr.add_pageLoaded(errorHandler);

Insert the following code segment at line 11.

if (args.get_error() != null) {

     $get('lblError').innerHTML = args.get_error().message;

}

Answer: A



145. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web form by using ASP.NET AJAX.

The Web form contains the following code fragment. (Line numbers are included for reference only.)


    | English | Chinese | Japan | Korean |           - 148 -          Test Information Co., Ltd. All rights reserved.
01 <script type="text/javascript">

02

03    Sys.Application.add_init(initComponents);

04

05    function initComponents() {

06

07    }

08

09 </script>

10

11 <asp:ScriptManager ID="ScriptManager1"

12   runat="server" />

13 <asp:TextBox runat="server" ID="TextBox1" />

You need to create and initialize a client behavior named MyCustomBehavior by using the

initComponents function. You also need to ensure that MyCustomBehavior is attached to the TextBox1

Textbox control.

Which code segment should you insert at line 06?

A. $create(MyCustomBehavior, null, null, null, 'TextBox1');

B. $create(MyCustomBehavior, null, null, null, $get('TextBox1'));

C. Sys.Component.create(MyCustomBehavior, 'TextBox1', null, null, null);

D. Sys.Component.create(MyCustomBehavior, $get('TextBox1'), null, null, null);

Answer: B



146. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a Web form by using ASP.NET AJAX.

The Web form contains the following code fragment. (Line numbers are included for reference only.)

01 <script type="text/javascript">

02

03    Sys.Application.add_init(initComponents);


 | English | Chinese | Japan | Korean |             - 149 -           Test Information Co., Ltd. All rights reserved.
04

05    function initComponents() {

06

07    }

08

09 </script>

10

11 <asp:ScriptManager ID="ScriptManager1"

12   runat="server" />

13 <asp:TextBox runat="server" ID="TextBox1" />

You need to create and initialize a client behavior named MyCustomBehavior by using the

initComponents function. You also need to ensure that MyCustomBehavior is attached to the TextBox1

Textbox control.

Which code segment should you insert at line 06?

A. $create(MyCustomBehavior, null, null, null, 'TextBox1');

B. $create(MyCustomBehavior, null, null, null, $get('TextBox1'));

C. Sys.Component.create(MyCustomBehavior, 'TextBox1', null, null, null);

D. Sys.Component.create(MyCustomBehavior, $get('TextBox1'), null, null, null);

Answer: B



147. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a login Web form by using the following code fragment.

<asp:ScriptManager ID="ScriptManager1" runat="server" />

<asp:TextBox runat="server" ID="txtUser" Width="200px" />

<asp:TextBox runat="server" ID="txtPassword" Width="200px" />

<asp:Button runat="server" ID="btnLogin" Text="Login" OnClientClick="login(); return false;" />

When a user clicks the btnLogin Button control, the login() client-side script is called to authenticate the

user. The credentials provided in the TextBox controls are used to call the client-side script.

You also add the following client-script code fragment in the Web form. (Line numbers are included for


 | English | Chinese | Japan | Korean |              - 150 -              Test Information Co., Ltd. All rights reserved.
reference only.)

01 <script type="text/javascript">

02    function login() {

03         var username = $get('txtUser').value;

04         var password = $get('txtPassword').value;

05

06         // authentication logic.

07    }

08    function onLoginCompleted(validCredentials, userContext,

09        methodName)

10    {

11         // notify user on authentication result.

12    }

13

14    function onLoginFailed(error, userContext, methodName)

15    {

16         // notify user on authentication exception.

17    }

18 </script>

The ASP.NET application is configured to use Forms Authentication. The ASP.NET AJAX authentication

service is activated in the Web.config file.

You need to ensure that the following workflow is maintained:

¡¤On successful authentication, the onLoginCompleted clien-script function is called to notify the user.

¡¤On failure of authentication, the onLoginFailed clien-script function is called to display an error message.

Which code segment should you insert at line 06?

A.   var     auth   =   Sys.Services.AuthenticationService;auth.login(username,          password,         false,      null,

null,onLoginCompleted, onLoginFailed, null);

B. var auth = Sys.Services.AuthenticationService;auth.set_defaultFailedCallback(onLoginFailed);

var validCredentials = auth.login(username, password, false, null, null, null, null, null);


 | English | Chinese | Japan | Korean |                  - 151 -            Test Information Co., Ltd. All rights reserved.
if (validCredentials)

onLoginCompleted(true, null, null);

else

onLoginCompleted(false, null, null);

C. var auth = Sys.Services.AuthenticationService;

auth.set_defaultLoginCompletedCallback(onLoginCompleted);

try {

     auth.login(username, password, false, null, null,

      null, null, null);

}

catch (err) {

     onLoginFailed(err, null, null);

}

D. var auth = Sys.Services.AuthenticationService;

try {

     var validCredentials = auth.login(username, password, false, null, null, null, null, null);

     if (validCredentials)

     onLoginCompleted(true, null, null);

     else

     onLoginCompleted(false, null, null);

}

catch (err) {

     onLoginFailed(err, null, null);

}

Answer: A



148. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a login Web form by using the following code fragment.

<asp:ScriptManager ID="ScriptManager1" runat="server" />


    | English | Chinese | Japan | Korean |               - 152 -              Test Information Co., Ltd. All rights reserved.
<asp:TextBox runat="server" ID="txtUser" Width="200px" />

<asp:TextBox runat="server" ID="txtPassword" Width="200px" />

<asp:Button runat="server" ID="btnLogin" Text="Login" OnClientClick="login(); return false;" />

When a user clicks the btnLogin Button control, the login() client-side script is called to authenticate the

user. The credentials provided in the TextBox controls are used to call the client-side script.

You also add the following client-script code fragment in the Web form. (Line numbers are included for

reference only.)

01 <script type="text/javascript">

02    function login() {

03        var username = $get('txtUser').value;

04        var password = $get('txtPassword').value;

05

06        // authentication logic.

07    }

08    function onLoginCompleted(validCredentials, userContext,

09        methodName)

10    {

11        // notify user on authentication result.

12    }

13

14    function onLoginFailed(error, userContext, methodName)

15    {

16        // notify user on authentication exception.

17    }

18 </script>

The ASP.NET application is configured to use Forms Authentication. The ASP.NET AJAX authentication

service is activated in the Web.config file.

You need to ensure that the following workflow is maintained:

¡¤On successfu authentication, the onLoginCompleted client-script function is called to notify the user.


 | English | Chinese | Japan | Korean |                 - 153 -           Test Information Co., Ltd. All rights reserved.
¡¤On failure of authentication, the onLoginFailed clien-script function is called to display an error message.

Which code segment should you insert at line 06?

A.      var   auth    =    Sys.Services.AuthenticationService;auth.login(username,       password,         false,      null,

null,onLoginCompleted, onLoginFailed, null);

B. var auth = Sys.Services.AuthenticationService;auth.set_defaultFailedCallback(onLoginFailed);

var validCredentials = auth.login(username, password, false, null, null, null, null, null);

if (validCredentials)

onLoginCompleted(true, null, null);

else

onLoginCompleted(false, null, null);

C. var auth = Sys.Services.AuthenticationService;

auth.set_defaultLoginCompletedCallback(onLoginCompleted);

try {

     auth.login(username, password, false, null, null,

      null, null, null);

}

catch (err) {

     onLoginFailed(err, null, null);

}

D. var auth = Sys.Services.AuthenticationService;

try {

     var validCredentials = auth.login(username,

      password, false, null, null, null, null, null);

     if (validCredentials)

     onLoginCompleted(true, null, null);

     else

     onLoginCompleted(false, null, null);

}

catch (err) {


    | English | Chinese | Japan | Korean |               - 154 -            Test Information Co., Ltd. All rights reserved.
onLoginFailed(err, null, null);

}

Answer: A



149. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5.

The application contains the following device filter element in the Web.config file.

<filter name="isHtml" compare="PreferredRenderingType"argument="html32" />

The application contains a Web page that has the following image control. (Line numbers are included for

reference only.)

01 <mobile:Image ID="imgCtrl" Runat="server">

02

03 </mobile:Image>

You need to ensure that the following conditions are met:

¡¤The imgCtrl Image control displays he highRes.jpg file if the Web browser supports html.

¡¤The imgCtrl Image control displays lowRes.gif if the Web browser does not support html

Which DeviceSpecific element should you insert at line 02?

A. <DeviceSpecific>

     <Choice Filter="isHtml" ImageUrl="highRes.jpg" />

     <Choice ImageUrl="lowRes.gif" />

</DeviceSpecific>

B. <DeviceSpecific>

     <Choice Filter="isHtml" Argument="false" ImageUrl="highRes.jpg" />

     <Choice Filter="isHtml" Argument="true"

      ImageUrl="lowRes.gif" />

</DeviceSpecific>

C. <DeviceSpecific>

     <Choice Filter="PreferredRenderingType" ImageUrl="highRes.jpg" />

     <Choice ImageUrl="lowRes.gif" />

</DeviceSpecific>


    | English | Chinese | Japan | Korean |           - 155 -              Test Information Co., Ltd. All rights reserved.
D. <DeviceSpecific>

  <Choice Filter="PreferredRenderingType" Argument="false"

     ImageUrl="highRes.jpg" />

  <Choice Filter="PreferredRenderingType" Argument="true"

     ImageUrl="lowRes.gif" />

</DeviceSpecific>

Answer: A



150. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5.

The application contains the following device filter element in the Web.config file.

<filter name="isHtml" compare="PreferredRenderingType"argument="html32" />

The application contains a Web page that has the following image control. (Line numbers are included for

reference only.)

01 <mobile:Image ID="imgCtrl" Runat="server">

02

03 </mobile:Image>

You need to ensure that the following conditions are met:

¡¤The imgCtrl Image control displays the highRes.jpg file if the Web browser supports html

¡¤The imgCtrl Image control displays lowRes.gif if the Web broser does not support html.

Which DeviceSpecific element should you insert at line 02?

A. <DeviceSpecific>

  <Choice Filter="isHtml" ImageUrl="highRes.jpg" />

  <Choice ImageUrl="lowRes.gif" />

</DeviceSpecific>

B. <DeviceSpecific>

  <Choice Filter="isHtml" Argument="false" ImageUrl="highRes.jpg" />

  <Choice Filter="isHtml" Argument="true"

     ImageUrl="lowRes.gif" />

</DeviceSpecific>


 | English | Chinese | Japan | Korean |              - 156 -              Test Information Co., Ltd. All rights reserved.
C. <DeviceSpecific>

  <Choice Filter="PreferredRenderingType" ImageUrl="highRes.jpg" />

  <Choice ImageUrl="lowRes.gif" />

</DeviceSpecific>

D. <DeviceSpecific>

  <Choice Filter="PreferredRenderingType" Argument="false"

   ImageUrl="highRes.jpg" />

  <Choice Filter="PreferredRenderingType" Argument="true"

   ImageUrl="lowRes.gif" />

</DeviceSpecific>

Answer: A



151. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The

application contains a mobile Web page.

You add the following StyleSheet control to the Web page.

<mobile:StyleSheet id="MyStyleSheet" runat="server">

  <mobile:Style Name="StyleA" Font-Name="Arial" Font-Bold="True"

   Wrapping="NoWrap">

  </mobile:Style>

</mobile:StyleSheet>

You need to add a Label control named MyLabel that uses the defined style in the MyStyleSheet

StyleSheet control.

Which markup should you use?

A. <mobile:Label ID="MyLabel" Runat="server"StyleReference="MyStyleSheet:StyleA">

</mobile:Label>

B. <mobile:Label ID="MyLabel" Runat="server" StyleReference="StyleA">

</mobile:Label>

C. <mobile:Label ID="MyLabel" Runat="server">

  <DeviceSpecific ID="DSpec" Runat="server">


| English | Chinese | Japan | Korean |            - 157 -             Test Information Co., Ltd. All rights reserved.
<Choice Filter="MyStyleSheet" StyleReference="StyleA" />

  </DeviceSpecific>

</mobile:Label>

D. <mobile:Label ID="MyLabel" Runat="server">

  <DeviceSpecific ID="DSpec" Runat="server">

    <Choice Argument="StyleA" StyleReference="MyStyleSheet" />

  </DeviceSpecific>

</mobile:Label>

Answer: A



152. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The

application contains a mobile Web page.

You add the following StyleSheet control to the Web page.

<mobile:StyleSheet id="MyStyleSheet" runat="server">

  <mobile:Style Name="StyleA" Font-Name="Arial" Font-Bold="True"

   Wrapping="NoWrap">

  </mobile:Style>

</mobile:StyleSheet>

You need to add a Label control named MyLabel that uses the defined style in the MyStyleSheet

StyleSheet control.

Which markup should you use?

A. <mobile:Label ID="MyLabel" Runat="server"StyleReference="MyStyleSheet:StyleA">

</mobile:Label>

B. <mobile:Label ID="MyLabel" Runat="server" StyleReference="StyleA">

</mobile:Label>

C. <mobile:Label ID="MyLabel" Runat="server">

  <DeviceSpecific ID="DSpec" Runat="server">

    <Choice Filter="MyStyleSheet" StyleReference="StyleA" />

  </DeviceSpecific>


| English | Chinese | Japan | Korean |            - 158 -            Test Information Co., Ltd. All rights reserved.
</mobile:Label>

D. <mobile:Label ID="MyLabel" Runat="server">

  <DeviceSpecific ID="DSpec" Runat="server">

     <Choice Argument="StyleA" StyleReference="MyStyleSheet" />

  </DeviceSpecific>

</mobile:Label>

Answer: A



153. You modify an existing Microsoft ASP.NET application by using the Microsoft .NET Framework

version 3.5.

You add a theme to the ASP.NET application.

You need to apply the theme to override any settings of individual controls.

What should you do?

A. In the Web.config file of the application, set the Theme attribute of the pages element to the name of

the theme.

B. In the Web.config file of the application, set the StyleSheetTheme attribute of the pages element to the

name of the theme.

C. Add a master page to the application. In the @Master directive, set the Theme attribute to the name of

the theme.

D. Add a master page to the application. In the @Master directive, set the StyleSheetTheme attribute to

the name of the theme.

Answer: A



154. You modify an existing Microsoft ASP.NET application by using the Microsoft .NET Framework

version 3.5.

You add a theme to the ASP.NET application.

You need to apply the theme to override any settings of individual controls.

What should you do?

A. In the Web.config file of the application, set the Theme attribute of the pages element to the name of


 | English | Chinese | Japan | Korean |             - 159 -             Test Information Co., Ltd. All rights reserved.
the theme.

B. In the Web.config file of the application, set the StyleSheetTheme attribute of the pages element to the

name of the theme.

C. Add a master page to the application. In the @Master directive, set the Theme attribute to the name of

the theme.

D. Add a master page to the application. In the @Master directive, set the StyleSheetTheme attribute to

the name of the theme.

Answer: A



155. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

The application uses 10 themes and allows the users to select their themes for the Web page.

When a user returns to the application, the theme selected by the user is used to display pages in the

application. This occurs even if the user returns to log on at a later date or from a different client computer.

The application runs on different storage types and in different environments.

You need to store the themes that are selected by the users and retrieve the required theme.

What should you do?

A. ¡¤Use the Application object to store the name of the theme tha is selected by the user.

B. ¡¤Retrieve the required theme name from the Application object each time the user visits a page

C. ¡¤Use the Session object to store the name of the theme that is selected by the user.

D. ¡¤Retrieve the required theme name fro the Session object each time the user visits a page.

E. ¡¤Use the Response.Cookies collection to store the name of the theme that is selected by the user.

F. ¡¤ U t he Reques Cook es co ec on t oi den y t he t he m t ha was se ec ed by t he use each ti m the
       se          t.  i     ll ti           tif           e t        l t                r

user visits a page.

G. ¡¤Add a setting for the theme to the profile section of the Web.config file of the application.

H. ¡¤Use the Profile.Theme string theme to store the name of the theme that is selected by the user.

I. ¡¤Retrieve the required them name each time the user visits a page.

Answer: D



156. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.


 | English | Chinese | Japan | Korean |               - 160 -               Test Information Co., Ltd. All rights reserved.
The application uses 10 themes and allows the users to select their themes for the Web page.

When a user returns to the application, the theme selected by the user is used to display pages in the

application. This occurs even if the user returns to log on at a later date or from a different client computer.

The application runs on different storage types and in different environments.

You need to store the themes that are selected by the users and retrieve the required theme.

What should you do?

A. ¡¤Use the Application object to store the name of the theme that is selected by the user.

B. ¡¤Retrieve the reqired theme name from the Application object each time the user visits a page.

C. ¡¤Use the Session object to store the name of the theme that is selected by the user.

D. ¡¤Retrieve the required theme name from the Session object each time the user visits apage.

E. ¡¤Use the Response.Cookies collection to store the name of the theme that is selected by the user.

F. ¡¤ U t he Reques Cook es co ec on t oi den y t he t he m t ha was se ec ed by t he use each ti m t he
       se          t.  i     ll ti           tif           e t        l t                r         e

user visits a page.

G. ¡¤Add a setting for he theme to the profile section of the Web.config file of the application.

H. ¡¤Use the Profile.Theme string theme to store the name of the theme that is selected by the user.

I. ¡¤Retrieve the required theme name each time the user visits a page

Answer: D



157. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

The application must redirect the original URL to a different ASPX page.

You need to ensure that the users cannot view the original URL after the page is executed. You also need

to ensure that each page execution requires only one request from the client browser.

What should you do?

A. Use the Server.Transfer method to transfer execution to the correct ASPX page.

B. Use the Response.Redirect method to transfer execution to the correct ASPX page.

C. Use the HttpContext.Current.RewritePath method to transfer execution to the correct ASPX page.

D. Add the Location: new URL value to the Response.Headers collection. Call the Response.End()

statement. Send the header to the client computer to transfer execution to the correct ASPX page.

Answer: C


 | English | Chinese | Japan | Korean |               - 161 -               Test Information Co., Ltd. All rights reserved.
158. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

The application must redirect the original URL to a different ASPX page.

You need to ensure that the users cannot view the original URL after the page is executed. You also need

to ensure that each page execution requires only one request from the client browser.

What should you do?

A. Use the Server.Transfer method to transfer execution to the correct ASPX page.

B. Use the Response.Redirect method to transfer execution to the correct ASPX page.

C. Use the HttpContext.Current.RewritePath method to transfer execution to the correct ASPX page.

D. Add the Location: new URL value to the Response.Headers collection. Call the Response.End()

statement. Send the header to the client computer to transfer execution to the correct ASPX page.

Answer: C



159. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

The application uses Session objects. You are modifying the application to run on a Web farm.

You need to ensure that the application can access the Session objects from all the servers in the Web

farm. You also need to ensure that when any server in the Web farm restarts or stops responding, the

Session objects are not lost.

What should you do?

A. Use the InProc Session Management mode to store session data in the ASP.NET worker process.

B. Use the SQLServer Session Management mode to store session data in a common Microsoft SQL

Server 2005 database.

C. Use the SQLServer Session Management mode to store session data in an individual database for

each Web server in the Web farm.

D. Use the StateServer Session Management mode to store session data in a common State Server

process on a Web server in the Web farm.

Answer: B



160. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.


 | English | Chinese | Japan | Korean |            - 162 -             Test Information Co., Ltd. All rights reserved.
The application uses Session objects. You are modifying the application to run on a Web farm.

You need to ensure that the application can access the Session objects from all the servers in the Web

farm. You also need to ensure that when any server in the Web farm restarts or stops responding, the

Session objects are not lost.

What should you do?

A. Use the InProc Session Management mode to store session data in the ASP.NET worker process.

B. Use the SQLServer Session Management mode to store session data in a common Microsoft SQL

Server 2005 database.

C. Use the SQLServer Session Management mode to store session data in an individual database for

each Web server in the Web farm.

D. Use the StateServer Session Management mode to store session data in a common State Server

process on a Web server in the Web farm.

Answer: B



161. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version

3.5.

The Web site uses C# as the programming language. You plan to add a code file written in Microsoft

VB.NET to the application. This code segment will not be converted to C#.

You add the following code fragment to the Web.config file of the application.

<compilation debug="false">

  <codeSubDirectories>

       <add directoryName="VBCode"/>

  </codeSubDirectories>

</compilation>

You need to ensure that the following requirements are met:

¡¤The existing VB.NET file can be used in the Web application

¡¤The file can be modified and compiled at run time

What should you do?

A. ¡¤Create a new folder named VBCode at the root of the application


 | English | Chinese | Japan | Korean |               - 163 -           Test Information Co., Ltd. All rights reserved.
¡¤Place the VB.NET code file n this new folder.

B. ¡¤Create a new folder named VBCode inside the App_Code folder of the application

   ¡¤Place the VB.NET code file in this new folder

C. ¡¤Create a new class library that uses VB.NET as the programming language

   ¡¤Add the VB.NET code ile to the class library.

   ¡¤Add a reference to the class library in the application

D. ¡¤ C ea e a ne w Mcr oso
      r t           i     ft        Wndo w Co mm i ca on Founda on ( W ) se v ce p o ec t ha uses
                                    i     s     un ti          ti     CF   ri     r j t     t

VB.NET as the programming language.

   ¡¤Expose the VB.NET code functionalitythrough the WCF service.

   ¡¤Add a service reference to the WCF service project in the application

Answer: B



162. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version

3.5.

The Web site uses C# as the programming language. You plan to add a code file written in Microsoft

VB.NET to the application. This code segment will not be converted to C#.

You add the following code fragment to the Web.config file of the application.

<compilation debug="false">

  <codeSubDirectories>

       <add directoryName="VBCode"/>

  </codeSubDirectories>

</compilation>

You need to ensure that the following requirements are met:

¡¤The existing VB.NET file can be used in the Web application

¡¤The file can be modified and compiled at run time

What should you do?

A. ¡¤Create a new folder named VBCode at the root of the application

   ¡¤Place the VB.NET code file in this new folder

B. ¡¤Create a new folder named VBCode inside the App_Code folder of the application


 | English | Chinese | Japan | Korean |               - 164 -           Test Information Co., Ltd. All rights reserved.
¡¤Place the VB.NET code file in his new folder.

C. ¡¤Create a new class library that uses VB.NET as the programming language

   ¡¤Add the VB.NET code file to the class library

   ¡¤Add a reference to the class library in the application

D. ¡¤ C ea e a ne w Mcr oso
      r t           i     ft        Wndo w Co mm i ca on Fundation (WCF) service project that uses
                                    i     s     un ti

VB.NET as the programming language.

   ¡¤Expose the VB.NET code functionality through the WCF service

   ¡¤Add a service reference to the WCF service project in the application

Answer: B



163. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

The application uses a set of general-purpose utility classes that implement business logic. These classes

are modified frequently.

You need to ensure that the application is recompiled automatically when a utility class is modified.

What should you do?

A. ¡¤Create the Web application by using a Microsoft Visual Studio ASP.NET Web site

   ¡¤Add the utility classes to the App_Code subfolder of the Web application

B. ¡¤Create the Web aplication by using a Microsoft Visual Studio ASP.NET Web Application project.

   ¡¤Add the utility classes to the App_Code subfolder of the Web application

C. ¡¤Create the Web application by using a Microsoft Visual Studio ASP.NET Web site

   ¡¤Add the utilty classes to the root folder of the Web application.

D. ¡¤Create the Web application by using a Microsoft Visual Studio ASP.NET Web Application project

   ¡¤Add the utility classes to the root folder of the Web application

Answer: A

164. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

The application uses a set of general-purpose utility classes that implement business logic. These classes

are modified frequently.

You need to ensure that the application is recompiled automatically when a utility class is modified.

What should you do?


 | English | Chinese | Japan | Korean |              - 165 -             Test Information Co., Ltd. All rights reserved.
A. ¡¤Create the Web application by using a Microsoft Visual Studio ASP.NET Web site

   ¡¤Add the utility classes to the App_Code subfolder of the Web application

B. ¡¤Create the Wb application by using a Microsoft Visual Studio ASP.NET Web Application project.

   ¡¤Add the utility classes to the App_Code subfolder of the Web application

C. ¡¤Create the Web application by using a Microsoft Visual Studio ASP.NET Web site

   ¡¤Add theutility classes to the root folder of the Web application.

D. ¡¤Create the Web application by using a Microsoft Visual Studio ASP.NET Web Application project

   ¡¤Add the utility classes to the root folder of the Web application

Answer: A



165. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You add a Web page named HomePage.aspx in the application. The Web page contains different controls.

You add a newly created custom control named CachedControl to the Web page.

You need to ensure that the following requirements are met:

¡¤The custom control state remains static for one minute

¡¤The custom control settings do not affect the cache settings of other elements in the Web page

What should you do?

A. Add the following code fragment to the Web.config file of the solution.

<caching>

  <outputCacheSettings>

     <outputCacheProfiles>

       <add

        name="CachedProfileSet"

        varyByControl="CachedControl"

        duration="60" />

     </outputCacheProfiles>

  </outputCacheSettings>

</caching>

B. Add the following code fragment to the Web.config file of the solution.


 | English | Chinese | Japan | Korean |              - 166 -             Test Information Co., Ltd. All rights reserved.
<caching>

  <outputCacheSettings>

     <outputCacheProfiles>

       <add

        name="CachedProfileSet"

        varyByParam="CachedControl"

        duration="60" />

     </outputCacheProfiles>

  </outputCacheSettings>

</caching>

C. Add a class named ProfileCache that inherits from the ConfigurationSection class to the

HomePage.aspx.cs page.

Add the following to the Web.config file of the solution.

<ProfileCache profile="CachedProfileSet" varyByControl="CachedControl" duration="60">

</ProfileCache>

<caching>

  <outputCache enableOutputCache="true"/>

</caching>

D. Add a class named ProfileCache that inherits from the ConfigurationSection class to the

HomePage.aspx.cs page.

Add the following code fragment to the Web.config file of the solution.

<ProfileCache profile="CachedProfileSet" varyByParam="CachedControl" duration="60">

</ProfileCache>

<caching>

  <outputCache enableOutputCache="true"/>

</caching>

Answer: A



166. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.


 | English | Chinese | Japan | Korean |              - 167 -              Test Information Co., Ltd. All rights reserved.
You add a Web page named HomePage.aspx in the application. The Web page contains different controls.

You add a newly created custom control named CachedControl to the Web page.

You need to ensure that the following requirements are met:

¡¤The custom control state remains static for one minute

¡¤The custom control settings do not affect the cache settings of other elements in the Web page

What should you do?

A. Add the following code fragment to the Web.config file of the solution.

<caching>

  <outputCacheSettings>

     <outputCacheProfiles>

       <add

        name="CachedProfileSet"

        varyByControl="CachedControl"

        duration="60" />

     </outputCacheProfiles>

  </outputCacheSettings>

</caching>

B. Add the following code fragment to the Web.config file of the solution.

<caching>

  <outputCacheSettings>

     <outputCacheProfiles>

       <add

        name="CachedProfileSet"

        varyByParam="CachedControl"

        duration="60" />

     </outputCacheProfiles>

  </outputCacheSettings>

</caching>

C. Add a class named ProfileCache that inherits from the ConfigurationSection class to the


 | English | Chinese | Japan | Korean |             - 168 -              Test Information Co., Ltd. All rights reserved.
HomePage.aspx.cs page.

Add the following to the Web.config file of the solution.

<ProfileCache profile="CachedProfileSet" varyByControl="CachedControl" duration="60">

</ProfileCache>

<caching>

  <outputCache enableOutputCache="true"/>

</caching>

D. Add a class named ProfileCache that inherits from the ConfigurationSection class to the

HomePage.aspx.cs page.

Add the following code fragment to the Web.config file of the solution.

<ProfileCache profile="CachedProfileSet" varyByParam="CachedControl" duration="60">

</ProfileCache>

<caching>

  <outputCache enableOutputCache="true"/>

</caching>

Answer: A




 | English | Chinese | Japan | Korean |              - 169 -              Test Information Co., Ltd. All rights reserved.

70 562

  • 1.
    1. You createa Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web page that contains the following two XML fragments. (Line numbers are included for reference only.) 01 <script runat="server"> 02 03 </script> 04 <asp:ListView ID="ListView1" runat="server" 05 DataSourceID="SqlDataSource1" 06 07 > 08 <ItemTemplate> 09 <td> 10 <asp:Label ID="LineTotalLabel" runat="server" 11 Text='<%# Eval("LineTotal") %>' /> 12 </td> 13 </ItemTemplate> The SqlDataSource1 object retrieves the data from a Microsoft SQL Server 2005 database table. The database table has a column named LineTotal. You need to ensure that when the size of the LineTotal column value is greater than seven characters, the column is displayed in red color. What should you do? A. Insert the following code segment at line 06. OnItemDataBound="FmtClr" Insert the following code segment at line 02. protected void FmtClr (object sender, ListViewItemEventArgs e) { Label LineTotal = (Label) e.Item.FindControl("LineTotalLabel"); | English | Chinese | Japan | Korean | -2- Test Information Co., Ltd. All rights reserved.
  • 2.
    if ( LineTotal.Text.Length> 7) { LineTotal.ForeColor = Color.Red; } else {LineTotal.ForeColor = Color.Black; } } B. Insert the following code segment at line 06. OnItemDataBound="FmtClr" Insert the following code segment at line 02. protected void FmtClr (object sender, ListViewItemEventArgs e) { Label LineTotal = (Label) e.Item.FindControl("LineTotal"); if ( LineTotal.Text.Length > 7) {LineTotal.ForeColor = Color.Red; } else {LineTotal.ForeColor = Color.Black; } } C. Insert the following code segment at line 06. OnDataBinding="FmtClr" Insert the following code segment at line 02. protected void FmtClr(object sender, EventArgs e) { Label LineTotal = new Label(); LineTotal.ID = "LineTotal"; if ( LineTotal.Text.Length > 7) {LineTotal.ForeColor = Color.Red; } else { LineTotal.ForeColor = Color.Black; } | English | Chinese | Japan | Korean | -3- Test Information Co., Ltd. All rights reserved.
  • 3.
    } D. Insert thefollowing code segment at line 06. OnDataBound="FmtClr" Insert the following code segment at line 02. protected void FmtClr(object sender, EventArgs e) { Label LineTotal = new Label(); LineTotal.ID = "LineTotalLabel"; if ( LineTotal.Text.Length > 7) {LineTotal.ForeColor = Color.Red; } else {LineTotal.ForeColor = Color.Black; } } Answer: A 2. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web page that contains the following two XML fragments. (Line numbers are included for reference only.) 01 <script runat="server"> 02 03 </script> 04 <asp:ListView ID="ListView1" runat="server" 05 DataSourceID="SqlDataSource1" 06 07 > 08 <ItemTemplate> 09 <td> 10 <asp:Label ID="LineTotalLabel" runat="server" 11 Text='<%# Eval("LineTotal") %>' /> | English | Chinese | Japan | Korean | -4- Test Information Co., Ltd. All rights reserved.
  • 4.
    12 </td> 13 </ItemTemplate> The SqlDataSource1 object retrieves the data from a Microsoft SQL Server 2005 database table. The database table has a column named LineTotal. You need to ensure that when the size of the LineTotal column value is greater than seven characters, the column is displayed in red color. What should you do? A. Insert the following code segment at line 06. OnItemDataBound="FmtClr" Insert the following code segment at line 02. Protected Sub FmtClr(ByVal sender As Object, _ByVal e As ListViewItemEventArgs) Dim LineTotal As Label = _ DirectCast(e.Item.FindControl("LineTotalLabel"), Label) If LineTotal IsNot Nothing Then If LineTotal.Text.Length > 7 Then LineTotal.ForeColor = Color.Red Else LineTotal.ForeColor = Color.Black End If End If End Sub B. Insert the following code segment at line 06. OnItemDataBound="FmtClr" Insert the following code segment at line 02. Protected Sub FmtClr(ByVal sender As Object, _ByVal e As ListViewItemEventArgs) Dim LineTotal As Label = _ DirectCast(e.Item.FindControl("LineTotal"), Label) If LineTotal.Text.Length > 7 Then LineTotal.ForeColor = Color.Red | English | Chinese | Japan | Korean | -5- Test Information Co., Ltd. All rights reserved.
  • 5.
    Else LineTotal.ForeColor = Color.Black End If End Sub C. Insert the following code segment at line 06. OnDataBinding="FmtClr" Insert the following code segment at line 02. Protected Sub FmtClr(ByVal sender As Object, _ByVal e As EventArgs) Dim LineTotal As New Label() LineTotal.ID = "LineTotal" If LineTotal.Text.Length > 7 Then LineTotal.ForeColor = Color.Red Else LineTotal.ForeColor = Color.Black End If End Sub D. Insert the following code segment at line 06. OnDataBound="FmtClr" Insert the following code segment at line 02. Protected Sub FmtClr(ByVal sender As Object, _ByVal e As EventArgs) Dim LineTotal As New Label() LineTotal.ID = "LineTotalLabel" If LineTotal.Text.Length > 7 Then LineTotal.ForeColor = Color.Red Else LineTotal.ForeColor = Color.Black End If End Sub Answer: A | English | Chinese | Japan | Korean | -6- Test Information Co., Ltd. All rights reserved.
  • 6.
    3. You createa Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web form and add the following code fragment. <asp:Repeater ID="rptData" runat="server" DataSourceID="SqlDataSource1"ItemDataBound="rptData_ItemDataBound"> <ItemTemplate> <asp:Label ID="lblQuantity" runat="server" Text='<%# Eval("QuantityOnHand") %>' /> </ItemTemplate> </asp:Repeater> The SqlDataSource1 DataSource control retrieves the Quantity column values from a table named Products. You write the following code segment to create the rptData_ItemDataBound event handler. (Line numbers are included for reference only.) 01 protected void rptData_ItemDataBound(object sender, 02 RepeaterItemEventArgs e) 03 { 04 05 if(lbl != null) 06 if(int.Parse(lbl.Text) < 10) 07 lbl.ForeColor = Color.Red; 08 } You need to retrieve a reference to the lblQuantity Label control into a variable named lbl. Which code segment should you insert at line 04? A. Label lbl = Page.FindControl("lblQuantity") as Label; B. Label lbl = e.Item.FindControl("lblQuantity") as Label; C. Label lbl = rptData.FindControl("lblQuantity") as Label; D. Label lbl = e.Item.Parent.FindControl("lblQuantity") as Label; Answer: B | English | Chinese | Japan | Korean | -7- Test Information Co., Ltd. All rights reserved.
  • 7.
    4.You create aMicrosoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web form and add the following code fragment. <asp:Repeater ID="rptData" runat="server" DataSourceID="SqlDataSource1" ItemDataBound="rptData_ItemDataBound"> <ItemTemplate> <asp:Label ID="lblQuantity" runat="server" Text='<%# Eval("QuantityOnHand") %>' /> </ItemTemplate> </asp:Repeater> The SqlDataSource1 DataSource control retrieves the Quantity column values from a table named Products. You write the following code segment to create the rptData_ItemDataBound event handler. (Line numbers are included for reference only.) 01 Protected Sub rptData_ItemDataBound(ByVal sender As Object, _ 02 ByVal e As RepeaterItemEventArgs) 03 04 If lbl IsNot Nothing Then 05 If Integer.Parse(lbl.Text) < 10 Then 06 lbl.ForeColor = Color.Red 07 End If 08 End If 09 End Sub You need to retrieve a reference to the lblQuantity Label control into a variable named lbl. Which code segment should you insert at line 03? A. Dim lbl As Label = _ TryCast(Page.FindControl("lblQuantity"), Label) B. Dim lbl As Label = _ | English | Chinese | Japan | Korean | -8- Test Information Co., Ltd. All rights reserved.
  • 8.
    TryCast(e.Item.FindControl("lblQuantity"), Label) C. Dimlbl As Label = _ TryCast(rptData.FindControl("lblQuantity"), Label) D. Dim lbl As Label = _ TryCast(e.Item.Parent.FindControl("lblQuantity"), Label) Answer: B 5. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. Your application has a user control named UserCtrl.ascx. You write the following code fragment to create a Web page named Default.aspx. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <html> ... <body> <form id="form1" runat="server"> <div> <asp:Label ID="lblHeader" runat="server"></asp:Label> <asp:Label ID="lbFooter" runat="server"></asp:Label> </div> </form> </body> </html> You need to dynamically add the UserCtrl.ascx control between the lblHeader and lblFooter Label controls. What should you do? A. Write the following code segment in the Init event of the Default.aspx Web page. Control ctrl = LoadControl("UserCtrl.ascx"); this.Controls.AddAt(1, ctrl); | English | Chinese | Japan | Korean | -9- Test Information Co., Ltd. All rights reserved.
  • 9.
    B. Write thefollowing code segment in the Init event of the Default.aspx Web page. Control ctrl = LoadControl("UserCtrl.ascx"); lblHeader.Controls.Add(ctrl); C. Add a Literal control named Ltrl between the lblHeader and lblFooter label controls. Write the following code segment in the Init event of the Default.aspx Web page. Control ctrl = LoadControl("UserCtrl.ascx"); D. Add a PlaceHolder control named PlHldr between the lblHeader and lblFooter label controls. Write the following code segment in the Init event of the Default.aspx Web page. Control ctrl = LoadControl("UserCtrl.ascx"); PlHldr.Controls.Add(ctrl); Answer: D 6. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. Your application has a user control named UserCtrl.ascx. You write the following code fragment to create a Web page named Default.aspx. <%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %> <html> ... <body> <form id="form1" runat="server"> <div> <asp:Label ID="lblHeader" runat="server"></asp:Label> <asp:Label ID="lbFooter" runat="server"></asp:Label> </div> </form> </body> </html> You need to dynamically add the UserCtrl.ascx control between the lblHeader and lblFooter Label | English | Chinese | Japan | Korean | - 10 - Test Information Co., Ltd. All rights reserved.
  • 10.
    controls. What should youdo? A. Write the following code segment in the Init event of the Default.aspx Web page. Dim ctrl As Control = LoadControl("UserCtrl.ascx") Me.Controls.AddAt(1, ctrl) B. Write the following code segment in the Init event of the Default.aspx Web page. Dim ctrl As Control = LoadControl("UserCtrl.ascx") lblHeader.Controls.Add(ctrl) C. Add a Literal control named Ltrl between the lblHeader and lblFooter label controls. Write the following code segment in the Init event of the Default.aspx Web page. Dim ctrl As Control = LoadControl("UserCtrl.ascx") D. Add a PlaceHolder control named PlHldr between the lblHeader and lblFooter label controls. Write the following code segment in the Init event of the Default.aspx Web page. Dim ctrl As Control = LoadControl("UserCtrl.ascx") PlHldr.Controls.Add(ctrl) Answer: D 7. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create two user controls named UserCtrlA.ascx and UserCtrlB.ascx. The user controls postback to the server. You create a new Web page that has the following ASPX code. <asp:CheckBox ID="Chk" runat="server" oncheckedchanged="Chk_CheckedChanged" AutoPostBack="true" /> <asp:PlaceHolder ID="PlHolder" runat="server"></asp:PlaceHolder> To dynamically create the user controls, you write the following code segment for the Web page. public void LoadControls() { if (ViewState["CtrlA"] != null) { | English | Chinese | Japan | Korean | - 11 - Test Information Co., Ltd. All rights reserved.
  • 11.
    Control c; if ((bool)ViewState["CtrlA"] == true) { c = LoadControl("UserCtrlA.ascx"); } else { c = LoadControl("UserCtrlB.ascx"); } c.ID = "Ctrl"; PlHolder.Controls.Add(c); } } protected void Chk_CheckedChanged(object sender, EventArgs e) { ViewState["CtrlA"] = Chk.Checked; PlHolder.Controls.Clear(); LoadControls(); } You need to ensure that the user control that is displayed meets the following requirements: ¡¤It is recreated during postback ¡¤It retains its state. Which method should you add to the Web page? A. protected override object SaveViewState() { LoadControls(); return base.SaveViewState(); } B. protected override void Render(HtmlTextWriter writer) { LoadControls(); base.Render(writer); } | English | Chinese | Japan | Korean | - 12 - Test Information Co., Ltd. All rights reserved.
  • 12.
    C. protected overridevoid OnLoadComplete(EventArgs e) { base.OnLoadComplete(e); LoadControls(); } D. protected override void LoadViewState(object savedState) { base.LoadViewState(savedState); LoadControls(); } Answer: D 8. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create two user controls named UserCtrlA.ascx and UserCtrlB.ascx. The user controls postback to the server. You create a new Web page that has the following ASPX code. <asp:CheckBox ID="Chk" runat="server" oncheckedchanged="Chk_CheckedChanged" AutoPostBack="true" /> <asp:PlaceHolder ID="PlHolder" runat="server"></asp:PlaceHolder> To dynamically create the user controls, you write the following code segment for the Web page. Public Sub LoadControls() If ViewState("CtrlA") IsNot Nothing Then Dim c As Control If CBool(ViewState("CtrlA")) = True Then c = LoadControl("UserCtrlA.ascx") Else c = LoadControl("UserCtrlB.ascx") End If c.ID = "Ctrl" | English | Chinese | Japan | Korean | - 13 - Test Information Co., Ltd. All rights reserved.
  • 13.
    PlHolder.Controls.Add(c) EndIf End Sub Protected Sub Chk_CheckedChanged(ByVal sender As Object, _ ByVal e As EventArgs) ViewState("CtrlA") = Chk.Checked PlHolder.Controls.Clear() LoadControls() End Sub You need to ensure that the user control that is displayed meets the following requirements: ¡¤It is recreated during postback ¡¤It retains its state. Which method should you add to the Web page? A. Protected Overloads Overrides Function _ SaveViewState() As Object LoadControls() Return MyBase.SaveViewState() End Function B. Protected Overloads Overrides _ Sub Render(ByVal writer As HtmlTextWriter) LoadControls() MyBase.Render(writer) End Sub C. Protected Overloads Overrides Sub _ OnLoadComplete(ByVal e As EventArgs) MyBase.OnLoadComplete(e) LoadControls() End Sub D. Protected Overloads Overrides Sub _ | English | Chinese | Japan | Korean | - 14 - Test Information Co., Ltd. All rights reserved.
  • 14.
    LoadViewState(ByVal savedState AsObject) MyBase.LoadViewState(savedState) LoadControls() End Sub Answer: D 9. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create the following controls: ¡¤A composite custom control named MyControl. ¡¤A templated custom control named OrderFormData. You write the following code segment to override the method named CreateChildControls() in the MyControl class. (Line numbers are included for reference only.) 01 protected override void 02 CreateChildControls() { 03 Controls.Clear(); 04 OrderFormData oFData = new 05 ?OrderFormData("OrderForm"); 06 07 } You need to add the OrderFormData control to the MyControl control. Which code segment should you insert at line 06? A. Controls.Add(oFData); B. Template.InstantiateIn(this); Template.InstantiateIn(oFData); C. Controls.Add(oFData); this.Controls.Add(oFData); D. this.TemplateControl = (TemplateControl)Template; oFData.TemplateControl = (TemplateControl)Template; Controls.Add(oFData); | English | Chinese | Japan | Korean | - 15 - Test Information Co., Ltd. All rights reserved.
  • 15.
    Answer: B 10. Youcreate a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create the following controls: ¡¤A composite custom control named MyControl. ¡¤A templated custom control named OrderFormData. You write the following code segment to override the method named CreateChildControls() in the MyControl class. (Line numbers are included for reference only.) 01 Protected Overloads Overrides Sub CreateChildControls() 02 Controls.Clear() 03 Dim oFData As New OrderFormData("OrderForm") 04 05 End Sub You need to add the OrderFormData control to the MyControl control. Which code segment should you insert at line 04? A. Controls.Add(oFData) B. Template.InstantiateIn(Me) Template.InstantiateIn(oFData) C. Controls.Add(oFData) Me.Controls.Add(oFData) D. Me.TemplateControl = DirectCast(Template, TemplateControl) oFData.TemplateControl = DirectCast(Template, TemplateControl) Controls.Add(oFData) Answer: B 11. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a composite custom control named MyControl. You need to add an instance of the OrderFormData control to the MyControl control. Which code segment should you use? | English | Chinese | Japan | Korean | - 16 - Test Information Co., Ltd. All rights reserved.
  • 16.
    A. protected overridevoid CreateChildControls() { Controls.Clear(); OrderFormData oFData = new OrderFormData("OrderForm"); Controls.Add(oFData); } B. protected override void RenderContents(HtmlTextWriter writer) { OrderFormData oFData = new OrderFormData("OrderForm"); oFData.RenderControl(writer); } C. protected override void EnsureChildControls() { Controls.Clear(); OrderFormData oFData = new OrderFormData("OrderForm"); oFData.EnsureChildControls(); if (!ChildControlsCreated) CreateChildControls(); } D. protected override ControlCollection CreateControlCollection() { ControlCollection controls = new ControlCollection(this); OrderFormData oFData = new OrderFormData("OrderForm"); controls.Add(oFData); return controls; } Answer: A 12. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a composite custom control named MyControl. You need to add an instance of the OrderFormData control to the MyControl control. | English | Chinese | Japan | Korean | - 17 - Test Information Co., Ltd. All rights reserved.
  • 17.
    Which code segmentshould you use? A. Protected Overloads Overrides Sub _ CreateChildControls() Controls.Clear() Dim oFData As New OrderFormData("OrderForm") Controls.Add(oFData) End Sub B. Protected Overloads Overrides Sub _ RenderContents(ByVal writer As HtmlTextWriter) Dim oFData As New OrderFormData("OrderForm") oFData.RenderControl(writer) End Sub C. Protected Overloads Overrides Sub _ EnsureChildControls() Controls.Clear() Dim oFData As New OrderFormData("OrderForm") oFData.EnsureChildControls() If Not ChildControlsCreated Then CreateChildControls() End If End Sub D. Protected Overloads Overrides Function _ CreateControlCollection() As ControlCollection Dim controls As New ControlCollection(Me) Dim oFData As New OrderFormData("OrderForm") controls.Add(oFData) Return controls End Function Answer: A | English | Chinese | Japan | Korean | - 18 - Test Information Co., Ltd. All rights reserved.
  • 18.
    13.You create aMicrosoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a custom control named OrderForm. You write the following code segment. public delegate void CheckOrderFormEventHandler(EventArgs e); private static readonly object CheckOrderFormKey = new object(); public event CheckOrderFormEventHandler CheckOrderForm { add { Events.AddHandler(CheckOrderFormKey, value); } remove { Events.RemoveHandler(CheckOrderFormKey, value); } } You need to provide a method that enables the OrderForm control to raise the CheckOrderForm event. Which code segment should you use? A. protected virtual void OnCheckOrderForm(EventArgs e) { CheckOrderFormEventHandler checkOrderForm = (CheckOrderFormEventHandler)Events[ typeof(CheckOrderFormEventHandler)]; if (checkOrderForm != null) checkOrderForm(e); } B. protected virtual void OnCheckOrderForm(EventArgs e) { CheckOrderFormEventHandler checkOrderForm = | English | Chinese | Japan | Korean | - 19 - Test Information Co., Ltd. All rights reserved.
  • 19.
    Events[CheckOrderFormKey] as CheckOrderFormEventHandler; if (checkOrderForm != null) checkOrderForm(e); } C. CheckOrderFormEventHandler checkOrderForm = new CheckOrderFormEventHandler(checkOrderFormCallBack); protected virtual void OnCheckOrderForm(EventArgs e) { if (checkOrderForm != null) checkOrderForm(e); } D. CheckOrderFormEventHandler checkOrderForm = new CheckOrderFormEventHandler(checkOrderFormCallBack); protected virtual void OnCheckOrderForm(EventArgs e) { if (checkOrderForm != null) RaiseBubbleEvent(checkOrderForm, e); } Answer: B 14. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a custom control named OrderForm. You write the following code segment. Public Delegate Sub _ CheckOrderFormEventHandler(ByVal e As EventArgs) Private Shared ReadOnly CheckOrderFormKey As New Object() public event CheckOrderFormEventHandler Public Custom Event CheckOrderForm As CheckOrderFormEventHandler AddHandler(ByVal value As CheckOrderFormEventHandler) Events.[AddHandler](CheckOrderFormKey, value) End AddHandler | English | Chinese | Japan | Korean | - 20 - Test Information Co., Ltd. All rights reserved.
  • 20.
    RemoveHandler(ByVal value AsCheckOrderFormEventHandler) Events.[RemoveHandler](CheckOrderFormKey, value) End RemoveHandler RaiseEvent(ByVal e As EventArgs) End RaiseEvent End Event You need to provide a method that enables the OrderForm control to raise the CheckOrderForm event. Which code segment should you use? A. Protected Overridable Sub _ OnCheckOrderForm(ByVal e As EventArgs) Dim checkOrderForm As CheckOrderFormEventHandler = _ DirectCast(Events(GetType(CheckOrderFormEventHandler)), _ CheckOrderFormEventHandler) RaiseEvent CheckOrderForm(e) End Sub B. Protected Overridable Sub _ OnCheckOrderForm(ByVal e As EventArgs) Dim checkOrderForm As CheckOrderFormEventHandler = _ TryCast(Events(CheckOrderFormKey), _ CheckOrderFormEventHandler) RaiseEvent CheckOrderForm(e) End Sub C. Private checkOrderForm As New _ CheckOrderFormEventHandler(AddressOf _ checkOrderFormCallBack) Protected Overridable Sub _ OnCheckOrderForm(ByVal e As EventArgs) If checkOrderForm IsNot Nothing Then checkOrderForm(e) | English | Chinese | Japan | Korean | - 21 - Test Information Co., Ltd. All rights reserved.
  • 21.
    End If End Sub D.Private checkOrderForm As New _ CheckOrderFormEventHandler(AddressOf _ checkOrderFormCallBack) Protected Overridable Sub _ OnCheckOrderForm(ByVal e As EventArgs) If checkOrderForm IsNot Nothing Then RaiseBubbleEvent(checkOrderForm, e) End If End Sub Answer: B 15. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You add a TextBox control named TextBox1. You write the following code segment for validation. protected void CustomValidator1_ServerValidate( object source, ServerValidateEventArgs args) { DateTime dt = String.IsNullOrEmpty(args.Value) DateTime.Now : Convert.ToDateTime(args.Value); args.IsValid = (DateTime.Now - dt).Days < 10; } You need to validate the value of TextBox1. Which code fragment should you add to the Web page? A. <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox1" ValidateEmptyText="True" onservervalidate="CustomValidator1_ServerValidate"> </asp:CustomValidator> B. <asp:RequiredFieldValidator ID="RequiredFieldValidator1" | English | Chinese | Japan | Korean | - 22 - Test Information Co., Ltd. All rights reserved.
  • 22.
    runat="server"ControlToValidate="TextBox1" InitialValue="<%= DateTime.Now; %>"> </asp:RequiredFieldValidator> C. <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox1" ValidateEmptyText="True" onservervalidate="CustomValidator1_ServerValidate"> </asp:CustomValidator> D. <asp:CompareValidator ID="CompareValidator1" runat="server" Type="Date" EnableClientScript="true" ControlToValidate="TextBox1" Operator="DataTypeCheck" > </asp:CompareValidator> E. <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox1" onservervalidate="CustomValidator1_ServerValidate"> </asp:CustomValidator> F. <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" EnableClientScript="false" InitialValue="<%= DateTime.Now; %>" > </asp:RequiredFieldValidator> G. <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox1" ValidateEmptyText="True" onservervalidate="CustomValidator1_ServerValidate"> </asp:CustomValidator> H. <asp:CompareValidator ID="CompareValidator1" runat="server" Type="Date" EnableClientScript="true" ControlToValidate="TextBox1" ValueToCompare="<%= DateTime.Now; %>"> </asp:CompareValidator> Answer: B 16. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You add a TextBox control named TextBox1. You write the following code segment for validation. Protected Sub _ | English | Chinese | Japan | Korean | - 23 - Test Information Co., Ltd. All rights reserved.
  • 23.
    CustomValidator1_ServerValidate(ByVal source AsObject, _ ByVal args As ServerValidateEventArgs) Dim dt As DateTime = _ IIf([String].IsNullOrEmpty(args.Value), _ DateTime.Now, Convert.ToDateTime(args.Value)) args.IsValid = (DateTime.Now - dt).Days < 10 End Sub You need to validate the value of TextBox1. Which code fragment should you add to the Web page? A. <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox1" ValidateEmptyText="True" onservervalidate="CustomValidator1_ServerValidate"> </asp:CustomValidator> B. <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" InitialValue="<%= DateTime.Now; %>" > </asp:RequiredFieldValidator> C. <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox1" ValidateEmptyText="True" onservervalidate="CustomValidator1_ServerValidate"> </asp:CustomValidator> D. <asp:CompareValidator ID="CompareValidator1" runat="server" Type="Date" EnableClientScript="true" ControlToValidate="TextBox1" Operator="DataTypeCheck" > </asp:CompareValidator> E. <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox1" onservervalidate="CustomValidator1_ServerValidate"> </asp:CustomValidator> F. <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" | English | Chinese | Japan | Korean | - 24 - Test Information Co., Ltd. All rights reserved.
  • 24.
    ControlToValidate="TextBox1" EnableClientScript="false" InitialValue="<%=DateTime.Now; %>" > </asp:RequiredFieldValidator> G. <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox1" ValidateEmptyText="True" onservervalidate="CustomValidator1_ServerValidate"> </asp:CustomValidator> H. <asp:CompareValidator ID="CompareValidator1" runat="server" Type="Date" EnableClientScript="true" ControlToValidate="TextBox1" ValueToCompare="<%= DateTime.Now; %>"> </asp:CompareValidator> Answer: B 17. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You derive a new validation control from the BaseValidator class. The validation logic for the control is implemented in the Validate method in the following manner. protected static bool Validate(string value) { ... } You need to override the method that validates the value of the related control. Which override method should you use? A. protected override bool EvaluateIsValid() { string value = GetControlValidationValue( this.Attributes["AssociatedControl"]); bool isValid = Validate(value); return isValid; } B. protected override bool ControlPropertiesValid() { string value = GetControlValidationValue(this.ValidationGroup); bool isValid = Validate(value); return isValid; | English | Chinese | Japan | Korean | - 25 - Test Information Co., Ltd. All rights reserved.
  • 25.
    } C. protected overridebool EvaluateIsValid() { string value = GetControlValidationValue(this.ControlToValidate); bool isValid = Validate(value); return isValid; } D. protected override bool ControlPropertiesValid() { string value = GetControlValidationValue( this.Attributes["ControlToValidate"]); bool isValid = Validate(value); this.PropertiesValid = isValid; return true; } Answer: C 18. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You derive a new validation control from the BaseValidator class. The validation logic for the control is implemented in the Validate method in the following manner. Protected Overloads Function Validate( _ ByVal value As String) As Boolean ... End Function You need to override the method that validates the value of the related control. Which override method should you use? A. Protected Overloads Overrides Function EvaluateIsValid() As Boolean Dim value As String = _ GetControlValidationValue(Me.Attributes("AssociatedControl")) Dim isValid As Boolean = Validate(value) | English | Chinese | Japan | Korean | - 26 - Test Information Co., Ltd. All rights reserved.
  • 26.
    Return isValid End Function B.Protected Overloads Overrides _ Function ControlPropertiesValid() As Boolean Dim value As String = _ GetControlValidationValue(Me.ValidationGroup) Dim isValid As Boolean = Validate(value) Return isValid End Function C. Protected Overloads Overrides Function EvaluateIsValid() As Boolean Dim value As String = _ GetControlValidationValue(Me.ControlToValidate) Dim isValid As Boolean = Validate(value) Return isValid End Function D. Protected Overloads Overrides Function ControlPropertiesValid() As Boolean Dim value As String = _ GetControlValidationValue(Me.Attributes("ControlToValidate")) Dim isValid As Boolean = Validate(value) Me.PropertiesValid = isValid Return True End Function Answer: C 19. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You add an XmlDataSource control named XmlDataSource1 to the Web page. XmlDataSource1 is bound to an XML document with the following structure. <?xml version="1.0" encoding="utf-8" ?> <clients> | English | Chinese | Japan | Korean | - 27 - Test Information Co., Ltd. All rights reserved.
  • 27.
    <client ID="1" Name="JohnEvans" /> <client ID="2" Name="Mike Miller"/> ... </clients> You also write the following code segment in the code-behind file of the Web page. protected void BulletedList1_Click( ?object sender, BulletedListEventArgs e) { //... } You need to add a BulletedList control named BulletedList1 to the Web page that is bound to XmlDataSource1. Which code fragment should you use? A. <asp:BulletedList ID="BulletedList1" runat="server" DisplayMode="LinkButton" DataSource="XmlDataSource1" DataTextField="Name" DataValueField="ID" onclick="BulletedList1_Click"> </asp:BulletedList> B. <asp:BulletedList ID="BulletedList1" runat="server" DisplayMode="HyperLink" DataSourceID="XmlDataSource1" DataTextField="Name" DataMember="ID" onclick="BulletedList1_Click"> </asp:BulletedList> C. <asp:BulletedList ID="BulletedList1" runat="server" DisplayMode="LinkButton" DataSourceID="XmlDataSource1" DataTextField="Name" DataValueField="ID" onclick="BulletedList1_Click"> </asp:BulletedList> D. <asp:BulletedList ID="BulletedList1" runat="server" DisplayMode="HyperLink" DataSourceID="XmlDataSource1" | English | Chinese | Japan | Korean | - 28 - Test Information Co., Ltd. All rights reserved.
  • 28.
    DataTextField="ID" DataValueField="Name" onclick="BulletedList1_Click"> </asp:BulletedList> Answer: C 20. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You add an XmlDataSource control named XmlDataSource1 to the Web page. XmlDataSource1 is bound to an XML document with the following structure. <?xml version="1.0" encoding="utf-8" ?> <clients> <client ID="1" Name="John Evans" /> <client ID="2" Name="Mike Miller"/> ... </clients> You also write the following code segment in the code-behind file of the Web page. Protected Sub BulletedList1_Click(ByVal sender As _ ?Object, ByVal e As BulletedListEventArgs) '... End Sub You need to add a BulletedList control named BulletedList1 to the Web page that is bound to XmlDataSource1. Which code fragment should you use? A. <asp:BulletedList ID="BulletedList1" runat="server" DisplayMode="LinkButton" DataSource="XmlDataSource1" DataTextField="Name" DataValueField="ID" onclick="BulletedList1_Click"> </asp:BulletedList> B. <asp:BulletedList ID="BulletedList1" runat="server" DisplayMode="HyperLink" DataSourceID="XmlDataSource1" | English | Chinese | Japan | Korean | - 29 - Test Information Co., Ltd. All rights reserved.
  • 29.
    DataTextField="Name" DataMember="ID" onclick="BulletedList1_Click"> </asp:BulletedList> C.<asp:BulletedList ID="BulletedList1" runat="server" DisplayMode="LinkButton" DataSourceID="XmlDataSource1" DataTextField="Name" DataValueField="ID" onclick="BulletedList1_Click"> </asp:BulletedList> D. <asp:BulletedList ID="BulletedList1" runat="server" DisplayMode="HyperLink" DataSourceID="XmlDataSource1" DataTextField="ID" DataValueField="Name" onclick="BulletedList1_Click"> </asp:BulletedList> Answer: C 21. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code fragment. <asp:ListBox SelectionMode="Multiple" ID="ListBox1" runat="server"> </asp:ListBox> <asp:ListBox ID="ListBox2" runat="server"> </asp:ListBox> <asp:Button ID="Button1" runat="server" ?Text="Button" onclick="Button1_Click" /> You need to ensure that when you click the Button1 control, a selected list of items move from the ListBox1 control to the ListBox2 control. Which code segment should you use? A. foreach (ListItem li in ListBox1.Items) { if (li.Selected) { | English | Chinese | Japan | Korean | - 30 - Test Information Co., Ltd. All rights reserved.
  • 30.
    ListBox2.Items.Add(li); ListBox1.Items.Remove(li); } } B. foreach (ListItem li in ListBox1.Items) { if (li.Selected) { li.Selected = false; ListBox2.Items.Add(li); ListBox1.Items.Remove(li); } } C. foreach (ListItem li in ListBox1.Items) { if (li.Selected) { li.Selected = false; ListBox2.Items.Add(li); } } D. foreach (ListItem li in ListBox2.Items) { if (ListBox1.Items.Contains(li)) ListBox1.Items.Remove(li); } E. foreach (ListItem li in ListBox1.Items) { if (li.Selected) { li.Selected = false; ListBox2.Items.Add(li); } } F. foreach (ListItem li in ListBox1.Items) { if (ListBox2.Items.Contains(li)) | English | Chinese | Japan | Korean | - 31 - Test Information Co., Ltd. All rights reserved.
  • 31.
    ListBox1.Items.Remove(li); } Answer: C 22. Youcreate a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code fragment. <asp:ListBox SelectionMode="Multiple" ?ID="ListBox1" runat="server"> </asp:ListBox> <asp:ListBox ID="ListBox2" runat="server"> </asp:ListBox> <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /> You need to ensure that when you click the Button1 control, a selected list of items move from the ListBox1 control to the ListBox2 control. Which code segment should you use? A. For Each li As ListItem In ListBox1.Items If li.Selected Then ListBox2.Items.Add(li) ListBox1.Items.Remove(li) End If Next B. For Each li As ListItem In ListBox1.Items If li.Selected Then li.Selected = False ListBox2.Items.Add(li) ListBox1.Items.Remove(li) End If Next | English | Chinese | Japan | Korean | - 32 - Test Information Co., Ltd. All rights reserved.
  • 32.
    C. For Eachli As ListItem In ListBox1.Items If li.Selected Then li.Selected = False ListBox2.Items.Add(li) End If Next D. For Each li As ListItem In ListBox2.Items If ListBox1.Items.Contains(li) Then ListBox1.Items.Remove(li) End If Next E. For Each li As ListItem In ListBox1.Items If li.Selected Then li.Selected = False ListBox2.Items.Add(li) End If Next F. For Each li As ListItem In ListBox1.Items If ListBox2.Items.Contains(li) Then ListBox1.Items.Remove(li) End If Next Answer: C 23. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code fragment. <asp:DropDownList AutoPostBack="true" ?ID="DropDownList1" runat="server" ?onselectedindexchanged= | English | Chinese | Japan | Korean | - 33 - Test Information Co., Ltd. All rights reserved.
  • 33.
    ?"DropDownList1_SelectedIndexChanged"> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> </asp:DropDownList> You also add a MultiView control named MultiView1 to the Web page. MultiView1 has three child View controls. You need to ensure that you can select the View controls by using the DropDownList1 DropDownList control. Which code segment should you use? A. int idx = DropDownList1.SelectedIndex; MultiView1.ActiveViewIndex = idx; B. int idx = DropDownList1.SelectedIndex; MultiView1.Views[idx].Visible = true; C. int idx = int.Parse(DropDownList1.SelectedValue); MultiView1.ActiveViewIndex = idx; D. int idx = int.Parse(DropDownList1.SelectedValue); MultiView1.Views[idx].Visible = true; Answer: A 24. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code fragment. <asp:DropDownList AutoPostBack="true" ID="DropDownList1" runat="server" onselectedindexchanged= "DropDownList1_SelectedIndexChanged"> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> | English | Chinese | Japan | Korean | - 34 - Test Information Co., Ltd. All rights reserved.
  • 34.
    </asp:DropDownList> You also adda MultiView control named MultiView1 to the Web page. MultiView1 has three child View controls. You need to ensure that you can select the View controls by using the DropDownList1 DropDownList control. Which code segment should you use? A. Dim idx As Integer = DropDownList1.SelectedIndex MultiView1.ActiveViewIndex = idx B. Dim idx As Integer = DropDownList1.SelectedIndex MultiView1.Views(idx).Visible = True C. Dim idx As Integer = Integer.Parse(DropDownList1.SelectedValue) MultiView1.ActiveViewIndex = idx D. Dim idx As Integer = Integer.Parse(DropDownList1.SelectedValue) MultiView1.Views(idx).Visible = True Answer: A 25. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. To add a Calendar server control to a Web page, you write the following code fragment. <asp:Calendar SelectionMode="DayWeek" ID="Calendar1" runat="server"> </asp:Calendar> You need to disable the non-week days in the Calendar control. What should you do? A. Add the following code segment to the Calendar1 DayRender event handler. if (e.Day.IsWeekend) { e.Day.IsSelectable = false; } B. Add the following code segment to the Calendar1 DayRender event handler. if (e.Day.IsWeekend) { | English | Chinese | Japan | Korean | - 35 - Test Information Co., Ltd. All rights reserved.
  • 35.
    if (Calendar1.SelectedDates.Contains(e.Day.Date)) Calendar1.SelectedDates.Remove(e.Day.Date); } C. Add the following code segment to the Calendar1 SelectionChanged event handler. List<DateTime> list = new List<DateTime>(); foreach (DateTime st in (sender as Calendar).SelectedDates) { if (st.DayOfWeek == DayOfWeek.Saturday || st.DayOfWeek == DayOfWeek.Sunday) { list.Add(st); } } foreach (DateTime dt in list) { (sender as Calendar).SelectedDates.Remove(dt); } D. Add the following code segment to the Calendar1 DataBinding event handler. List<DateTime> list = new List<DateTime>(); foreach (DateTime st in (sender as Calendar).SelectedDates) { if (st.DayOfWeek == DayOfWeek.Saturday || st.DayOfWeek == DayOfWeek.Sunday) { list.Add(st); } } foreach (DateTime dt in list) { (sender as Calendar).SelectedDates.Remove(dt); } Answer: A 26. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. To add a Calendar server control to a Web page, you write the following code fragment. | English | Chinese | Japan | Korean | - 36 - Test Information Co., Ltd. All rights reserved.
  • 36.
    <asp:Calendar SelectionMode="DayWeek" ID="Calendar1"runat="server"> </asp:Calendar> You need to disable the non-week days in the Calendar control. What should you do? A. Add the following code segment to the Calendar1 DayRender event handler. If e.Day.IsWeekend Then e.Day.IsSelectable = False End If B. Add the following code segment to the Calendar1 DayRender event handler. If e.Day.IsWeekend Then If Calendar1.SelectedDates.Contains(e.Day.Date) Then Calendar1.SelectedDates.Remove(e.Day.Date) End If End If C. Add the following code segment to the Calendar1 SelectionChanged event handler. Dim list As New List(Of DateTime)() For Each st As DateTime In TryCast(sender, Calendar).SelectedDates If st.DayOfWeek = DayOfWeek.Saturday OrElse _ st.DayOfWeek = DayOfWeek.Sunday Then list.Add(st) End If Next For Each dt As DateTime In list TryCast(sender, Calendar).SelectedDates.Remove(dt) Next D. Add the following code segment to the Calendar1 DataBinding event handler. Dim list As New List(Of DateTime)() For Each st As DateTime In TryCast(sender, Calendar).SelectedDates | English | Chinese | Japan | Korean | - 37 - Test Information Co., Ltd. All rights reserved.
  • 37.
    If st.DayOfWeek =DayOfWeek.Saturday OrElse _ st.DayOfWeek = DayOfWeek.Sunday Then list.Add(st) End If Next For Each dt As DateTime In list TryCast(sender, Calendar).SelectedDates.Remove(dt) Next Answer: A 27. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You define the following class. public class Product { public decimal Price { get; set; } } Your application contains a Web form with a Label control named lblPrice. You use a StringReader variable named xmlStream to access the following XML fragment. <Product> <Price>35</Price> </Product> You need to display the price of the product from the XML fragment in the lblPrice Label control. Which code segment should you use? A. DataTable dt = new DataTable(); dt.ExtendedProperties.Add("Type", "Product"); dt.ReadXml(xmlStream); lblPrice.Text = dt.Rows[0]["Price"].ToString(); B. XmlReader xr = XmlReader.Create(xmlStream); Product boughtProduct = xr.ReadContentAs(typeof(Product), null) as Product; | English | Chinese | Japan | Korean | - 38 - Test Information Co., Ltd. All rights reserved.
  • 38.
    lblPrice.Text = boughtProduct.Price.ToString(); C.XmlSerializer xs = new XmlSerializer(typeof(Product)); Product boughtProduct = xs.Deserialize(xmlStream) as Product; lblPrice.Text = boughtProduct.Price.ToString(); D. XmlDocument xDoc = new XmlDocument(); xDoc.Load(xmlStream); Product boughtProduct = xDoc.OfType<Product>().First(); lblPrice.Text = boughtProduct.Price.ToString(); Answer: C 28. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You define the following class. Public Class Product Public Property Price() As Decimal Get End Get Set(ByVal value As Decimal) End Set End Property End Class Your application contains a Web form with a Label control named lblPrice. You use a StringReader variable named xmlStream to access the following XML fragment. <Product> <Price>35</Price> </Product> You need to display the price of the product from the XML fragment in the lblPrice Label control. Which code segment should you use? A. Dim dt As New DataTable() | English | Chinese | Japan | Korean | - 39 - Test Information Co., Ltd. All rights reserved.
  • 39.
    dt.ExtendedProperties.Add("Type", "Product") dt.ReadXml(xmlStream) lblPrice.Text =dt.Rows(0)("Price").ToString() B. Dim xr As XmlReader = XmlReader.Create(xmlStream) Dim boughtProduct As Product = TryCast( _ xr.ReadContentAs(GetType(Product), Nothing), Product) lblPrice.Text = boughtProduct.Price.ToString() C. Dim xs As New XmlSerializer(GetType(Product)) Dim boughtProduct As Product = TryCast( _ xs.Deserialize(xmlStream), Product) lblPrice.Text = boughtProduct.Price.ToString() D. Dim xDoc As New XmlDocument() xDoc.Load(xmlStream) Dim boughtProduct As Product = xDoc.OfType(Of Product)().First() lblPrice.Text = boughtProduct.Price.ToString() Answer: C 29. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You add a Web form that contains the following code fragment. <asp:GridView ID="gvProducts" runat="server" AllowSorting="True" DataSourceID="Products"> </asp:GridView> <asp:ObjectDataSource ID="Products" runat="server" SelectMethod="GetData" TypeName="DAL" /> </asp:ObjectDataSource> You write the following code segment for the GetData method of the DAL class. (Line numbers are included for reference only.) 01 public object GetData() { 02 SqlConnection cnn = new SqlConnection( -) | English | Chinese | Japan | Korean | - 40 - Test Information Co., Ltd. All rights reserved.
  • 40.
    03 string strQuery = "SELECT * FROM Products"; 04 05 } You need to ensure that the user can use the sorting functionality of the gvProducts GridView control. Which code segment should you insert at line 04? A. SqlCommand cmd = new SqlCommand(strQuery, cnn); cnn.Open(); return cmd.ExecuteReader(); B. SqlCommand cmd = new SqlCommand(strQuery, cnn); cnn.Open(); return cmd.ExecuteReader(CommandBehavior.KeyInfo); C. SqlDataAdapter da = new SqlDataAdapter(strQuery, cnn); DataSet ds = new DataSet(); da.Fill(ds); return ds; D. SqlDataAdapter da = new SqlDataAdapter(strQuery, cnn); DataSet ds = new DataSet(); da.Fill(ds); ds.ExtendedProperties.Add("Sortable", true); return ds.Tables[0].Select(); Answer: C 30. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You add a Web form that contains the following code fragment. <asp:GridView ID="gvProducts" runat="server" AllowSorting="True" DataSourceID="Products"> </asp:GridView> <asp:ObjectDataSource ID="Products" runat="server" SelectMethod="GetData" TypeName="DAL" /> | English | Chinese | Japan | Korean | - 41 - Test Information Co., Ltd. All rights reserved.
  • 41.
    </asp:ObjectDataSource> You write thefollowing code segment for the GetData method of the DAL class. (Line numbers are included for reference only.) 01 Public Function GetData() As Object 02 Dim cnn As New SqlConnection( - 03 Dim strQuery As String = "SELECT * FROM Products" 04 05 End Function You need to ensure that the user can use the sorting functionality of the gvProducts GridView control. Which code segment should you insert at line 04? A. Dim cmd As New SqlCommand(strQuery, cnn) cnn.Open() Return cmd.ExecuteReader() B. Dim cmd As New SqlCommand(strQuery, cnn) cnn.Open() Return cmd.ExecuteReader(CommandBehavior.KeyInfo) C. Dim da As New SqlDataAdapter(strQuery, cnn) Dim ds As New DataSet() da.Fill(ds) Return ds D. Dim da As New SqlDataAdapter(strQuery, cnn) Dim ds As New DataSet() da.Fill(ds) ds.ExtendedProperties.Add("Sortable", True) Return ds.Tables(0).Select() Answer: C 31. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a class that contains the following code segment. (Line numbers are included for reference | English | Chinese | Japan | Korean | - 42 - Test Information Co., Ltd. All rights reserved.
  • 42.
    only.) 01 public objectGetCachedProducts(sqlConnection conn) { 02 03 if (Cache["products"] == null) { 04 SqlCommand cmd = new SqlCommand( 05 "SELECT * FROM Products", conn); 07 conn.Open(); 08 Cache.Insert("products", GetData(cmd)); 09 conn.Close(); 10 } 11 return Cache["products"]; 12 } 13 14 public object GetData(SqlCommand prodCmd) { 15 16 } Each time a Web form has to access a list of products, the GetCachedProducts method is called to provide this list from the Cache object. You need to ensure that the list of products is always available in the Cache object. Which code segment should you insert at line 15? A. return prodCmd.ExecuteReader(); SqlDataReader dr; prodCmd.CommandTimeout = int.MaxValue; B. dr = prodCmd.ExecuteReader(); return dr; C. SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = prodCmd; DataSet ds = new DataSet(); return ds.Tables[0]; | English | Chinese | Japan | Korean | - 43 - Test Information Co., Ltd. All rights reserved.
  • 43.
    D. SqlDataAdapter da= new SqlDataAdapter(prodCmd); DataSet ds = new DataSet(); da.Fill(ds); return ds; Answer: D 32. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a class that contains the following code segment. (Line numbers are included for reference only.) 01 Public Function GetCachedProducts( _ ByVal conn As SqlConnection) As Object 02 03 If Cache("products") Is Nothing Then 04 Dim cmd As New SqlCommand("SELECT * FROM Products", conn) 05 conn.Open() 06 Cache.Insert("products", GetData(cmd)) 07 conn.Close() 08 End If 09 Return Cache("products") 10 End Function 11 12 Public Function GetData(ByVal prodCmd As SqlCommand) As Object 13 14 End Function Each time a Web form has to access a list of products, the GetCachedProducts method is called to provide this list from the Cache object. You need to ensure that the list of products is always available in the Cache object. Which code segment should you insert at line 13? A. Return prodCmd.ExecuteReader() | English | Chinese | Japan | Korean | - 44 - Test Information Co., Ltd. All rights reserved.
  • 44.
    Dim dr AsSqlDataReader prodCmd.CommandTimeout = Integer.MaxValue B. dr = prodCmd.ExecuteReader() Return dr C. Dim da As New SqlDataAdapter() da.SelectCommand = prodCmd Dim ds As New DataSet() Return ds.Tables(0) D. Dim da As New SqlDataAdapter(prodCmd) Dim ds As New DataSet() da.Fill(ds) Return ds Answer: D 33. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code segment in the code-behind file to create a Web form. (Line numbers are included for reference only.) 01 string strQuery = "select * from Products;" 02 + "select * from Categories"; 03 SqlCommand cmd = new SqlCommand(strQuery, cnn); 04 cnn.Open(); 05 SqlDataReader rdr = cmd.ExecuteReader(); 06 07 rdr.Close(); 08 cnn.Close(); You need to ensure that the gvProducts and gvCategories GridView controls display the data that is contained in the following two database tables: ¡¤The Products database tabl ¡¤The Categories database tabl | English | Chinese | Japan | Korean | - 45 - Test Information Co., Ltd. All rights reserved.
  • 45.
    Which code segmentshould you insert at line 06? A. gvProducts.DataSource = rdr; gvProducts.DataBind(); gvCategories.DataSource = rdr; gvCategories.DataBind(); B. gvProducts.DataSource = rdr; gvCategories.DataSource = rdr; gvProducts.DataBind(); gvCategories.DataBind(); C. gvProducts.DataSource = rdr; rdr.NextResult(); gvCategories.DataSource = rdr; gvProducts.DataBind(); gvCategories.DataBind(); D. gvProducts.DataSource = rdr; gvCategories.DataSource = rdr; gvProducts.DataBind(); rdr.NextResult(); gvCategories.DataBind(); Answer: D 34. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code segment in the code-behind file to create a Web form. (Line numbers are included for reference only.) 01 Dim strQuery As String = "select * from Products;" + _ "select * from Categories" 02 Dim cmd As New SqlCommand(strQuery, cnn) 03 cnn.Open() 04 Dim rdr As SqlDataReader = cmd.ExecuteReader() | English | Chinese | Japan | Korean | - 46 - Test Information Co., Ltd. All rights reserved.
  • 46.
    05 06 rdr.Close() 07 cnn.Close() Youneed to ensure that the gvProducts and gvCategories GridView controls display the data that is contained in the following two database tables: ¡¤The Products database tabl ¡¤The Categories database tabl Which code segment should you insert at line 05? A. gvProducts.DataSource = rdr gvProducts.DataBind() gvCategories.DataSource = rdr gvCategories.DataBind() B. gvProducts.DataSource = rdr gvCategories.DataSource = rdr gvProducts.DataBind() gvCategories.DataBind() C. gvProducts.DataSource = rdr rdr.NextResult() gvCategories.DataSource = rdr gvProducts.DataBind() gvCategories.DataBind() D. gvProducts.DataSource = rdr gvCategories.DataSource = rdr gvProducts.DataBind() rdr.NextResult() gvCategories.DataBind() Answer: D 35. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. | English | Chinese | Japan | Korean | - 47 - Test Information Co., Ltd. All rights reserved.
  • 47.
    You create aWeb form that contains the following code fragment. <asp:TextBox runat="server" ID="txtSearch" /> <asp:Button runat="server" ID="btnSearch" Text="Search" ?OnClick="btnSearch_Click" /> <asp:GridView runat="server" ID="gridCities" /> You write the following code segment in the code-behind file. (Line numbers are included for reference only.) 01 protected void Page_Load(object sender, EventArgs e) 02 { 03 DataSet objDS = new DataSet(); 04 SqlDataAdapter objDA = new SqlDataAdapter(objCmd); 05 objDA.Fill(objDS); 06 gridCities.DataSource = objDs; 07 gridCities.DataBind(); 08 Session["ds"] = objDS; 09 } 10 protected void btnSearch_Click(object sender, EventArgs e) 11 { 12 13 } You need to ensure that when the btnSearch Button control is clicked, the records in the gridCities GridView control are filtered by using the value of the txtSearch TextBox. Which code segment you should insert at line 12? A. DataSet ds = gridCities.DataSource as DataSet; DataView dv = ds.Tables[0].DefaultView; dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'"; gridCities.DataSource = dv; gridCities.DataBind(); B. DataSet ds = Session["ds"] as DataSet; | English | Chinese | Japan | Korean | - 48 - Test Information Co., Ltd. All rights reserved.
  • 48.
    DataView dv =ds.Tables[0].DefaultView; dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'"; gridCities.DataSource = dv; gridCities.DataBind(); C. DataTable dt = Session["ds"] as DataTable; DataView dv = dt.DefaultView; dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'"; gridCities.DataSource = dv; gridCities.DataBind(); D. DataSet ds = Session["ds"] as DataSet; DataTable dt = ds.Tables[0]; DataRow[] rows = dt.Select("CityName LIKE '" + txtSearch.Text + "%'"); gridCities.DataSource = rows; gridCities.DataBind(); Answer: B 36. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web form that contains the following code fragment. <asp:TextBox runat="server" ID="txtSearch" /> <asp:Button runat="server" ID="btnSearch" Text="Search" ?OnClick="btnSearch_Click" /> <asp:GridView runat="server" ID="gridCities" /> You write the following code segment in the code-behind file. (Line numbers are included for reference only.) 01 Protected Sub Page_Load(ByVal sender As Object, _ 02 ?ByVal e As EventArgs) 03 Dim objDS As New DataSet() 04 Dim objDA As New SqlDataAdapter(objCmd) 05 objDA.Fill(objDS) | English | Chinese | Japan | Korean | - 49 - Test Information Co., Ltd. All rights reserved.
  • 49.
    06 gridCities.DataSource = objDS 07 gridCities.DataBind() 08 Session("ds") = objDS 09 End Sub 10 Protected Sub btnSearch_Click(ByVal sender As Object, _ 11 ByVal e As EventArgs) 12 13 End Sub You need to ensure that when the btnSearch Button control is clicked, the records in the gridCities GridView control are filtered by using the value of the txtSearch TextBox. Which code segment you should insert at line 12? Dim ds As DataSet = TryCast(gridCities.DataSource, DataSet) Dim dv As DataView = ds.Tables(0).DefaultView dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'" gridCities.DataSource = dv gridCities.DataBind() Dim ds As DataSet = TryCast(Session("ds"), DataSet) Dim dv As DataView = ds.Tables(0).DefaultView dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'" gridCities.DataSource = dv gridCities.DataBind() Dim dt As DataTable = TryCast(Session("ds"), DataTable) Dim dv As DataView = dt.DefaultView dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'" gridCities.DataSource = dv gridCities.DataBind() Dim ds As DataSet = TryCast(Session("ds"), DataSet) Dim dt As DataTable = ds.Tables(0) Dim rows As DataRow() = _ | English | Chinese | Japan | Korean | - 50 - Test Information Co., Ltd. All rights reserved.
  • 50.
    ?dt.[Select]("CityName LIKE '"+ txtSearch.Text + "%'") gridCities.DataSource = rows gridCities.DataBind() Answer: B 37. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application consumes a Microsoft Windows Communication Foundation (WCF) service. The WCF service exposes the following method. [WebInvoke] string UpdateCustomerDetails(string custID); The application hosts the WCF service by using the following code segment. WebServiceHost host = new WebServiceHost(typeof(CService), new Uri("http://win/")); ServiceEndpoint ep = host.AddServiceEndpoint(typeof(ICService), new WebHttpBinding(), ""); You need to invoke the UpdateCustomerDetails method. Which code segment should you use? A. WebChannelFactory<ICService> wcf = new WebChannelFactory<ICService>(new Uri("http: //win")) ICService channel = wcf.CreateChannel(); string s = channel.UpdateCustomerDetails("CustID12"); B. WebChannelFactory<ICService> wcf = new WebChannelFactory<ICService>(new Uri("http: //win/UpdateCustomerDetails")) ICService channel = wcf.CreateChannel(); string s = channel.UpdateCustomerDetails("CustID12"); C. ChannelFactory<ICService> cf = new ChannelFactory<ICService>(new WebHttpBinding(), "http: //win/UpdateCustomerDetails") | English | Chinese | Japan | Korean | - 51 - Test Information Co., Ltd. All rights reserved.
  • 51.
    ICService channel =cf.CreateChannel(); string s = channel.UpdateCustomerDetails("CustID12"); D. ChannelFactory<ICService> cf = new ChannelFactory<ICService>(new BasicHttpBinding(), "http: //win ") cf.Endpoint.Behaviors.Add(new WebHttpBehavior()); ICService channel = cf.CreateChannel(); string s = channel.UpdateCustomerDetails("CustID12"); Answer: A 38. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application consumes a Microsoft Windows Communication Foundation (WCF) service. The WCF service exposes the following method. <WebInvoke()> _ Function UpdateCustomerDetails(ByVal custID As String) As String The application hosts the WCF service by using the following code segment. Dim host As New WebServiceHost(GetType(CService), _ New Uri("http://win/")) Dim ep As ServiceEndpoint = host.AddServiceEndpoint( _ GetType(ICService), New WebHttpBinding(), "") You need to invoke the UpdateCustomerDetails method. Which code segment should you use? A. dim wcf As New WebChannelFactory(Of ICService)( _ New Uri("http: //win")) Dim channel As ICService = wcf.CreateChannel() Dim s As String = channel.UpdateCustomerDetails("CustID12") B. dim wcf As New WebChannelFactory(Of ICService)( _ New Uri("http: //win/UpdateCustomerDetails")) Dim channel As ICService = wcf.CreateChannel() | English | Chinese | Japan | Korean | - 52 - Test Information Co., Ltd. All rights reserved.
  • 52.
    Dim s AsString = channel.UpdateCustomerDetails("CustID12") C. Dim cf As New ChannelFactory(Of ICService)( _ New WebHttpBinding(), "http: //win/UpdateCustomerDetails") Dim channel As ICService = cf.CreateChannel() Dim s As String = channel.UpdateCustomerDetails("CustID12") D. Dim cf As New ChannelFactory(Of ICService)( _ New BasicHttpBinding(), "http: //win ") cf.Endpoint.Behaviors.Add(New WebHttpBehavior()) Dim channel As ICService = cf.CreateChannel() Dim s As String = channel.UpdateCustomerDetails("CustID12") Answer: A 39. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Microsoft Windows Communication Foundation (WCF) service that exposes the following service contract. (Line numbers are included for reference only.) 01 [ServiceContract] 02 public interface IBlogService 03 { 04 [OperationContract] 05 [WebGet(ResponseFormat=WebMessageFormat.Xml)] 06 Rss20FeedFormatter GetBlog(); 07 } You configure the WCF service to use the WebHttpBinding class, and to be exposed at the following URL: http://www.contoso.com/BlogService You need to store the result of the GetBlog operation in an XmlDocument variable named xmlBlog in a Web form. Which code segment should you use? A. string url = @"http: //www.contoso.com/BlogService/GetBlog"; XmlReader blogReader = XmlReader.Create(url); | English | Chinese | Japan | Korean | - 53 - Test Information Co., Ltd. All rights reserved.
  • 53.
    xmlBlog.Load(blogReader); B. string url= @"http: //www.contoso.com/BlogService"; XmlReader blogReader = XmlReader.Create(url); xmlBlog.Load(blogReader); C. Uri blogUri = new Uri(@"http: //www.contoso.com/BlogService"); ChannelFactory<IBlogService> blogFactory = new ChannelFactory<IBlogService>(blogUri); IBlogService blogSrv = blogFactory.CreateChannel(); Rss20FeedFormatter feed = blogSrv.GetBlog(); xmlBlog.LoadXml(feed.ToString()); D. Uri blogUri = new Uri(@"http: //www.contoso.com/BlogService/GetBlog"); ChannelFactory<IBlogService> blogFactory = new ChannelFactory<IBlogService>(blogUri); IBlogService blogSrv = blogFactory.CreateChannel(); Rss20FeedFormatter feed = blogSrv.GetBlog(); xmlBlog.LoadXml(feed.Feed.ToString()); Answer: A 40. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Microsoft Windows Communication Foundation (WCF) service that exposes the following service contract. (Line numbers are included for reference only.) 01 <ServiceContract()> _ 02 Public Interface IBlogService 03 <OperationContract()> _ 04 <WebGet(ResponseFormat := WebMessageFormat.Xml)> _ 05 Function GetBlog() As Rss20FeedFormatter 06 End Interface You configure the WCF service to use the WebHttpBinding class and to be exposed at the following URL: http://www.contoso.com/BlogService | English | Chinese | Japan | Korean | - 54 - Test Information Co., Ltd. All rights reserved.
  • 54.
    You need tostore the result of the GetBlog operation in an XmlDocument variable named xmlBlog in a Web form. Which code segment should you use? A. Dim url As String = "http: //www.contoso.com/BlogService/GetBlog" Dim blogReader As XmlReader = XmlReader.Create(url) xmlBlog.Load(blogReader) B. Dim url As String = "http: //www.contoso.com/BlogService" Dim blogReader As XmlReader = XmlReader.Create(url) xmlBlog.Load(blogReader) C. Dim binding As New BasicHttpBinding() Dim blogUri As New _ EndpointAddress("http: //www.contoso.com/BlogService") Dim blogFactory As New _ ChannelFactory(Of IBlogService)(binding, blogUri) Dim blogSrv As IBlogService = blogFactory.CreateChannel() Dim feed As Rss20FeedFormatter = blogSrv.GetBlog() xmlBlog.LoadXml(feed.ToString()) D. Dim binding As New BasicHttpBinding() Dim blogUri As New _ EndpointAddress("http: //www.contoso.com/BlogService/GetBlog") Dim blogFactory As New _ ChannelFactory(Of IBlogService)(binding, blogUri) Dim blogSrv As IBlogService = blogFactory.CreateChannel() Dim feed As Rss20FeedFormatter = blogSrv.GetBlog() xmlBlog.LoadXml(feed.Feed.ToString()) Answer: A 41. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You plan to add a custom parameter in the SqlDataSource control. | English | Chinese | Japan | Korean | - 55 - Test Information Co., Ltd. All rights reserved.
  • 55.
    You write thefollowing code fragment. <asp:SqlDataSource ID="SqlDataSource1" runat="server" InsertCommand="INSERT INTO [Employee] ([Field1], [Field2], [PostedDate]) VALUES (@Field1, @Field2, @PostedDate)"> <InsertParameters> <asp:Parameter Name="Field1" /> <asp:Parameter Name="Field2" /> <custom:DayParameter?Name="PostedDate" /> </InsertParameters> </asp:SqlDataSource> You write the following code segment to create a custom parameter class. public class DayParameter : Parameter { } You need to ensure that the custom parameter returns the current date and time. Which code segment should you add to the DayParameter class? A. protected DayParameter() : base("Value", TypeCode.DateTime, DateTime.Now.ToString()) { } B. protected override void LoadViewState(object savedState) { ((StateBag)savedState).Add("Value", DateTime.Now); } C. protected override object Evaluate(HttpContext context, Control control) { return DateTime.Now; } D. protected override Parameter Clone() { Parameter pm = new DayParameter(); | English | Chinese | Japan | Korean | - 56 - Test Information Co., Ltd. All rights reserved.
  • 56.
    pm.DefaultValue = DateTime.Now; return pm; } Answer: C 42. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You plan to add a custom parameter in the SqlDataSource control. You write the following code fragment. <asp:SqlDataSource ID="SqlDataSource1" runat="server" InsertCommand="INSERT INTO [Employee] ([Field1], [Field2], [PostedDate]) VALUES (@Field1, @Field2, @PostedDate)"> <InsertParameters> <asp:Parameter Name="Field1" /> <asp:Parameter Name="Field2" /> <custom:DayParameter?Name="PostedDate" /> </InsertParameters> </asp:SqlDataSource> You write the following code segment to create a custom parameter class. Public Class DayParameter Inherits Parameter End Class You need to ensure that the custom parameter returns the current date and time. Which code segment should you add to the DayParameter class? A. Protected Sub New() MyBase.New("Value", TypeCode.DateTime, DateTime.Now.ToString()) End Sub B. Protected Overloads Overrides Sub _ LoadViewState(ByVal savedState As Object) DirectCast(savedState, _ | English | Chinese | Japan | Korean | - 57 - Test Information Co., Ltd. All rights reserved.
  • 57.
    StateBag).Add("Value", DateTime.Now) End Sub C.Protected Overloads Overrides Function _ Evaluate(ByVal context As HttpContext, _ ByVal control As Control) As Object Return DateTime.Now End Function D. Protected Overloads Overrides Function _ Clone() As Parameter Dim pm As Parameter = New DayParameter() pm.DefaultValue = DateTime.Now Return pm End Function Answer: C 43. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application has an ASPX page named ErrorPage.aspx. You plan to manage the unhandled application exceptions. You need to perform the following tasks: ¡¤Display the ErrorPage.aspx page ¡¤Write the exceptioninformation in the Event log file. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) A. Add the following code fragment to the Web.config file. <customErrors mode="On" defaultRedirect="ErrorPage.aspx" /> B. Add the following code fragment to the Web.config file. <customErrors mode="Off" defaultRedirect="ErrorPage.aspx" /> C. Add the following code segment to the Global.asax file. void Application_Error(object sender, EventArgs e) { | English | Chinese | Japan | Korean | - 58 - Test Information Co., Ltd. All rights reserved.
  • 58.
    Exception exc =Server.GetLastError(); //Write Exception details to event log } D. Add the following code segment to the ErrorPage.aspx file. void Page_Error(object sender, EventArgs e) { Exception exc = Server.GetLastError(); //Write Exception details to event log Server.ClearError(); } Answer: AC 44. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application has an ASPX page named ErrorPage.aspx. You plan to manage the unhandled application exceptions. You need to perform the following tasks: ¡¤Display the ErrorPage.aspx page ¡¤Write the exception information in the Event log file Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) A. Add the following code fragment to the Web.config file. <customErrors mode="On" defaultRedirect="ErrorPage.aspx" /> B. Add the following code fragment to the Web.config file. <customErrors mode="Off" defaultRedirect="ErrorPage.aspx" /> C. Add the following code segment to the Global.asax file. Public Sub Application_Error(ByVal sender As Object, _ ByVal e As EventArgs) Dim exc As Exception = Server.GetLastError() 'Write Exception details to event log End Sub | English | Chinese | Japan | Korean | - 59 - Test Information Co., Ltd. All rights reserved.
  • 59.
    D. Add thefollowing code segment to the ErrorPage.aspx file. Public Sub Page_Error(ByVal sender As Object, _ ByVal e As EventArgs) Dim exc As Exception = Server.GetLastError() 'Write Exception details to event log Server.ClearError() End Sub Answer: AC 45. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application contains two Web pages named OrderDetails.aspx and OrderError.htm. If the application throws unhandled errors in the OrderDetails.aspx Web page, a stack trace is displayed to remote users. You need to ensure that the OrderError.htm Web page is displayed for unhandled errors only in the OrderDetails.aspx Web page. What should you do? A. Set the Page attribute for the OrderDetails.aspx Web page in the following manner. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="OrderDetails.aspx.cs" Inherits="OrderDetails" %> Add the following section to the Web.config file. <customErrors mode="Off" defaultRedirect="OrderError.htm"> </customErrors> B. Set the Page attribute for the OrderDetails.aspx Web page in the following manner. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="OrderDetails.aspx.cs" Inherits="OrderDetails" Debug="true" %> Add the following section to the Web.config file. <customErrors mode="On" defaultRedirect="OrderError.htm"> C. Set the Page attribute for the OrderDetails.aspx Web page in the following manner. <%@ Page Language="C#" AutoEventWireup="true" | English | Chinese | Japan | Korean | - 60 - Test Information Co., Ltd. All rights reserved.
  • 60.
    CodeFile="OrderDetails.aspx.cs" Inherits="OrderDetails" ErrorPage="~/OrderError.htm"Debug="false" %> Add the following section to the Web.config file. <customErrors mode="On"> </customErrors> D. Set the Page attribute for the OrderDetails.aspx Web page in the following manner. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="OrderDetails.aspx.cs" Inherits="OrderDetails" Debug="true" ErrorPage="~/OrderError.htm" %> Add the following section to the Web.config file. <customErrors mode="Off"> </customErrors> Answer: C 46. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application contains two Web pages named OrderDetails.aspx and OrderError.htm. If the application throws unhandled errors in the OrderDetails.aspx Web page, a stack trace is displayed to remote users. You need to ensure that the OrderError.htm Web page is displayed for unhandled errors only in the OrderDetails.aspx Web page. What should you do? A. Set the Page attribute for the OrderDetails.aspx Web page in the following manner. <%@ Page Language="VB" AutoEventWireup="true" CodeFile="OrderDetails.aspx.vb" Inherits="OrderDetails" %> Add the following section to the Web.config file. <customErrors mode="Off" defaultRedirect="OrderError.htm"> </customErrors> B. Set the Page attribute for the OrderDetails.aspx Web page in the following manner. <%@ Page Language="VB" AutoEventWireup="true" | English | Chinese | Japan | Korean | - 61 - Test Information Co., Ltd. All rights reserved.
  • 61.
    CodeFile="OrderDetails.aspx.vb" Inherits="OrderDetails" Debug="true"%> Add the following section to the Web.config file. <customErrors mode="On" defaultRedirect="OrderError.htm"> C. Set the Page attribute for the OrderDetails.aspx Web page in the following manner. <%@ Page Language="VB" AutoEventWireup="true" CodeFile="OrderDetails.aspx.vb" Inherits="OrderDetails" ErrorPage="~/OrderError.htm" Debug="false" %> Add the following section to the Web.config file. <customErrors mode="On"> </customErrors> D. Set the Page attribute for the OrderDetails.aspx Web page in the following manner. <%@ Page Language="VB" AutoEventWireup="true" CodeFile="OrderDetails.aspx.vb" Inherits="OrderDetails" Debug="true" ErrorPage="~/OrderError.htm" %> Add the following section to the Web.config file. <customErrors mode="Off"> </customErrors> Answer: C 47. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code fragment. <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:UpdatePanel ID="updateLabels" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Label ID="Label1" runat="server" /> <asp:Label ID="Label2" runat="server" /> <asp:Button ID="btnSubmit" runat="server" Text="Submit" onclick="btnSubmit_Click" /> | English | Chinese | Japan | Korean | - 62 - Test Information Co., Ltd. All rights reserved.
  • 62.
    </ContentTemplate> </asp:UpdatePanel> <asp:Label id="Label3" runat="server"/> You need to ensure that when you click the btnSubmit Button control, each Label control value is asynchronously updatable. Which code segment should you use? A. protected void btnSubmit_Click(object sender, EventArgs e) { Label1.Text = "Label1 updated value"; Label2.Text = "Label2 updated value"; Label3.Text = "Label3 updated value"; } B. protected void btnSubmit_Click(object sender, EventArgs e) { Label1.Text = "Label1 updated value"; Label2.Text = "Label2 updated value"; ScriptManager1.RegisterDataItem(Label3, "Label3 updated value"); } C. protected void btnSubmit_Click(object sender, EventArgs e) { ScriptManager1.RegisterDataItem(Label1, "Label1 updated value"); ScriptManager1.RegisterDataItem(Label2, "Label2 updated value"); Label3.Text = "Label3 updated value"; } D. protected void btnSubmit_Click(object sender, EventArgs e) { Label1.Text = "Label1 updated value"; Label2.Text = "Label2 updated value"; ScriptManager1.RegisterAsyncPostBackControl(Label3); | English | Chinese | Japan | Korean | - 63 - Test Information Co., Ltd. All rights reserved.
  • 63.
    Label3.Text = "Label3updated value"; } Answer: B 48. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code fragment. <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:UpdatePanel ID="updateLabels" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Label ID="Label1" runat="server" /> <asp:Label ID="Label2" runat="server" /> <asp:Button ID="btnSubmit" runat="server" Text="Submit" onclick="btnSubmit_Click" /> </ContentTemplate> </asp:UpdatePanel> <asp:Label id="Label3" runat="server" /> You need to ensure that when you click the btnSubmit Button control, each Label control value is asynchronously updatable. Which code segment should you use? A. Protected Sub btnSubmit_Click(ByVal sender As Object, _ ByVal e As EventArgs) Label1.Text = "Label1 updated value" Label2.Text = "Label2 updated value" Label3.Text = "Label3 updated value" End Sub B. Protected Sub btnSubmit_Click(ByVal sender As Object, _ ByVal e As EventArgs) Label1.Text = "Label1 updated value" | English | Chinese | Japan | Korean | - 64 - Test Information Co., Ltd. All rights reserved.
  • 64.
    Label2.Text = "Label2updated value" ScriptManager1.RegisterDataItem(Label3, _ "Label3 updated value") End Sub C. Protected Sub btnSubmit_Click(ByVal sender As Object, _ ByVal e As EventArgs) ScriptManager1.RegisterDataItem(Label1, _ "Label1 updated value") ScriptManager1.RegisterDataItem(Label2, _ "Label2 updated value") Label3.Text = "Label3 updated value" End Sub D. Protected Sub btnSubmit_Click(ByVal sender As Object, _ ByVal e As EventArgs) Label1.Text = "Label1 updated value" Label2.Text = "Label2 updated value" ScriptManager1.RegisterAsyncPostBackControl(Label3) Label3.Text = "Label3 updated value" End Sub Answer: B 49. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web form in the application by using the following code fragment. (Line numbers are included for reference only.) 01 <script runat="server"> 02 protected void Button_Handler(object sender, EventArgs e) 03 { 04 // some long-processing operation. 05 } | English | Chinese | Japan | Korean | - 65 - Test Information Co., Ltd. All rights reserved.
  • 65.
    06 </script> 07 <div> 08 <asp:ScriptManager ID="defaultScriptManager" 09 runat="server" /> 10 11 <asp:UpdatePanel ID="defaultPanel" 12 UpdateMode="Conditional" runat="server"> 13 <ContentTemplate> 14 <!-- more content here --> 15 <asp:Button ID="btnSubmit" runat="server" 16 Text="Submit" OnClick="Button_Handler" /> 17 </ContentTemplate> 18 </asp:UpdatePanel> 19 </div> You plan to create a client-side script code by using ASP.NET AJAX. You need to ensure that while a request is being processed, any subsequent Click events on the btnSubmit Button control are suppressed. Which code fragment should you insert at line 10? A. <script type="text/javascript" language="javascript"> var rm = Sys.WebForms.PageRequestManager.getInstance(); rm.add_beginRequest(checkPostback); function checkPostback(sender, args) { if (rm.get_isInAsyncPostBack() && args.get_postBackElement().id == 'btnSubmit') { rm.abortPostBack(); alert('A previous request is still in progress.'); } } </script> | English | Chinese | Japan | Korean | - 66 - Test Information Co., Ltd. All rights reserved.
  • 66.
    B. <script type="text/javascript"language="javascript"> var rm = Sys.WebForms.PageRequestManager.getInstance(); rm.add_initializeRequest(checkPostback); function checkPostback(sender, args) { if (rm.get_isInAsyncPostBack() && args.get_postBackElement().id == 'btnSubmit') { rm.abortPostBack(); alert('A previous request is still in progress.'); } } </script> C. <script type="text/javascript" language="javascript"> var rm = Sys.WebForms.PageRequestManager.getInstance(); rm.add_initializeRequest(checkPostback); function checkPostback(sender, args) { if (rm.get_isInAsyncPostBack() && args.get_postBackElement().id == 'btnSubmit') { args.set_cancel(true); alert('A previous request is still in progress.'); } } </script> D. <script type="text/javascript" language="javascript"> var rm = Sys.WebForms.PageRequestManager.getInstance(); rm.add_beginRequest(checkPostback); function checkPostback(sender, args) { var request = args.get_request(); if (rm.get_isInAsyncPostBack() && args.get_postBackElement().id == 'btnSubmit') { | English | Chinese | Japan | Korean | - 67 - Test Information Co., Ltd. All rights reserved.
  • 67.
    request.completed(new Sys.CancelEventArgs()); alert('A previous request is still in progress.'); } } </script> Answer: C 50. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web form in the application by using the following code fragment. (Line numbers are included for reference only.) 01 <script runat="server"> 02 Protected Sub Button_Handler(ByVal sender As Object, _ 03 ByVal e As EventArgs) 04 ' some long-processing operation. 05 End Sub 06 </script> 07 <div> 08 <asp:ScriptManager ID="defaultScriptManager" 09 runat="server" /> 10 11 <asp:UpdatePanel ID="defaultPanel" 12 UpdateMode="Conditional" runat="server"> 13 <ContentTemplate> 14 <!-- more content here --> 15 <asp:Button ID="btnSubmit" runat="server" 16 Text="Submit" OnClick="Button_Handler" /> 17 </ContentTemplate> 18 </asp:UpdatePanel> 19 </div> | English | Chinese | Japan | Korean | - 68 - Test Information Co., Ltd. All rights reserved.
  • 68.
    You plan tocreate a client-side script code by using ASP.NET AJAX. You need to ensure that while a request is being processed, any subsequent Click events on the btnSubmit Button control are suppressed. Which code fragment should you insert at line 10? A. <script type="text/javascript" language="javascript"> var rm = Sys.WebForms.PageRequestManager.getInstance(); rm.add_beginRequest(checkPostback); function checkPostback(sender, args) { if (rm.get_isInAsyncPostBack() && args.get_postBackElement().id == 'btnSubmit') { rm.abortPostBack(); alert('A previous request is still in progress.'); } } </script> B. <script type="text/javascript" language="javascript"> var rm = Sys.WebForms.PageRequestManager.getInstance(); rm.add_initializeRequest(checkPostback); function checkPostback(sender, args) { if (rm.get_isInAsyncPostBack() && args.get_postBackElement().id == 'btnSubmit') { rm.abortPostBack(); alert('A previous request is still in progress.'); } } </script> C. <script type="text/javascript" language="javascript"> var rm = Sys.WebForms.PageRequestManager.getInstance(); rm.add_initializeRequest(checkPostback); | English | Chinese | Japan | Korean | - 69 - Test Information Co., Ltd. All rights reserved.
  • 69.
    function checkPostback(sender, args){ if (rm.get_isInAsyncPostBack() && args.get_postBackElement().id == 'btnSubmit') { args.set_cancel(true); alert('A previous request is still in progress.'); } } </script> D. <script type="text/javascript" language="javascript"> var rm = Sys.WebForms.PageRequestManager.getInstance(); rm.add_beginRequest(checkPostback); function checkPostback(sender, args) { var request = args.get_request(); if (rm.get_isInAsyncPostBack() && args.get_postBackElement().id == 'btnSubmit') { request.completed(new Sys.CancelEventArgs()); alert('A previous request is still in progress.'); } } </script> Answer: C 51. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code segment to create a JavaScript file named CalculatorScript.js. function divide(a, b) { if (b == 0) { var errorMsg = Messages.DivideByZero; alert(errorMsg); return null; | English | Chinese | Japan | Korean | - 70 - Test Information Co., Ltd. All rights reserved.
  • 70.
    } return a/b; } You embedthe CalculatorScript.js file as a resource in a Class Library project. The namespace for this project is Calculator.Resources. The JavaScript function retrieves messages from a resource file named MessageResources.resx by using the JavaScript Messages object. You add an AJAX Web form in the ASP.NET application. You reference the Class Library in the application. You add an ASP.NET AJAX ScriptReference element to the AJAX Web form. You need to ensure that the JavaScript function can access the error messages that are defined in the resource file. Which code segment should you add in the AssemblyInfo.cs file? A. [assembly: ScriptResource ("CalculatorScript", "MessageResources", "Messages")] B. [assembly: ScriptResource ("CalculatorScript.js", "MessageResources.resx", "Messages")] C. [assembly: ScriptResource ("Calculator.Resources.CalculatorScript.js", "Calculator.Resources.MessageResources", "Messages")] D. [assembly: ScriptResource ("Calculator.Resources.CalculatorScript", "Calculator.Resources.MessageResources.resx", "Messages")] Answer: C 52. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code segment to create a JavaScript file named CalculatorScript.js. function divide(a, b) { if (b == 0) { var errorMsg = Messages.DivideByZero; alert(errorMsg); return null; | English | Chinese | Japan | Korean | - 71 - Test Information Co., Ltd. All rights reserved.
  • 71.
    } return a/b; } You embedthe CalculatorScript.js file as a resource in a Class Library project. The namespace for this project is Calculator.Resources. The JavaScript function retrieves messages from a resource file named MessageResources.resx by using the JavaScript Messages object. You add an AJAX Web form in the ASP.NET application. You reference the Class Library in the application. You add an ASP.NET AJAX ScriptReference element to the AJAX Web form. You need to ensure that the JavaScript function can access the error messages that are defined in the resource file. Which code segment should you add in the AssemblyInfo.vb file? A. <assembly: ScriptResource ("CalculatorScript", "MessageResources", "Messages")> B. <assembly: ScriptResource ("CalculatorScript.js", "MessageResources.resx", "Messages")> C. <assembly: ScriptResource ("Calculator.Resources.CalculatorScript.js", "Calculator.Resources.MessageResources", "Messages")> D. <assembly: ScriptResource ("Calculator.Resources.CalculatorScript", "Calculator.Resources.MessageResources.resx", "Messages")> Answer: C 53. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create an AJAX-enabled Web form by using the following code fragment. <asp:ScriptManager ID="scrMgr" runat="server" /> <asp:UpdatePanel runat="server" ID="updFirstPanel" UpdateMode="Conditional"> <ContentTemplate> <asp:TextBox runat="server" ID="txtInfo" /> | English | Chinese | Japan | Korean | - 72 - Test Information Co., Ltd. All rights reserved.
  • 72.
    <asp:Button runat="server" ID="btnSubmit" Text="Submit" /> </ContentTemplate> </asp:UpdatePanel> <asp:UpdatePanel runat="server" ID="updSecondPanel" UpdateMode="Conditional"> <ContentTemplate> ... </ContentTemplate> </asp:UpdatePanel> When the updFirstPanel UpdatePanel control is updated, a dynamic client script is registered. You write the following code segment in the code-behind file of the Web form. (Line numbers are included for reference only.) 01 protected void Page_Load(object sender, EventArgs e) 02 { 03 if(IsPostBack) 04 { 05 string generatedScript = ScriptGenerator.GenerateScript(); 06 07 } 08 } You need to ensure that the client-script code is registered only when an asynchronous postback is issued on the updFirstPanel UpdatePanel control. Which code segment should you insert at line 06? A. ClientScript.RegisterClientScriptBlock(typeof(TextBox), "txtInfo_Script", generatedScript); B. ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "txtInfo_Script", generatedScript, false); C. ClientScript.RegisterClientScriptBlock(typeof(Page), | English | Chinese | Japan | Korean | - 73 - Test Information Co., Ltd. All rights reserved.
  • 73.
    "txtInfo_Script", generatedScript); D. ScriptManager.RegisterClientScriptBlock(txtInfo, typeof(TextBox), "txtInfo_Script", generatedScript, false); Answer: D 54. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create an AJAX-enabled Web form by using the following code fragment. <asp:ScriptManager ID="scrMgr" runat="server" /> <asp:UpdatePanel runat="server" ID="updFirstPanel" UpdateMode="Conditional"> <ContentTemplate> <asp:TextBox runat="server" ID="txtInfo" /> <asp:Button runat="server" ID="btnSubmit" Text="Submit" /> </ContentTemplate> </asp:UpdatePanel> <asp:UpdatePanel runat="server" ID="updSecondPanel" UpdateMode="Conditional"> <ContentTemplate> ... </ContentTemplate> </asp:UpdatePanel> When the updFirstPanel UpdatePanel control is updated, a dynamic client script is registered. You write the following code segment in the code-behind file of the Web form. (Line numbers are included for reference only.) 01 Protected Sub Page_Load(ByVal sender As Object, _ ByVal e As EventArgs) 02 If Not IsPostBack Then 03 Dim generatedScript As String = _ | English | Chinese | Japan | Korean | - 74 - Test Information Co., Ltd. All rights reserved.
  • 74.
    ScriptGenerator.GenerateScript() 04 05 End If 06 End Sub You need to ensure that the client-script code is registered only when an asynchronous postback is issued on the updFirstPanel UpdatePanel control. Which code segment should you insert at line 04? A. ClientScript.RegisterClientScriptBlock(GetType(TextBox), _ "txtInfo_Script", generatedScript) B. ScriptManager.RegisterClientScriptBlock(Me, _ GetType(Page), "txtInfo_Script", generatedScript, False) C. ClientScript.RegisterClientScriptBlock(GetType(Page), _ "txtInfo_Script", generatedScript) D. ScriptManager.RegisterClientScriptBlock(txtInfo, _ GetType(TextBox), "txtInfo_Script", generatedScript, False) Answer: D 55. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application contains the following code segment. public class CapabilityEvaluator { public static bool ChkScreenSize( System.Web.Mobile.MobileCapabilities cap, String arg) { int screenSize = cap.ScreenCharactersWidth * cap.ScreenCharactersHeight; return screenSize < int.Parse(arg); } | English | Chinese | Japan | Korean | - 75 - Test Information Co., Ltd. All rights reserved.
  • 75.
    } You add thefollowing device filter element to the Web.config file. <filter name="FltrScreenSize" type="MyWebApp.CapabilityEvaluator,MyWebApp" method="ChkScreenSize" /> You need to write a code segment to verify whether the size of the device display is less than 80 characters. Which code segment should you use? A. MobileCapabilities currentMobile; currentMobile = Request.Browser as MobileCapabilities; if(currentMobile.HasCapability("FltrScreenSize","80")) { } B. MobileCapabilities currentMobile; currentMobile = Request.Browser as MobileCapabilities; if(currentMobile.HasCapability( "FltrScreenSize","").ToString()=="80") { } C. MobileCapabilities currentMobile; currentMobile = Request.Browser as MobileCapabilities; if (currentMobile.HasCapability( "CapabilityEvaluator.ChkScreenSize", "80")) { } D. MobileCapabilities currentMobile; currentMobile = Request.Browser as MobileCapabilities; if (currentMobile.HasCapability( "CapabilityEvaluator.ChkScreenSize", "").ToString()=="80") | English | Chinese | Japan | Korean | - 76 - Test Information Co., Ltd. All rights reserved.
  • 76.
    { } Answer: A 56. Youcreate a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application contains the following code segment. Public Class CapabilityEvaluator Public Shared Function ChkScreenSize( _ ByVal cap As System.Web.Mobile.MobileCapabilities, _ ByVal arg As String) As Boolean Dim screenSize As Integer = cap.ScreenCharactersWidth * _ cap.ScreenCharactersHeight Return screenSize < Integer.Parse(arg) End Function End Class You add the following device filter element to the Web.config file. <filter name="FltrScreenSize" type="MyWebApp.CapabilityEvaluator,MyWebApp" method="ChkScreenSize" /> You need to write a code segment to verify whether the size of the device display is less than 80 characters. Which code segment should you use? A. Dim currentMobile As MobileCapabilities currentMobile = TryCast(Request.Browser, MobileCapabilities) If currentMobile.HasCapability("FltrScreenSize", "80") Then End If B. Dim currentMobile As MobileCapabilities currentMobile = TryCast(Request.Browser, MobileCapabilities) If currentMobile.HasCapability( _ | English | Chinese | Japan | Korean | - 77 - Test Information Co., Ltd. All rights reserved.
  • 77.
    "FltrScreenSize", "").ToString() ="80" Then End If C. Dim currentMobile As MobileCapabilities currentMobile = TryCast(Request.Browser, MobileCapabilities) If currentMobile.HasCapability( _ "CapabilityEvaluator.ChkScreenSize", "80") Then End If D. Dim currentMobile As MobileCapabilities currentMobile = TryCast(Request.Browser, MobileCapabilities) If currentMobile.HasCapability( _ "CapabilityEvaluator.ChkScreenSize", "").ToString() = "80" Then End If Answer: A 57. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application has a mobile Web form that contains the following ObjectList control. <mobile:ObjectList ID="ObjectListCtrl" OnItemCommand="ObjectListCtrl_ItemCommand" Runat="server"> <Command Name="CmdDisplayDetails" Text="Details" /> <Command Name="CmdRemove" Text="Remove" /> </mobile:ObjectList> You create an event handler named ObjectListCtrl_ItemCommand. You need to ensure that the ObjectListCtrl_ItemCommand handler detects the selection of the CmdDisplayDetails item. Which code segment should you write? A. public void ObjectListCtrl_ItemCommand( object sender, ObjectListCommandEventArgs e) { if (e.CommandName == "CmdDisplayDetails") | English | Chinese | Japan | Korean | - 78 - Test Information Co., Ltd. All rights reserved.
  • 78.
    { } } B. public void ObjectListCtrl_ItemCommand( object sender, ObjectListCommandEventArgs e) { if (e.CommandArgument.ToString() == "CmdDisplayDetails") { } } C. public void ObjectListCtrl_ItemCommand( object sender, ObjectListCommandEventArgs e) { ObjectListCommand cmd = sender as ObjectListCommand; if (cmd.Name == "CmdDisplayDetails") { } } D. public void ObjectListCtrl_ItemCommand( object sender, ObjectListCommandEventArgs e) { ObjectListCommand cmd = e.CommandSource as ObjectListCommand; if (cmd.Name == "CmdDisplayDetails") { } } Answer: A 58. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The | English | Chinese | Japan | Korean | - 79 - Test Information Co., Ltd. All rights reserved.
  • 79.
    application has amobile Web form that contains the following ObjectList control. <mobile:ObjectList ID="ObjectListCtrl" OnItemCommand="ObjectListCtrl_ItemCommand" Runat="server"> <Command Name="CmdDisplayDetails" Text="Details" /> <Command Name="CmdRemove" Text="Remove" /> </mobile:ObjectList> You create an event handler named ObjectListCtrl_ItemCommand. You need to ensure that the ObjectListCtrl_ItemCommand handler detects the selection of the CmdDisplayDetails item. Which code segment should you write? A. Public Sub ObjectListCtrl_ItemCommand( _ ByVal sender As Object, ByVal e As ObjectListCommandEventArgs) If e.CommandName = "CmdDisplayDetails" Then End If End Sub B. Public Sub ObjectListCtrl_ItemCommand( _ ByVal sender As Object, ByVal e As ObjectListCommandEventArgs) If e.CommandArgument.ToString() = "CmdDisplayDetails" Then End If End Sub C. Public Sub ObjectListCtrl_ItemCommand( _ ByVal sender As Object, ByVal e As ObjectListCommandEventArgs) Dim cmd As ObjectListCommand = TryCast(sender, ObjectListCommand) If cmd.Name = "CmdDisplayDetails" Then End If End Sub D. Public Sub ObjectListCtrl_ItemCommand( _ ByVal sender As Object, ByVal e As ObjectListCommandEventArgs) Dim cmd As ObjectListCommand = TryCast( _ | English | Chinese | Japan | Korean | - 80 - Test Information Co., Ltd. All rights reserved.
  • 80.
    e.CommandSource, ObjectListCommand) If cmd.Name = "CmdDisplayDetails" Then End If End Sub Answer: A 59. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. All the content pages in the application use a single master page. The master page uses a static navigation menu to browse the site. You need to ensure that the content pages can optionally replace the static navigation menu with their own menu controls. What should you do? A. ¡¤Add the following code fragment to the master page <asp:PlaceHolder ID="MenuPlaceHolder" runat="server"> <div id="menu"> <!-- Menu code here --> </div> </asp:PlaceHolder> B. ¡¤Add the following code segment to the Page_Load event of the content page PlaceHolder placeHolder = Page.Master.FindControl("MenuPlaceHolder") as PlaceHolder; Menu menuControl = new Menu(); placeHolder.Controls.Add(menuControl); C. ¡¤Add the following code fragment to the master page <asp:ContentPlaceHolder ID="MenuPlaceHolder" runat="server"> <!-- Menu code here --> </asp:ContentPlaceHolder> D. ¡¤Add the following code fragment to the content page <asp:Content ContentPlaceHolderID="MenuPlaceHolder"> | English | Chinese | Japan | Korean | - 81 - Test Information Co., Ltd. All rights reserved.
  • 81.
    <asp:menu ID="menuControl" runat="server"> - < asp m / : enu </asp:Content> E. ¡¤Add the following code fragment to the master page <asp:ContentPlaceHolder ID="MenuPlaceHolder" runat="server"> <!-- Menu code here --> </asp:ContentPlaceHolder> F. ¡¤Add the following code segment to the Page_Load event of the content page ContentPlaceHolder placeHolder = Page.Master.FindControl("MenuPlaceHolder") as ContentPlaceHolder; Menu menuControl = new Menu(); placeHolder.Controls.Add(menuControl); G. ¡¤Add the following code fragment to the master page <asp:PlaceHolder ID="MenuPlaceHolder" runat="server"> <!-- Menu code here --> </asp:PlaceHolder> H. ¡¤Add the following code fragment to the content page <asp:Content PlaceHolderID="MenuPlaceHolder"> <asp:menu ID="menuControl" runat="server"> - < asp m / : enu </asp:Content> Answer: B 60. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. All the content pages in the application use a single master page. The master page uses a static navigation menu to browse the site. You need to ensure that the content pages can optionally replace the static navigation menu with their own menu controls. What should you do? A. ¡¤Add the following code fragment to the mastr page. <asp:PlaceHolder ID="MenuPlaceHolder runat="server"> | English | Chinese | Japan | Korean | - 82 - Test Information Co., Ltd. All rights reserved.
  • 82.
    <div id="menu"> <!-- Menu code here --> </div> </asp:PlaceHolder> B. ¡¤Add the following code segment to the Page_Load event of the content page Dim placeHolder As PlaceHolder = TryCast( _ Page.Master.FindControl("MenuPlaceHolder"), PlaceHolder) Dim menuControl As New Menu() placeHolder.Controls.Add(menuControl) C. ¡¤Add the following code fragment to the master page <asp:ContentPlaceHolder ID="MenuPlaceHolder runat="server"> <!-- Menu code here --> </asp:ContentPlaceHolder> D. ¡¤Add the following code fragment to the content page <asp:Content ContentPlaceHolderID="MenuPlaceHolder"> <asp:menu ID="menuControl" runat="server"> - < asp m / : enu </asp:Content> E. ¡¤Add the following code fragmet to the master page. <asp:ContentPlaceHolder ID="MenuPlaceHolder runat="server"> <!-- Menu code here --> </asp:ContentPlaceHolder> F. ¡¤Add the following code segment to the Page_Load event of the content page Dim placeHolder As ContentPlaceHolder = _ TryCast(Page.Master.FindControl("MenuPlaceHolder"), _ ContentPlaceHolder) Dim menuControl As New Menu() placeHolder.Controls.Add(menuControl) G. ¡¤Add the following code fragment to the master page <asp:PlaceHolder ID="MenuPlaceHolder runat="server"> | English | Chinese | Japan | Korean | - 83 - Test Information Co., Ltd. All rights reserved.
  • 83.
    <!-- Menu codehere --> </asp:PlaceHolder> H. ¡¤Add the following code fragment to the content page <asp:Content PlaceHolderID="MenuPlaceHolder"> <asp:menu ID="menuControl" runat="server"> - < asp m / : enu </asp:Content> Answer: B 61. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application allows users to post comments to a page that can be viewed by other users. You add a SqlDataSource control named SqlDS1. You write the following code segment. (Line numbers are included for reference only.) 01 private void SaveComment() 02 { 03 string ipaddr; 04 05 SqlDS1.InsertParameters["IPAddress"].DefaultValue = ipaddr; 06 ... 07 SqlDS1.Insert(); 08 } You need to ensure that the IP Address of each user who posts a comment is captured along with the user's comment. Which code segment should you insert at line 04? A. ipaddr = Server["REMOTE_ADDR"].ToString(); B. ipaddr = Session["REMOTE_ADDR"].ToString(); C. ipaddr = Application["REMOTE_ADDR"].ToString(); D. ipaddr = Request.ServerVariables["REMOTE_ADDR"].ToString(); Answer: D | English | Chinese | Japan | Korean | - 84 - Test Information Co., Ltd. All rights reserved.
  • 84.
    62. You createa Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application allows users to post comments to a page that can be viewed by other users. You add a SqlDataSource control named SqlDS1. You write the following code segment. (Line numbers are included for reference only.) 01 Private Sub SaveComment() 02 Dim ipaddr As String 03 04 SqlDS1.InsertParameters("IPAddress").DefaultValue = ipaddr 05 ' ... 06 SqlDS1.Insert() 07 End Sub You need to ensure that the IP Address of each user who posts a comment is captured along with the user's comment. Which code segment should you insert at line 03? A. ipaddr = Server("REMOTE_ADDR").ToString() B. ipaddr = Session("REMOTE_ADDR").ToString() C. ipaddr = Application("REMOTE_ADDR").ToString() D. ipaddr = Request.ServerVariables("REMOTE_ADDR").ToString() Answer: D 63. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web page named Default.aspx in the root of the application. You add an ImageResources.resx resource file in the App_GlobalResources folder. The ImageResources.resx file contains a localized resource named LogoImageUrl. You need to retrieve the value of LogoImageUrl. Which code segment should you use? A. string logoImageUrl = (string)GetLocalResource("LogoImageUrl"); B. string logoImageUrl = (string)GetGlobalResource("Default", "LogoImageUrl"); C. string logoImageUrl = (string)GetGlobalResource("ImageResources", "LogoImageUrl"); | English | Chinese | Japan | Korean | - 85 - Test Information Co., Ltd. All rights reserved.
  • 85.
    D. string logoImageUrl= (string)GetLocalResource("ImageResources.LogoImageUrl"); Answer: C 64. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web page named Default.aspx in the root of the application. You add an ImageResources.resx resource file in the App_GlobalResources folder. The ImageResources.resx file contains a localized resource named LogoImageUrl. You need to retrieve the value of LogoImageUrl. Which code segment should you use? A. Dim logoImageUrl As String = DirectCast( _GetLocalResource("LogoImageUrl"), String) B. Dim logoImageUrl As String = DirectCast( _GetGlobalResource("Default", "LogoImageUrl"), String) C. Dim logoImageUrl As String = DirectCast( _GetGlobalResource("ImageResources", "LogoImageUrl"), String) D. Dim logoImageUrl As String = DirectCast( _GetLocalResource("ImageResources.LogoImageUrl"), String) Answer: C 65. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a custom Web user control named SharedControl. The control will be compiled as a library. You write the following code segment for the SharedControl control. (Line numbers are included for reference only.) 01 protected override void OnInit(EventArgs e) 02 { 03 base.OnInit(e); 04 05 } All the master pages in the ASP.NET application contain the following directive. <%@ Master Language="C#" EnableViewState="false" %> You need to ensure that the state of the SharedControl control can persist on the pages that reference a | English | Chinese | Japan | Korean | - 86 - Test Information Co., Ltd. All rights reserved.
  • 86.
    master page. Which codesegment should you insert at line 04? A. Page.RegisterRequiresPostBack(this); B. Page.RegisterRequiresControlState(this); C. Page.UnregisterRequiresControlState(this); D. Page.RegisterStartupScript("SharedControl","server"); Answer: B 66. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a custom Web user control named SharedControl. The control will be compiled as a library. You write the following code segment for the SharedControl control. (Line numbers are included for reference only.) 01 Protected Overloads Overrides Sub OnInit(ByVal e As EventArgs) 02 MyBase.OnInit(e) 03 04 End Sub All the master pages in the ASP.NET application contain the following directive. <%@ Master Language="VB" EnableViewState="false" %> You need to ensure that the state of the SharedControl control can persist on the pages that reference a master page. Which code segment should you insert at line 03? A. Page.RegisterRequiresPostBack(Me) B. Page.RegisterRequiresControlState(Me) C. Page.UnregisterRequiresControlState(Me) D. Page.RegisterStartupScript("SharedControl", "server") Answer: B 67. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web page that has a GridView control named GridView1. The GridView1 control displays the | English | Chinese | Japan | Korean | - 87 - Test Information Co., Ltd. All rights reserved.
  • 87.
    data from adatabase named Region and a table named Location. You write the following code segment to populate the GridView1 control. (Line numbers are included for reference only.) 01 protected void Page_Load(object sender, EventArgs e) 02 { 03 string connstr; 04 05 SqlDependency.Start(connstr); 06 using (SqlConnection connection = 07 new SqlConnection(connstr)) 08 { 09 SqlCommand sqlcmd = new SqlCommand(); 10 DateTime expires = DateTime.Now.AddMinutes(30); 11 SqlCacheDependency dependency = new 12 SqlCacheDependency("Region", "Location"); 13 Response.Cache.SetExpires(expires); 14 Response.Cache.SetValidUntilExpires(true); 15 Response.AddCacheDependency(dependency); 16 17 sqlcmd.Connection = connection; 18 GridView1.DataSource = sqlcmd.ExecuteReader(); 19 GridView1.DataBind(); 20 } 21 } You need to ensure that the proxy servers can cache the content of the GridView1 control. Which code segment should you insert at line 16? A. Response.Cache.SetCacheability(HttpCacheability.Private); B. Response.Cache.SetCacheability(HttpCacheability.Public); C. Response.Cache.SetCacheability(HttpCacheability.Server); | English | Chinese | Japan | Korean | - 88 - Test Information Co., Ltd. All rights reserved.
  • 88.
    D. Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate); Answer: B 68.You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web page that has a GridView control named GridView1. The GridView1 control displays the data from a database named Region and a table named Location. You write the following code segment to populate the GridView1 control. (Line numbers are included for reference only.) 01 Protected Sub Page_Load(ByVal sender As Object, _ ByVal e As EventArgs) 02 Dim connstr As String 03 ... 04 SqlDependency.Start(connstr) 05 Using connection As New SqlConnection(connstr) 06 Dim sqlcmd As New SqlCommand() 07 Dim expires As DateTime = DateTime.Now.AddMinutes(30) 08 Dim dependency As SqlCacheDependency = _ 09 New SqlCacheDependency("Region", "Location") 10 Response.Cache.SetExpires(expires) 11 Response.Cache.SetValidUntilExpires(True) 12 Response.AddCacheDependency(dependency) 13 14 sqlcmd.Connection = connection 15 GridView1.DataSource = sqlcmd.ExecuteReader() 16 GridView1.DataBind() 17 End Using 18 End Sub You need to ensure that the proxy servers can cache the content of the GridView1 control. Which code segment should you insert at line 13? | English | Chinese | Japan | Korean | - 89 - Test Information Co., Ltd. All rights reserved.
  • 89.
    A. Response.Cache.SetCacheability(HttpCacheability.Private) B. Response.Cache.SetCacheability(HttpCacheability.Public) C.Response.Cache.SetCacheability(HttpCacheability.Server) D. Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate) Answer: B 69. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a page that contains the following control. <asp:Calendar EnableViewState="false"ID="calBegin" runat="server" /> You write the following code segment in the code-behind file for the page. void LoadDate(object sender, EventArgs e) { if (IsPostBack) { calBegin.SelectedDate = (DateTime)ViewState["date"]; } } void SaveDate(object sender, EventArgs e) { ViewState["date"] = calBegin.SelectedDate; } You need to ensure that the calBegin Calendar control maintains the selected date. Which code segment should you insert in the constructor of the page? A. this.Load += new EventHandler(LoadDate); this.Unload += new EventHandler(SaveDate); B. this.Init += new EventHandler(LoadDate); this.Unload += new EventHandler(SaveDate); C. this.Init += new EventHandler(LoadDate); this.PreRender += new EventHandler(SaveDate); D. this.Load += new EventHandler(LoadDate); this.PreRender += new EventHandler(SaveDate); | English | Chinese | Japan | Korean | - 90 - Test Information Co., Ltd. All rights reserved.
  • 90.
    Answer: D 70. Youcreate a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a page that contains the following control. <asp:Calendar EnableViewState="false"ID="calBegin" runat="server" /> You write the following code segment in the code-behind file for the page. Private Sub LoadDate(ByVal sender As Object, _ByVal e As EventArgs) If IsPostBack Then calBegin.SelectedDate = _ DirectCast(ViewState("date"), DateTime) End If End Sub Private Sub SaveDate(ByVal sender As Object, _ByVal e As EventArgs) ViewState("date") = calBegin.SelectedDate End Sub You need to ensure that the calBegin Calendar control maintains the selected date. Which code segment should you insert in the constructor of the page? A. AddHandler Me.Load, AddressOf LoadDate AddHandler Me.Unload, AddressOf SaveDate B. AddHandler Me.Init, AddressOf LoadDate AddHandler Me.Unload, AddressOf SaveDate C. AddHandler Me.Init, AddressOf LoadDate AddHandler Me.PreRender, AddressOf SaveDate D. AddHandler Me.Load, AddressOf LoadDate AddHandler Me.PreRender, AddressOf SaveDate Answer: D 71. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a page that contains the following code fragment. | English | Chinese | Japan | Korean | - 91 - Test Information Co., Ltd. All rights reserved.
  • 91.
    <asp:ListBox ID="lstLanguages"AutoPostBack="true" runat="server"/> You write the following code segment in the code-behind file for the page. void BindData(object sender, EventArgs e) { lstLanguages.DataSource = CultureInfo.GetCultures(CultureTypes.AllCultures); lstLanguages.DataTextField = "EnglishName"; lstLanguages.DataBind(); } You need to ensure that the lstLanguages ListBox control maintains the selection of the user during postback. Which line of code should you insert in the constructor of the page? A. this.Init += new EventHandler(BindData); B. this.PreRender += new EventHandler(BindData); C. lstLanguages.PreRender += new EventHandler(BindData); D. lstLanguages.SelectedIndexChanged += new EventHandler(BindData); Answer: A 72. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a page that contains the following code fragment. <asp:ListBox ID="lstLanguages"AutoPostBack="true" runat="server" /> You write the following code segment in the code-behind file for the page. Private Sub BindData(ByVal sender As Object, _ByVal e As EventArgs) lstLanguages.DataSource = _ CultureInfo.GetCultures(CultureTypes.AllCultures) lstLanguages.DataTextField = "EnglishName" lstLanguages.DataBind() End Sub You need to ensure that the lstLanguages ListBox control maintains the selection of the user during postback. | English | Chinese | Japan | Korean | - 92 - Test Information Co., Ltd. All rights reserved.
  • 92.
    Which line ofcode should you insert in the constructor of the page? A. AddHandler Me.Init, AddressOf BindData B. AddHandler Me.PreRender, AddressOf BindData C. AddHandler lstLanguages.PreRender, AddressOf BindData D. AddHandler lstLanguages.SelectedIndexChanged, AddressOf BindData Answer: A 73. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application runs on Microsoft IIS 6.0. You create a page named oldPage.aspx. You need to ensure that the following requirements are met when a user attempts to access the page: ¡¤The browser diplays the URL of the oldPage.aspx page. ¡¤The browser displays the page named newPage.aspx Which code segment should you use? A. Server.Transfer("newPage.aspx"); B. Response.Redirect("newPage.aspx"); C. if (Request.Url.UserEscaped) { Server.TransferRequest("newPage.aspx"); } else { Response.Redirect("newPage.aspx", true); } D. if (Request.Url.UserEscaped) { Response.RedirectLocation = "oldPage.aspx"; Response.Redirect("newPage.aspx", true); } else { Response.Redirect("newPage.aspx"); } | English | Chinese | Japan | Korean | - 93 - Test Information Co., Ltd. All rights reserved.
  • 93.
    Answer: A 74. Youcreate an application by using the Microsoft .NET Framework 3.5 and Microsoft ASP.NET. The application runs on Microsoft IIS 6.0. You create a page named oldPage.aspx. You need to ensure that the following requirements are met when a user attempts to access the page: ¡¤The browser displays the URL of the oldPage.aspx page ¡¤The browser displays the page named newPage.aspx Which code segment should you use? A. Server.Transfer("newPage.aspx") B. Response.Redirect("newPage.aspx") C. If Request.Url.UserEscaped Then Server.TransferRequest("newPage.aspx") Else Response.Redirect("newPage.aspx", True) End If D. If Request.Url.UserEscaped Then Response.RedirectLocation = "oldPage.aspx" Response.Redirect("newPage.aspx", True) Else Response.Redirect("newPage.aspx") End If Answer: A 75. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web page named enterName.aspx. The Web page contains a TextBox control named txtName. The Web page cross posts to a page named displayName.aspx that contains a Label control named lblName. You need to ensure that the lblName Label control displays the text that was entered in the txtName | English | Chinese | Japan | Korean | - 94 - Test Information Co., Ltd. All rights reserved.
  • 94.
    TextBox control. Which codesegment should you use? A. lblName.Text = Request.QueryString["txtName"]; B. TextBox txtName = FindControl("txtName") as TextBox; lblName.Text = txtName.Text; C. TextBox txtName = Parent.FindControl("txtName") as TextBox; lblName.Text = txtName.Text; D. TextBox txtName = PreviousPage.FindControl("txtName") as TextBox; lblName.Text = txtName.Text; Answer: D 76. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web page named enterName.aspx. The Web page contains a TextBox control named txtName. The Web page cross posts to a page named displayName.aspx that contains a Label control named lblName. You need to ensure that the lblName Label control displays the text that was entered in the txtName TextBox control. Which code segment should you use? A. lblName.Text = Request.QueryString("txtName") B. Dim txtName As TextBox = _TryCast(FindControl("txtName"), TextBox) lblName.Text = txtName.Text C. Dim txtName As TextBox = _TryCast(Parent.FindControl("txtName"), TextBox) lblName.Text = txtName.Text D. Dim txtName As TextBox = _TryCast(PreviousPage.FindControl("txtName"), TextBox) lblName.Text = txtName.Text Answer: D 77. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code segment to create a class named MultimediaDownloader that implements the | English | Chinese | Japan | Korean | - 95 - Test Information Co., Ltd. All rights reserved.
  • 95.
    IHttpHandler interface. namespace Contoso.Web.UI { public class MultimediaDownloader : IHttpHandler { ... } } The MultimediaDownloader class performs the following tasks: ¡¤It returns the content of the multimedia files from the Web server ¡¤It processes requests for the files that have the .media file extension The .media file extension is mapped to the aspnet_isapi.dll file in Microsoft IIS 6.0. You need to configure the MultimediaDownloader class in the Web.config file of the application. Which code fragment should you use? A. <httpHandlers> <add verb="*.media" path="*" validate="false" type="Contoso.Web.UI.MultimediaDownloader" /> </httpHandlers> B. <httpHandlers> <add verb="HEAD" path="*.media" validate="true" type="Contoso.Web.UI.MultimediaDownloader" /> </httpHandlers> C. <httpHandlers> <add verb="*" path="*.media" validate="false" type="Contoso.Web.UI.MultimediaDownloader" /> </httpHandlers> D. <httpHandlers> <add verb="GET,POST" path="*" validate="true" type="Contoso.Web.UI.MultimediaDownloader" /> | English | Chinese | Japan | Korean | - 96 - Test Information Co., Ltd. All rights reserved.
  • 96.
    </httpHandlers> Answer: C 78. Youcreate a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code segment to create a class named MultimediaDownloader that implements the IHttpHandler interface. Namespace Contoso.Web.UI Public Class MultimediaDownloader Implements IHttpHandler ... End Class End Namespace The MultimediaDownloader class performs the following tasks: ¡¤It returns the content of the multimedia files from the Web server ¡¤It processes requests for the files that have the .media file extension The .media file extension is mapped to the aspnet_isapi.dll file in Microsoft IIS 6.0. You need to configure the MultimediaDownloader class in the Web.config file of the application. Which code fragment should you use? A. <httpHandlers> <add verb="*.media" path="*" validate="false" type="Contoso.Web.UI.MultimediaDownloader" /> </httpHandlers> B. <httpHandlers> <add verb="HEAD" path="*.media" validate="true" type="Contoso.Web.UI.MultimediaDownloader" /> </httpHandlers> C. <httpHandlers> <add verb="*" path="*.media" validate="false" type="Contoso.Web.UI.MultimediaDownloader" /> | English | Chinese | Japan | Korean | - 97 - Test Information Co., Ltd. All rights reserved.
  • 97.
    </httpHandlers> D. <httpHandlers> <add verb="GET,POST" path="*" validate="true" type="Contoso.Web.UI.MultimediaDownloader" /> </httpHandlers> Answer: C 79. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a class that implements the IHttpHandler interface. You implement the ProcessRequest method by using the following code segment. (Line numbers are included for reference only.) 01 public void ProcessRequest(HttpContext ctx) { 02 03 } You need to ensure that the image named Alert.jpg is displayed in the browser when the handler is requested. Which code segment should you insert at line 02? A. StreamReader sr = new StreamReader(File.OpenRead(ctx.Server.MapPath("Alert.jpg"))); ctx.Response.Pics(sr.ReadToEnd()); sr.Close(); B. StreamReader sr = new StreamReader(File.OpenRead(ctx.Server.MapPath("Alert.jpg"))); ctx.Response.Pics("image/jpg"); ctx.Response.TransmitFile(sr.ReadToEnd()); sr.Close(); C. ctx.Response.ContentType = "image/jpg"; FileStream fs = File.OpenRead(ctx.Server.MapPath("Alert.jpg")); int b; while ((b = fs.ReadByte()) != -1) { ctx.Response.OutputStream.WriteByte((byte)b); } | English | Chinese | Japan | Korean | - 98 - Test Information Co., Ltd. All rights reserved.
  • 98.
    fs.Close(); D. ctx.Response.TransmitFile("image/jpg"); FileStream fs= File.OpenRead(ctx.Server.MapPath("Alert.jpg")); int b; while ((b = fs.ReadByte()) != -1) { ctx.Response.OutputStream.WriteByte((byte)b); } fs.Close(); Answer: C 80. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a class that implements the IHttpHandler interface. You implement the ProcessRequest method by using the following code segment. (Line numbers are included for reference only.) 01 Public Sub ProcessRequest(ByVal ctx As HttpContext) 02 03 End Sub You need to ensure that the image named Alert.jpg is displayed in the browser when the handler is requested. Which code segment should you insert at line 02? A. Dim sr As New StreamReader( _File.OpenRead(ctx.Server.MapPath("Alert.jpg"))) ctx.Response.Pics(sr.ReadToEnd()) sr.Close() B. Dim sr As New StreamReader( _File.OpenRead(ctx.Server.MapPath("Alert.jpg"))) ctx.Response.Pics("image/jpg") ctx.Response.TransmitFile(sr.ReadToEnd()) sr.Close() C. ctx.Response.ContentType = "image/jpg" Dim fs As FileStream = File.OpenRead( _ctx.Server.MapPath("Alert.jpg")) Dim b As Integer | English | Chinese | Japan | Korean | - 99 - Test Information Co., Ltd. All rights reserved.
  • 99.
    While (b =fs.ReadByte()) <> -1 ctx.Response.OutputStream.WriteByte(CByte(b)) End While Fs.Close() D. ctx.Response.TransmitFile("image/jpg") Dim fs As FileStream = File.OpenRead( _ctx.Server.MapPath("Alert.jpg")) Dim b As Integer While (b = fs.ReadByte()) <> -1 ctx.Response.OutputStream.WriteByte(CByte(b)) End While Fs.Close() Answer: C 81. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. The computer that hosts the ASP.NET Web application contains a local instance of Microsoft SQL Server 2005. The instance uses Windows Authentication. You plan to configure the membership providers and the role management providers. You need to install the database elements for both the providers on the local computer. What should you do? A. Run the sqlcmd.exe -S localhost E command from the command line. B. Run the aspnet_regiis.exe -s localhost command from the command line. C. Run the sqlmetal.exe /server:localhost command from the command line. D. Run the aspnet_regsql.exe -E -S localhost -A mr command from the command line. Answer: D 82. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. The computer that hosts the ASP.NET Web application contains a local instance of Microsoft SQL Server 2005. The instance uses Windows Authentication. You plan to configure the membership providers and the role management providers. | English | Chinese | Japan | Korean | - 100 - Test Information Co., Ltd. All rights reserved.
  • 100.
    You need toinstall the database elements for both the providers on the local computer. What should you do? A. Run the sqlcmd.exe -S localhost E command from the command line. B. Run the aspnet_regiis.exe -s localhost command from the command line. C. Run the sqlmetal.exe /server:localhost command from the command line. D. Run the aspnet_regsql.exe -E -S localhost -A mr command from the command line. Answer: D 83. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. You use Windows Authentication for the application. You set up NTFS file system permissions for the Sales group to access a particular file. You discover that all the users are able to access the file. You need to ensure that only the Sales group users can access the file. What additional step should you perform? A. Remove the rights from the ASP.NET user to the file. B. Remove the rights from the application pool identity to the file. C. Add the <identity impersonate="true"/> section to the Web.config file. D. Add the <authentication mode="[None]"> section to the Web.config file. Answer: C 84. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. You use Windows Authentication for the application. You set up NTFS file system permissions for the Sales group to access a particular file. You discover that all the users are able to access the file. You need to ensure that only the Sales group users can access the file. What additional step should you perform? A. Remove the rights from the ASP.NET user to the file. B. Remove the rights from the application pool identity to the file. C. Add the <identity impersonate="true"/> section to the Web.config file. D. Add the <authentication mode="[None]"> section to the Web.config file. Answer: C | English | Chinese | Japan | Korean | - 101 - Test Information Co., Ltd. All rights reserved.
  • 101.
    85. You createa Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. You plan to set up authentication for the Web application. The application must support users from untrusted domains. You need to ensure that anonymous users cannot access the application. Which code fragment should you add to the Web.config file? A. <system.web> <authentication mode="Forms"> <forms loginUrl="login.aspx" /> </authentication> <authorization> <deny users="?" /> </authorization> </system.web> B. <system.web> <authentication mode="Forms"> <forms loginUrl="login.aspx" /> </authentication> <authorization> <deny users="*" /> </authorization> </system.web> C. <system.web> <authentication mode="Windows"> </authentication> <authorization> <deny users="?" /> </authorization> </system.web> | English | Chinese | Japan | Korean | - 102 - Test Information Co., Ltd. All rights reserved.
  • 102.
    D. <system.web> <authentication mode="Windows"> </authentication> <authorization> <deny users="*" /> </authorization> </system.web> Answer: A 86. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. You plan to set up authentication for the Web application. The application must support users from untrusted domains. You need to ensure that anonymous users cannot access the application. Which code fragment should you add to the Web.config file? A. <system.web> <authentication mode="Forms"> <forms loginUrl="login.aspx" /> </authentication> <authorization> <deny users="?" /> </authorization> </system.web> B. <system.web> <authentication mode="Forms"> <forms loginUrl="login.aspx" /> </authentication> <authorization> <deny users="*" /> </authorization> | English | Chinese | Japan | Korean | - 103 - Test Information Co., Ltd. All rights reserved.
  • 103.
    </system.web> C. <system.web> <authentication mode="Windows"> </authentication> <authorization> <deny users="?" /> </authorization> </system.web> D. <system.web> <authentication mode="Windows"> </authentication> <authorization> <deny users="*" /> </authorization> </system.web> Answer: A 87. You are maintaining a Microsoft ASP.NET Web Application that was created by using the Microsoft .NET Framework version 3.5. You obtain the latest version of the project from the source control repository. You discover that an assembly reference is missing when you attempt to compile the project on your computer. You need to compile the project on your computer. What should you do? A. Add a reference path in the property pages of the project to the location of the missing assembly. B. Add a working directory in the property pages of the project to the location of the missing assembly. C. Change the output path in the property pages of the project to the location of the missing assembly. D. Delete the assembly reference. Add a reference to the missing assembly by browsing for it on your computer. Answer: A | English | Chinese | Japan | Korean | - 104 - Test Information Co., Ltd. All rights reserved.
  • 104.
    88. You aremaintaining a Microsoft ASP.NET Web Application that was created by using the Microsoft .NET Framework version 3.5. You obtain the latest version of the project from the source control repository. You discover that an assembly reference is missing when you attempt to compile the project on your computer. You need to compile the project on your computer. What should you do? A. Add a reference path in the property pages of the project to the location of the missing assembly. B. Add a working directory in the property pages of the project to the location of the missing assembly. C. Change the output path in the property pages of the project to the location of the missing assembly. D. Delete the assembly reference. Add a reference to the missing assembly by browsing for it on your computer. Answer: A 89. You have a Microsoft ASP.NET Framework version 1.0 application. The application does not use any features that are deprecated in the Microsoft .NET Framework version 3.5. The application runs on Microsoft IIS 6.0. You need to configure the application to use the ASP.NET Framework version 3.5 without recompiling the application. What should you do? A. Edit the ASP.NET runtime version in IIS 6.0. B. Edit the System.Web section handler version number in the machine.config file. C. Add the requiredRuntime configuration element to the Web.config file and set the version attribute to v3.5. D. Add the supportedRuntime configuration element in the Web.config file and set the version attribute to v3.5. Answer: A 90. You have a Microsoft ASP.NET Framework version 1.0 application. The application does not use any | English | Chinese | Japan | Korean | - 105 - Test Information Co., Ltd. All rights reserved.
  • 105.
    features that aredeprecated in the Microsoft .NET Framework version 3.5. The application runs on Microsoft IIS 6.0. You need to configure the application to use the ASP.NET Framework version 3.5 without recompiling the application. What should you do? A. Edit the ASP.NET runtime version in IIS 6.0. B. Edit the System.Web section handler version number in the machine.config file. C. Add the requiredRuntime configuration element to the Web.config file and set the version attribute to v3.5. D. Add the supportedRuntime configuration element in the Web.config file and set the version attribute to v3.5. Answer: A 91. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. The application uses ASP.NET AJAX, and you plan to deploy it in a Web farm environment. You need to configure SessionState for the application. Which code fragment should you use? A. <sessionState mode="InProc"cookieless="UseCookies"/> B. <sessionState mode="InProc"cookieless="UseDeviceProfile"/> C. <sessionState mode="SQLServer"cookieless="false"sqlConnectionString="Integrated Security=SSPI;data source=MySqlServer;"/> D. <sessionState mode="SQLServer"cookieless="UseUri"sqlConnectionString="Integrated Security=SSPI;data source=MySqlServer;"/> Answer: C 92. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. The application uses ASP.NET AJAX, and you plan to deploy it in a Web farm environment. You need to configure SessionState for the application. Which code fragment should you use? | English | Chinese | Japan | Korean | - 106 - Test Information Co., Ltd. All rights reserved.
  • 106.
    A. <sessionState mode="InProc"cookieless="UseCookies"/> B.<sessionState mode="InProc"cookieless="UseDeviceProfile"/> C. <sessionState mode="SQLServer"cookieless="false"sqlConnectionString="Integrated Security=SSPI;data source=MySqlServer;"/> D. <sessionState mode="SQLServer"cookieless="UseUri"sqlConnectionString="Integrated Security=SSPI;data source=MySqlServer;"/> Answer: C 93. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. You deploy the application on a Microsoft IIS 6.0 Web server. The server runs on a worker process isolation mode, and it hosts the .NET Framework version 1.1 Web applications. When you attempt to browse the application, the following error message is received: "It is not possible to run different versions of ASP.NET in the same IIS process. Please use the IIS Administration Tool to reconfigure your server to run the application in a separate process." You need to ensure that the following requirements are met: ¡¤All the applications run on the server ¡¤All the applications remain in process isolation mode ¡¤All the applications do not change their configuration. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) A. Create a new application pool and add the new application to the pool. B. Configure the IIS 6.0 to run the WWW service in the IIS 5.0 isolation mode. C. Configure the new application to use the .NET Framework version 2.0 in the IIS 6.0 Manager. D. Set autoConfig="false" on the <processModel> property in the machine.config file. E. Disable the Recycle worker processes option in the Application Pool Properties dialog box. Answer: AC 94. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. You deploy the application on a Microsoft IIS 6.0 Web server. The server runs on a worker process isolation mode, and it hosts the .NET Framework version 1.1 Web applications. | English | Chinese | Japan | Korean | - 107 - Test Information Co., Ltd. All rights reserved.
  • 107.
    When you attemptto browse the application, the following error message is received: "It is not possible to run different versions of ASP.NET in the same IIS process. Please use the IIS Administration Tool to reconfigure your server to run the application in a separate process." You need to ensure that the following requirements are met: ¡¤All the applications run on the server ¡¤All the applications remain in process isolation mode ¡¤All the applicatios do not change their configurations. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) A. Create a new application pool and add the new application to the pool. B. Configure the IIS 6.0 to run the WWW service in the IIS 5.0 isolation mode. C. Configure the new application to use the .NET Framework version 2.0 in the IIS 6.0 Manager. D. Set autoConfig="false" on the <processModel> property in the machine.config file. E. Disable the Recycle worker processes option in the Application Pool Properties dialog box. Answer: AC 95. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application has a Web form file named MovieReviews.aspx. The MovieReviews.aspx file connects to a LinqDataSource DataSource named LinqDataSource1 that has a primary key named MovieID. The application has a DetailsView control named DetailsView1. The MovieReviews.aspx file contains the following code fragment. (Line numbers are included for reference only.) 01 <asp:DetailsView ID="DetailsView1" runat="server" 02 DataSourceID="LinqDataSource1" 03 04 /> 05 <Fields> 06 <asp:BoundField DataField="MovieID" HeaderText="MovieID" 07 InsertVisible="False" | English | Chinese | Japan | Korean | - 108 - Test Information Co., Ltd. All rights reserved.
  • 108.
    08 ReadOnly="True" SortExpression="MovieID" /> 09 <asp:BoundField DataField="Title" HeaderText="Title" 10 SortExpression="Title" /> 11 <asp:BoundField DataField="Theater" HeaderText="Theater" 12 SortExpression="Theater" /> 13 <asp:CommandField ShowDeleteButton="false" 14 ShowEditButton="True" ShowInsertButton="True" /> 15 </Fields> 16 </asp:DetailsView> You need to ensure that the users can insert and update content in the DetailsView1 control. You also need to prevent duplication of the link button controls for the Edit and New operations. Which code segment should you insert at line 03? A. AllowPaging="false" AutoGenerateRows="false" B. AllowPaging="true" AutoGenerateRows="false" DataKeyNames="MovieID" C. AllowPaging="true" AutoGenerateDeleteButton="false" AutoGenerateEditButton="true" AutoGenerateInsertButton="true" AutoGenerateRows="false" D. AllowPaging="false" AutoGenerateDeleteButton="false" AutoGenerateEditButton="true" AutoGenerateInsertButton="true" AutoGenerateRows="false" DataKeyNames="MovieID" Answer: B | English | Chinese | Japan | Korean | - 109 - Test Information Co., Ltd. All rights reserved.
  • 109.
    96. You createa Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application has a Web form file named MovieReviews.aspx. The MovieReviews.aspx file connects to a LinqDataSource DataSource named LinqDataSource1 that has a primary key named MovieID. The application has a DetailsView control named DetailsView1. The MovieReviews.aspx file contains the following code fragment. (Line numbers are included for reference only.) 01 <asp:DetailsView ID="DetailsView1" runat="server" 02 DataSourceID="LinqDataSource1" 03 04 /> 05 <Fields> 06 <asp:BoundField DataField="MovieID" HeaderText="MovieID" 07 InsertVisible="False" 08 ReadOnly="True" SortExpression="MovieID" /> 09 <asp:BoundField DataField="Title" HeaderText="Title" 10 SortExpression="Title" /> 11 <asp:BoundField DataField="Theater" HeaderText="Theater" 12 SortExpression="Theater" /> 13 <asp:CommandField ShowDeleteButton="false" 14 ShowEditButton="True" ShowInsertButton="True" /> 15 </Fields> 16 </asp:DetailsView> You need to ensure that the users can insert and update content in the DetailsView1 control. You also need to prevent duplication of the link button controls for the Edit and New operations. Which code segment should you insert at line 03? A. AllowPaging="false" AutoGenerateRows="false" | English | Chinese | Japan | Korean | - 110 - Test Information Co., Ltd. All rights reserved.
  • 110.
    B. AllowPaging="true" AutoGenerateRows="false" DataKeyNames="MovieID" C. AllowPaging="true" AutoGenerateDeleteButton="false" AutoGenerateEditButton="true" AutoGenerateInsertButton="true" AutoGenerateRows="false" D.AllowPaging="false" AutoGenerateDeleteButton="false" AutoGenerateEditButton="true" AutoGenerateInsertButton="true" AutoGenerateRows="false" DataKeyNames="MovieID" Answer: B 97. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a custom-templated server control. You need to ensure that the child controls of the server control are uniquely identified within the control hierarchy of the page. Which interface should you implement? A. the ITemplatable interface B. the INamingContainer interface C. the IRequiresSessionState interface D. the IPostBackDataHandler interface Answer: B 98. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a custom-templated server control. | English | Chinese | Japan | Korean | - 111 - Test Information Co., Ltd. All rights reserved.
  • 111.
    You need toensure that the child controls of the server control are uniquely identified within the control hierarchy of the page. Which interface should you implement? A. the ITemplatable interface B. the INamingContainer interface C. the IRequiresSessionState interface D. the IPostBackDataHandler interface Answer: B 99. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code fragment. (Line numbers are included for reference only.) 01 <asp:RequiredFieldValidator 02 ID="rfValidator1" runat="server" 03 Display="Dynamic" ControlToValidate="TextBox1" 04 05 > 06 07 </asp:RequiredFieldValidator> 08 09 <asp:ValidationSummary DisplayMode="List" 10 ID="ValidationSummary1" runat="server" /> You need to ensure that the error message displayed in the validation control is also displayed in the validation summary list. What should you do? A. Add the following code segment to line 06. Required text in TextBox1 B. Add the following code segment to line 04. Text="Required text in TextBox1" C. Add the following code segment to line 04. | English | Chinese | Japan | Korean | - 112 - Test Information Co., Ltd. All rights reserved.
  • 112.
    ErrorMessage="Required text inTextBox1" D. Add the following code segment to line 04. Text="Required text in TextBox1" ErrorMessage="ValidationSummary1" Answer: C 100. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code fragment. (Line numbers are included for reference only.) 01 <asp:RequiredFieldValidator 02 ID="rfValidator1" runat="server" 03 Display="Dynamic" ControlToValidate="TextBox1" 04 05 > 06 07 </asp:RequiredFieldValidator> 08 09 <asp:ValidationSummary DisplayMode="List" 10 ID="ValidationSummary1" runat="server" /> You need to ensure that the error message displayed in the validation control is also displayed in the validation summary list. What should you do? A. Add the following code segment to line 06. Required text in TextBox1 B. Add the following code segment to line 04. Text="Required text in TextBox1" C. Add the following code segment to line 04. ErrorMessage="Required text in TextBox1" D. Add the following code segment to line 04. Text="Required text in TextBox1" ErrorMessage="ValidationSummary1" Answer: C | English | Chinese | Japan | Korean | - 113 - Test Information Co., Ltd. All rights reserved.
  • 113.
    101. You createa Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You plan to submit text that contains HTML code to a page in the application. You need to ensure that the HTML code can be submitted successfully without affecting other applications that run on the Web server. What should you do? A. Add the following attribute to the @Page directive. EnableEventValidation="true" B. Add the following attribute to the @Page directive. ValidateRequest="true" C. Set the following value in the Web.config file. <system.web> <pages validateRequest="false"/> </system.web> D. Set the following value in the Machine.config file. <system.web> <pages validateRequest="false"/> </system.web> Answer: C 102. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You plan to submit text that contains HTML code to a page in the application. You need to ensure that the HTML code can be submitted successfully without affecting other applications that run on the Web server. What should you do? A. Add the following attribute to the @Page directive. EnableEventValidation="true" B. Add the following attribute to the @Page directive. ValidateRequest="true" | English | Chinese | Japan | Korean | - 114 - Test Information Co., Ltd. All rights reserved.
  • 114.
    C. Set thefollowing value in the Web.config file. <system.web> <pages validateRequest="false"/> </system.web> D. Set the following value in the Machine.config file. <system.web> <pages validateRequest="false"/> </system.web> Answer: C 103. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application consumes an ASMX Web service. The Web service is hosted at the following URL. http://www.contoso.com/TemperatureService/Convert.asmx You need to ensure that the client computers can communicate with the service as part of the <system.serviceModel> configuration. Which code fragment should you use? A. <client> <endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx" binding="wsHttpBinding" -/ </client> B. <client> <endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx" binding="basicHttpBinding" -/ </client> C. <client> <endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx" binding="ws2007HttpBinding" -/ | English | Chinese | Japan | Korean | - 115 - Test Information Co., Ltd. All rights reserved.
  • 115.
    </client> D. <client> <endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx" binding="wsDualHttpBinding" -/ </client> Answer: B 104. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application consumes an ASMX Web service. The Web service is hosted at the following URL. http://www.contoso.com/TemperatureService/Convert.asmx You need to ensure that the client computers can communicate with the service as part of the <system.serviceModel> configuration. Which code fragment should you use? A. <client> <endpoint address=" http: //www.contoso.com/TemperatureService/Convert.asmx" binding="wsHttpBinding" -/ </client> B. <client> <endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx" binding="basicHttpBinding" -/ </client> C. <client> <endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx" binding="ws2007HttpBinding" -/ </client> D. <client> <endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx" | English | Chinese | Japan | Korean | - 116 - Test Information Co., Ltd. All rights reserved.
  • 116.
    binding="wsDualHttpBinding" -/ </client> Answer: B 105. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a file named movies.xml that contains the following code fragment. <Movies> <Movie ID="1" Name="Movie1" Year="2006"> <Desc Value="Movie desc"/> </Movie> <Movie ID="2" Name="Movie2" Year="2007"> <Desc Value="Movie desc"/> </Movie> <Movie ID="3" Name="Movie3" Year="2008"> <Desc Value="Movie desc"/> </Movie> </Movies> You add a Web form to the application. You write the following code segment in the Web form. (Line numbers are included for reference only.) 01 <form runat="server"> 02 <asp:xmldatasource 03 id="XmlDataSource1" 04 runat="server" 05 datafile="movies.xml" /> 06 07 </form> You need to implement the XmlDataSource control to display the XML data in a TreeView control. Which code segment should you insert at line 06? A. <asp:TreeView ID="TreeView1" runat="server"DataSourceID="XmlDataSource1"> | English | Chinese | Japan | Korean | - 117 - Test Information Co., Ltd. All rights reserved.
  • 117.
    <DataBindings> <asp:TreeNodeBinding DataMember="Movie" Text="Name" /> </DataBindings> </asp:TreeView> B. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1"> <DataBindings> <asp:TreeNodeBinding DataMember="Movies" Text="Desc" /> </DataBindings> </asp:TreeView> C. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="MovDataSource1"> <DataBindings> <asp:TreeNodeBinding DataMember="Movie" Text="Name" /> </DataBindings> </asp:TreeView> D. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="MovDataSource1"> <DataBindings> <asp:TreeNodeBinding DataMember="Movies" Text="Desc" /> </DataBindings> </asp:TreeView> Answer: A 106. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a file named movies.xml that contains the following code fragment. <Movies> <Movie ID="1" Name="Movie1" Year="2006"> <Desc Value="Movie desc"/> </Movie> <Movie ID="2" Name="Movie2" Year="2007"> <Desc Value="Movie desc"/> | English | Chinese | Japan | Korean | - 118 - Test Information Co., Ltd. All rights reserved.
  • 118.
    </Movie> <MovieID="3" Name="Movie3" Year="2008"> <Desc Value="Movie desc"/> </Movie> </Movies> You add a Web form to the application. You write the following code segment in the Web form. (Line numbers are included for reference only.) 01 <form runat="server"> 02 <asp:xmldatasource 03 id="XmlDataSource1" 04 runat="server" 05 datafile="movies.xml" /> 06 07 </form> You need to implement the XmlDataSource control to display the XML data in a TreeView control. Which code segment should you insert at line 06? A. <asp:TreeView ID="TreeView1" runat="server"DataSourceID="XmlDataSource1"> <DataBindings> <asp:TreeNodeBinding DataMember="Movie" Text="Name" /> </DataBindings> </asp:TreeView> B. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1"> <DataBindings> <asp:TreeNodeBinding DataMember="Movies" Text="Desc" /> </DataBindings> </asp:TreeView> C. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="MovDataSource1"> <DataBindings> <asp:TreeNodeBinding DataMember="Movie" Text="Name" /> | English | Chinese | Japan | Korean | - 119 - Test Information Co., Ltd. All rights reserved.
  • 119.
    </DataBindings> </asp:TreeView> D. <asp:TreeView ID="TreeView1"runat="server" DataSourceID="MovDataSource1"> <DataBindings> <asp:TreeNodeBinding DataMember="Movies" Text="Desc" /> </DataBindings> </asp:TreeView> Answer: A 107. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a FormView control to access the results of a query. The query contains the following fields: ¡¤EmployeeI ¡¤FirstNam ¡¤LastNam The user must be able to view and update the FirstName field. You need to define the control definition for the FirstName field in the FormView control. Which code fragment should you use? A. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text="<%# Bind("FirstName") %>" /> B. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text="<%# Eval("FirstName") %>" /> C. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text='<%# Bind("FirstName") %>' /> D. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text='<%# Eval("FirstName") %>' /> Answer: C 108. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a FormView control to access the results of a query. The query contains the following fields: ¡¤EmployeID ¡¤FirstNam ¡¤LastNam The user must be able to view and update the FirstName field. | English | Chinese | Japan | Korean | - 120 - Test Information Co., Ltd. All rights reserved.
  • 120.
    You need todefine the control definition for the FirstName field in the FormView control. Which code fragment should you use? A. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text="<%# Bind("FirstName") %>" /> B. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text="<%# Eval("FirstName") %>" /> C. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text='<%# Bind("FirstName") %>' /> D. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text='<%# Eval("FirstName") %>' /> Answer: C 109. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application contains a DataSourceControl named CategoriesDataSource that is bound to a Microsoft SQL Server 2005 table. The CategoryName column is the primary key of the table. You write the following code fragment in a FormView control. (Line numbers are included for reference only.) 01 <tr> 02 <td align="right"><b>Category:</b></td> 03 <td><asp:DropDownList ID="InsertCategoryDropDownList" 04 05 DataSourceID="CategoriesDataSource" 06 DataTextField="CategoryName" 07 DataValueField="CategoryID" 08 RunAt="Server" /> 09 </td> 10 </tr> You need to ensure that the changes made to the CategoryID field can be written to the database. Which code fragment should you insert at line 04? A. SelectedValue='<%# Eval("CategoryID") %>' B. SelectedValue='<%# Bind("CategoryID") %>' C. SelectedValue='<%# Eval("CategoryName") %>' D. SelectedValue='<%# Bind("CategoryName") %>' | English | Chinese | Japan | Korean | - 121 - Test Information Co., Ltd. All rights reserved.
  • 121.
    Answer: B 110. Youcreate a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application contains a DataSourceControl named CategoriesDataSource that is bound to a Microsoft SQL Server 2005 table. The CategoryName column is the primary key of the table. You write the following code fragment in a FormView control. (Line numbers are included for reference only.) 01 <tr> 02 <td align="right"><b>Category:</b></td> 03 <td><asp:DropDownList ID="InsertCategoryDropDownList" 04 05 DataSourceID="CategoriesDataSource" 06 DataTextField="CategoryName" 07 DataValueField="CategoryID" 08 RunAt="Server" /> 09 </td> 10 </tr> You need to ensure that the changes made to the CategoryID field can be written to the database. Which code fragment should you insert at line 04? A. SelectedValue='<%# Eval("CategoryID") %>' B. SelectedValue='<%# Bind("CategoryID") %>' C. SelectedValue='<%# Eval("CategoryName") %>' D. SelectedValue='<%# Bind("CategoryName") %>' Answer: B 111. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web page to display photos and captions. The caption of each photo in the database can be modified by using the application. You write the following code fragment. | English | Chinese | Japan | Korean | - 122 - Test Information Co., Ltd. All rights reserved.
  • 122.
    <asp:FormView DataSourceID="ObjectDataSource1" DataKeyNames="PhotoID"runat="server"> <EditItemTemplate> <asp:TextBox Text='<%# Bind("Caption") %>' runat="server"/> <asp:Button Text="Update" CommandName="Update" runat="server"/> <asp:Button Text="Cancel" CommandName="Cancel" runat="server"/> </EditItemTemplate> <ItemTemplate> <asp:Label Text='<%# Eval("Caption") %>' runat="server" /> <asp:Button Text="Edit" CommandName="Edit" runat="server"/> </ItemTemplate> </asp:FormView> When you access the Web page, the application throws an error. You need to ensure that the application successfully updates each caption and stores it in the database. What should you do? A. Add the ID attribute to the Label control. B. Add the ID attribute to the TextBox control. C. Use the Bind function for the Label control instead of the Eval function. D. Use the Eval function for the TextBox control instead of the Bind function. Answer: B 112. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web page to display photos and captions. The caption of each photo in the database can be modified by using the application. You write the following code fragment. <asp:FormView DataSourceID="ObjectDataSource1" DataKeyNames="PhotoID" runat="server"> <EditItemTemplate> <asp:TextBox Text='<%# Bind("Caption") %>' runat="server"/> | English | Chinese | Japan | Korean | - 123 - Test Information Co., Ltd. All rights reserved.
  • 123.
    <asp:Button Text="Update" CommandName="Update" runat="server"/> <asp:Button Text="Cancel" CommandName="Cancel" runat="server"/> </EditItemTemplate> <ItemTemplate> <asp:Label Text='<%# Eval("Caption") %>' runat="server" /> <asp:Button Text="Edit" CommandName="Edit" runat="server"/> </ItemTemplate> </asp:FormView> When you access the Web page, the application throws an error. You need to ensure that the application successfully updates each caption and stores it in the database. What should you do? A. Add the ID attribute to the Label control. B. Add the ID attribute to the TextBox control. C. Use the Bind function for the Label control instead of the Eval function. D. Use the Eval function for the TextBox control instead of the Bind function. Answer: B 113. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application contains two HTML pages named ErrorPage.htm and PageNotFound.htm. You need to ensure that the following requirements are met: ¡¤When the userrequests a page that does not exist, the PageNotFound.htm page is displayed. ¡¤When any other error occurs, the ErrorPage.htm page is displayed Which section should you add to the Web.config file? A. <customErrors mode="Off" defaultRedirect="ErrorPage.htm"> <error statusCode="404" redirect="PageNotFound.htm"/> </customErrors> B. <customErrors mode="On" defaultRedirect="ErrorPage.htm"> | English | Chinese | Japan | Korean | - 124 - Test Information Co., Ltd. All rights reserved.
  • 124.
    <error statusCode="404" redirect="PageNotFound.htm"/> </customErrors> C.<customErrors mode="Off"> <error statusCode="400" redirect="ErrorPage.htm"/> <error statusCode="404" redirect="PageNotFound.htm"/> </customErrors> D. <customErrors mode="On"> <error statusCode="400" redirect="ErrorPage.htm"/> <error statusCode="404" redirect="PageNotFound.htm"/> </customErrors> Answer: B 114. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application contains two HTML pages named ErrorPage.htm and PageNotFound.htm. You need to ensure that the following requirements are met: ¡¤hen the user requests a page that does not exist, the PageNotFound.htm page is displayed. ¡¤When any other error occurs, the ErrorPage.htm page is displayed Which section should you add to the Web.config file? A. <customErrors mode="Off" defaultRedirect="ErrorPage.htm"> <error statusCode="404" redirect="PageNotFound.htm"/> </customErrors> B. <customErrors mode="On" defaultRedirect="ErrorPage.htm"> <error statusCode="404" redirect="PageNotFound.htm"/> </customErrors> C. <customErrors mode="Off"> <error statusCode="400" redirect="ErrorPage.htm"/> <error statusCode="404" redirect="PageNotFound.htm"/> </customErrors> D. <customErrors mode="On"> | English | Chinese | Japan | Korean | - 125 - Test Information Co., Ltd. All rights reserved.
  • 125.
    <error statusCode="400" redirect="ErrorPage.htm"/> <error statusCode="404" redirect="PageNotFound.htm"/> </customErrors> Answer: B 115. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You plan to deploy the application to a test server. You need to ensure that during the initial request to the application, the code-behind files for the Web pages are compiled. You also need to optimize the performance of the application. Which code fragment should you add to the Web.config file? A. <compilation debug="true"> B. <compilation debug="false"> C. <compilation debug="true" batch="true"> D. <compilation debug="false" batch="false"> Answer: B 116. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You plan to deploy the application to a test server. You need to ensure that during the initial request to the application, the code-behind files for the Web pages are compiled. You also need to optimize the performance of the application. Which code fragment should you add to the Web.config file? A. <compilation debug="true"> B. <compilation debug="false"> C. <compilation debug="true" batch="true"> D. <compilation debug="false" batch="false"> Answer: B 117. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You host the application on a server named ContosoTest that runs Microsoft IIS 6.0. You set up remote | English | Chinese | Japan | Korean | - 126 - Test Information Co., Ltd. All rights reserved.
  • 126.
    debugging on theContosoTest server. You need to debug the application remotely from another computer named ContosoDev. What should you do? A. Attach Microsoft Visual Studio.NET to the w3wp.exe process. B. Attach Microsoft Visual Studio.NET to the inetinfo.exe process. C. Attach Microsoft Visual Studio.NET to the Msvsmon.exe process. D. Attach Microsoft Visual Studio.NET to the WebDev.WebServer.exe process. Answer: A 118. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You host the application on a server named ContosoTest that runs Microsoft IIS 6.0. You set up remote debugging on the ContosoTest server. You need to debug the application remotely from another computer named ContosoDev. What should you do? A. Attach Microsoft Visual Studio.NET to the w3wp.exe process. B. Attach Microsoft Visual Studio.NET to the inetinfo.exe process. C. Attach Microsoft Visual Studio.NET to the Msvsmon.exe process. D. Attach Microsoft Visual Studio.NET to the WebDev.WebServer.exe process. Answer: A 119. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application resides on a server named ContosoTest that runs Microsoft IIS 5.0. You use a computer named ContosoDev to log on to the Contoso.com domain with an account named ContosoUser. The ContosoTest and ContosoDev servers are members of the Contoso.com domain. You need to set up the appropriate permission for remote debugging. What should you do? A. Set the Remote Debugging Monitor to use Windows Authentication. B. Add the ContosoUser account to the domain Administrators group. | English | Chinese | Japan | Korean | - 127 - Test Information Co., Ltd. All rights reserved.
  • 127.
    C. Add theContosoUser account to the local Administrators group on the ContosoTest server. D. Change the ASP.NET worker process on the ContosoTest server to run as the local Administrator account. Answer: C 120. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application resides on a server named ContosoTest that runs Microsoft IIS 5.0. You use a computer named ContosoDev to log on to the Contoso.com domain with an account named ContosoUser. The ContosoTest and ContosoDev servers are members of the Contoso.com domain. You need to set up the appropriate permission for remote debugging. What should you do? A. Set the Remote Debugging Monitor to use Windows Authentication. B. Add the ContosoUser account to the domain Administrators group. C. Add the ContosoUser account to the local Administrators group on the ContosoTest server. D. Change the ASP.NET worker process on the ContosoTest server to run as the local Administrator account. Answer: C 121. You create a Microsoft ASP.NET AJAX application by using the Microsoft .NET Framework version 3.5. You attach Microsoft Visual Studio 2008 debugger to the Microsoft Internet Explorer instance to debug the JavaScript code in the AJAX application. You need to ensure that the application displays the details of the client-side object on the debugger console. What should you do? A. Use the Sys.Debug.fail method. B. Use the Sys.Debug.trace method. C. Use the Sys.Debug.assert method. | English | Chinese | Japan | Korean | - 128 - Test Information Co., Ltd. All rights reserved.
  • 128.
    D. Use theSys.Debug.traceDump method. Answer: D 122. You create a Microsoft ASP.NET AJAX application by using the Microsoft .NET Framework version 3.5. You attach Microsoft Visual Studio 2008 debugger to the Microsoft Internet Explorer instance to debug the JavaScript code in the AJAX application. You need to ensure that the application displays the details of the client-side object on the debugger console. What should you do? A. Use the Sys.Debug.fail method. B. Use the Sys.Debug.trace method. C. Use the Sys.Debug.assert method. D. Use the Sys.Debug.traceDump method. Answer: D 123. You create a Microsoft ASP.NET AJAX application by using the Microsoft .NET Framework version 3.5. A JavaScript code segment in the AJAX application does not exhibit the desired behavior. Microsoft Internet Explorer displays an error icon in the status bar but does not prompt you to debug the script. You need to configure the Internet Explorer to prompt you to debug the script. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) A. Clear the Disable Script Debugging (Other) check box. B. Clear the Disable Script Debugging (Internet Explorer) check box. C. Select the Show friendly HTTP error messages check box. D. Select the Enable third-party browser extensions check box. E. Select the Display a notification about every script error check box. Answer: BE | English | Chinese | Japan | Korean | - 129 - Test Information Co., Ltd. All rights reserved.
  • 129.
    124. You createa Microsoft ASP.NET AJAX application by using the Microsoft .NET Framework version 3.5. A JavaScript code segment in the AJAX application does not exhibit the desired behavior. Microsoft Internet Explorer displays an error icon in the status bar but does not prompt you to debug the script. You need to configure the Internet Explorer to prompt you to debug the script. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) A. Clear the Disable Script Debugging (Other) check box. B. Clear the Disable Script Debugging (Internet Explorer) check box. C. Select the Show friendly HTTP error messages check box. D. Select the Enable third-party browser extensions check box. E. Select the Display a notification about every script error check box. Answer: BE 125. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You plan to capture the timing and performance information of the application. You need to ensure that the information is accessible only when the user is logged on to the Web server and not on individual Web pages. What should you add to the Web.config file? A. <compilation debug="true" /> B. <compilation debug="false" urlLinePragmas="true" /> C. <trace enabled="true" pageOutput="false" localOnly="true" /> D. <trace enabled="true" writeToDiagnosticsTrace="true" pageOutput="true" localOnly="true" /> Answer: C 126. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You plan to capture the timing and performance information of the application. You need to ensure that the information is accessible only when the user is logged on to the Web server and not on individual Web pages. What should you add to the Web.config file? | English | Chinese | Japan | Korean | - 130 - Test Information Co., Ltd. All rights reserved.
  • 130.
    A. <compilation debug="true"/> B. <compilation debug="false" urlLinePragmas="true" /> C. <trace enabled="true" pageOutput="false" localOnly="true" /> D. <trace enabled="true" writeToDiagnosticsTrace="true" pageOutput="true" localOnly="true" /> Answer: C 127. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. When you access the application in a Web browser, you receive the following error message: "Service Unavailable". You need to access the application successfully. What should you do? A. Start Microsoft IIS 6.0. B. Start the Application pool. C. Set the .NET Framework version. D. Add the Web.config file for the application. Answer: B 128. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. When you access the application in a Web browser, you receive the following error message: "Service Unavailable". You need to access the application successfully. What should you do? A. Start Microsoft IIS 6.0. B. Start the Application pool. C. Set the .NET Framework version. D. Add the Web.config file for the application. Answer: B 129. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. | English | Chinese | Japan | Korean | - 131 - Test Information Co., Ltd. All rights reserved.
  • 131.
    The application isdeployed on a Microsoft IIS 6.0 Web server by using the default ASP.NET version 2.0 application pool and Windows Authentication. The application contains functionality to upload files to a location on a different server. Users receive an access denied error message when they attempt to submit a file. You need to modify the Web.config file to resolve the error. Which code fragment should you use? A. <identity impersonate="true" /> B. <anonymousIdentification enabled="true" /> C. <roleManager enabled="true"defaultProvider="AspNetWindowsTokenRolePRovider" /> D. <authorization> <allow users="*" /> </authorization> Answer: A 130. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application is deployed on a Microsoft IIS 6.0 Web server by using the default ASP.NET version 2.0 application pool and Windows Authentication. The application contains functionality to upload files to a location on a different server. Users receive an access denied error message when they attempt to submit a file. You need to modify the Web.config file to resolve the error. Which code fragment should you use? A. <identity impersonate="true" /> B. <anonymousIdentification enabled="true" /> C. <roleManager enabled="true"defaultProvider="AspNetWindowsTokenRolePRovider" /> D. <authorization> <allow users="*" /> </authorization> Answer: A | English | Chinese | Japan | Korean | - 132 - Test Information Co., Ltd. All rights reserved.
  • 132.
    131. You createa Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. When you review the application performance counters, you discover that there is an unexpected increase in the value of the Application Restarts counter. You need to identify the reasons for this increase. What are three possible reasons that could cause this increase? (Each correct answer presents a complete solution. Choose three.) A. Restart of the Microsoft IIS 6.0 host. B. Restart of the Microsoft Windows Server 2003 that hosts the Web application. C. Addition of a new assembly in the Bin directory of the application. D. Addition of a code segment that requires recompilation to the ASP.NET Web application. E. Enabling of HTTP compression in the Microsoft IIS 6.0 manager for the application. F. Modification to the Web.config file in the system.web section for debugging the application. Answer: CDF 132. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. When you review the application performance counters, you discover that there is an unexpected increase in the value of the Application Restarts counter. You need to identify the reasons for this increase. What are three possible reasons that could cause this increase? (Each correct answer presents a complete solution. Choose three.) A. Restart of the Microsoft IIS 6.0 host. B. Restart of the Microsoft Windows Server 2003 that hosts the Web application. C. Addition of a new assembly in the Bin directory of the application. D. Addition of a code segment that requires recompilation to the ASP.NET Web application. E. Enabling of HTTP compression in the Microsoft IIS 6.0 manager for the application. F. Modification to the Web.config file in the system.web section for debugging the application. Answer: CDF | English | Chinese | Japan | Korean | - 133 - Test Information Co., Ltd. All rights reserved.
  • 133.
    133. You createa Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You plan to monitor the execution of the application at daily intervals. You need to modify the application configuration to enable WebEvent monitoring. What should you do? A. Enable the Debugging in the Web site option in the ASP.NET configuration settings. Modify the Request Execution timeout to 10 seconds. Register the aspnet_perf.dll performance counter library by using the following command. B. regsvr32 C:WINDOWSMicrosoft.NETFrameworkv2.0.50727aspnet_perf.dll Add the following code fragment to the <healthMonitoring> section of the Web.config file of the application. C. <profiles> <add name="Default" minInstances="1" maxLimit="Infinite" ? minInterval="00:00:10" custom="" /> </profiles> Add the following code fragment to the <system.web> section of the Web.config file of the application. D. <healthMonitoring enabled="true" heartbeatInterval="10"> <rules> <add name="Heartbeats Default" eventName="Heartbeat" provider="EventLogProvider" profile="Critical"/> </rules> </healthMonitoring> Answer: D 134. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You plan to monitor the execution of the application at daily intervals. | English | Chinese | Japan | Korean | - 134 - Test Information Co., Ltd. All rights reserved.
  • 134.
    You need tomodify the application configuration to enable WebEvent monitoring. What should you do? A. Enable the Debugging in the Web site option in the ASP.NET configuration settings. Modify the Request Execution timeout to 10 seconds. Register the aspnet_perf.dll performance counter library by using the following command. B. regsvr32 C:WINDOWSMicrosoft.NETFrameworkv2.0.50727aspnet_perf.dll Add the following code fragment to the <healthMonitoring> section of the Web.config file of the application. C. <profiles> <add name="Default" minInstances="1" maxLimit="Infinite" minInterval="00:00:10" custom="" /> </profiles> Add the following code fragment to the <system.web> section of the Web.config file of the application. D. <healthMonitoring enabled="true" heartbeatInterval="10"> <rules> <add name="Heartbeats Default" eventName="Heartbeat" provider="EventLogProvider" profile="Critical"/> </rules> </healthMonitoring> Answer: D 135. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You add the following code fragment to the Web.config file of the application (Line numbers are included for reference only). 01 <healthMonitoring> 02 <providers> | English | Chinese | Japan | Korean | - 135 - Test Information Co., Ltd. All rights reserved.
  • 135.
    03 <add name="EventLogProvider" 04 type="System.Web.Management.EventLogWebEventProvider 05 /> 06 <add name="WmiWebEventProvider" 07 type="System.Web.Management.WmiWebEventProvider 08 /> 09 </providers> 10 <eventMappings> 11 12 </eventMappings> 13 <rules> 14 <add name="Security Rule" eventName="Security Event" 15 provider="WmiWebEventProvider" /> 16 <add name="AppError Rule" eventName="AppError Event" 17 provider="EventLogProvider" /> 18 </rules> 19 </healthMonitoring> You need to configure Web Events to meet the following requirements: ¡¤Securit-related Web Events are mapped to Microsoft Windows Management Instrumentation (WMI) events. ¡¤ W Even s caused by p ob e m w h con gu a on o app ca on code a e l ogged i n o t he Wndo w eb t r l s it fi r ti r li ti r t i s Application Event Log. Which code fragment should you insert at line 11? A. <add name="Security Event"type="System.Web.Management.WebAuditEvent"/> <add name="AppError Event"type="System.Web.Management.WebRequestErrorEvent"/> B. <add name="Security Event"type="System.Web.Management.WebAuditEvent"/> <add name="AppError Event"type="System.Web.Management.WebErrorEvent"/> C. <add name="Security Event"type="System.Web.Management.WebApplicationLifetimeEvent"/> <add name="AppError Event"type="System.Web.Management.WebRequestErrorEvent"/> | English | Chinese | Japan | Korean | - 136 - Test Information Co., Ltd. All rights reserved.
  • 136.
    D. <add name="SecurityEvent"type="System.Web.Management.WebApplicationLifetimeEvent"/> <add name="AppError Event"type="System.Web.Management.WebErrorEvent"/> Answer: B 136. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You add the following code fragment to the Web.config file of the application (Line numbers are included for reference only). 01 <healthMonitoring> 02 <providers> 03 <add name="EventLogProvider" 04 type="System.Web.Management.EventLogWebEventProvider 05 /> 06 <add name="WmiWebEventProvider" 07 type="System.Web.Management.WmiWebEventProvider 08 /> 09 </providers> 10 <eventMappings> 11 12 </eventMappings> 13 <rules> 14 <add name="Security Rule" eventName="Security Event" 15 provider="WmiWebEventProvider" /> 16 <add name="AppError Rule" eventName="AppError Event" 17 provider="EventLogProvider" /> 18 </rules> 19 </healthMonitoring> You need to configure Web Events to meet the following requirements: ¡¤Securit-related Web Events are mapped to Microsoft Windows Management Instrumentation (WMI) events. ¡¤ W Even s caused by p ob e m w h con gu a on o app ca on code a e l ogged i n o t he Wndo w eb t r l s it fi r ti r li ti r t i s | English | Chinese | Japan | Korean | - 137 - Test Information Co., Ltd. All rights reserved.
  • 137.
    Application Event Log. Whichcode fragment should you insert at line 11? A. <add name="Security Event"type="System.Web.Management.WebAuditEvent"/> <add name="AppError Event"type="System.Web.Management.WebRequestErrorEvent"/> B. <add name="Security Event"type="System.Web.Management.WebAuditEvent"/> <add name="AppError Event"type="System.Web.Management.WebErrorEvent"/> C. <add name="Security Event"type="System.Web.Management.WebApplicationLifetimeEvent"/> <add name="AppError Event"type="System.Web.Management.WebRequestErrorEvent"/> D. <add name="Security Event"type="System.Web.Management.WebApplicationLifetimeEvent"/> <add name="AppError Event"type="System.Web.Management.WebErrorEvent"/> Answer: B 137. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code fragment. (Line numbers are included for reference only.) 01 <asp:UpdatePanel ID="upnData" runat="server" 02 ChildrenAsTriggers="false" UpdateMode="Conditional"> 03 <Triggers> 04 05 </Triggers> 06 <ContentTemplate> 07 <!-- more content here --> 08 <asp:LinkButton ID="lbkLoad" runat="server" Text="Load" 09 onclick="lbkLoad_Click" /> 10 <asp:Button ID="btnSubmit" runat="server" Text="Submit" 11 Width="150px" onclick="btnSubmit_Click" /> 12 </ContentTemplate> 13 </asp:UpdatePanel> 14 <asp:Button ID="btnUpdate" runat="server" Text="Update" 15 Width="150px" onclick="btnUpdate_Click" /> | English | Chinese | Japan | Korean | - 138 - Test Information Co., Ltd. All rights reserved.
  • 138.
    You need toensure that the requirements shown in the following table are met. What should you do? A. Set the value of the ChildrenAsTriggers property in line 02 to false. Add the following code fragment at line 04. <asp:AsyncPostBackTrigger ControlID="btnUpdate" /> <asp:PostBackTrigger ControlID="btnSubmit" /> B. Set the value of the ChildrenAsTriggers property in line 02 to false. Add the following code fragment at line 04. <asp:AsyncPostBackTrigger ControlID="btnSubmit" /> <asp:PostBackTrigger ControlID="btnUpdate" /> C. Set the value of the ChildrenAsTriggers property in line 02 to true. Add the following code fragment at line 04. <asp:AsyncPostBackTrigger ControlID="btnSubmit" /> <asp:PostBackTrigger ControlID="btnUpdate" /> D. Set the value of the ChildrenAsTriggers property in line 02 to true. Add the following code fragment at line 04. <asp:AsyncPostBackTrigger ControlID="btnUpdate" /> <asp:PostBackTrigger ControlID="btnSubmit" /> Answer: D 138. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code fragment. (Line numbers are included for reference only.) 01 <asp:UpdatePanel ID="upnData" runat="server" 02 ChildrenAsTriggers="false" UpdateMode="Conditional"> 03 <Triggers> | English | Chinese | Japan | Korean | - 139 - Test Information Co., Ltd. All rights reserved.
  • 139.
    04 05 </Triggers> 06 <ContentTemplate> 07 <!-- more content here --> 08 <asp:LinkButton ID="lbkLoad" runat="server" Text="Load" 09 onclick="lbkLoad_Click" /> 10 <asp:Button ID="btnSubmit" runat="server" Text="Submit" 11 Width="150px" onclick="btnSubmit_Click" /> 12 </ContentTemplate> 13 </asp:UpdatePanel> 14 <asp:Button ID="btnUpdate" runat="server" Text="Update" 15 Width="150px" onclick="btnUpdate_Click" /> You need to ensure that the requirements shown in the following table are met. What should you do? A. Set the value of the ChildrenAsTriggers property in line 02 to false. Add the following code fragment at line 04. <asp:AsyncPostBackTrigger ControlID="btnUpdate" /> <asp:PostBackTrigger ControlID="btnSubmit" /> B. Set the value of the ChildrenAsTriggers property in line 02 to false. Add the following code fragment at line 04. <asp:AsyncPostBackTrigger ControlID="btnSubmit" /> <asp:PostBackTrigger ControlID="btnUpdate" /> C. Set the value of the ChildrenAsTriggers property in line 02 to true. Add the following code fragment at line 04. <asp:AsyncPostBackTrigger ControlID="btnSubmit" /> | English | Chinese | Japan | Korean | - 140 - Test Information Co., Ltd. All rights reserved.
  • 140.
    <asp:PostBackTrigger ControlID="btnUpdate" /> D.Set the value of the ChildrenAsTriggers property in line 02 to true. Add the following code fragment at line 04. <asp:AsyncPostBackTrigger ControlID="btnUpdate" /> <asp:PostBackTrigger ControlID="btnSubmit" /> Answer: D 139. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. You add the following code fragment to an AJAX-enabled Web form. (Line numbers are included for reference only.) 01 <asp:ScriptManager ID="scrMgr" runat="server" /> 02 <asp:UpdatePanel ID="updPanel" runat="server" 03 UpdateMode="Conditional"> 04 <ContentTemplate> 05 <asp:Label ID="lblTime" runat="server" /> 06 <asp:UpdatePanel ID="updInnerPanel" 07 runat="server" UpdateMode="Conditional"> 08 <ContentTemplate> 09 <asp:Timer ID="tmrTimer" runat="server" 10 Interval="1000" 11 OnTick="tmrTimer_Tick" /> 12 </ContentTemplate> 13 14 </asp:UpdatePanel> 15 </ContentTemplate> 16 17 </asp:UpdatePanel> The tmrTimer_Tick event handler sets the Text property of the lblTime Label control to the current time of | English | Chinese | Japan | Korean | - 141 - Test Information Co., Ltd. All rights reserved.
  • 141.
    the server. You needto configure the appropriate UpdatePanel control to ensure that the lblTime Label Control is properly updated by the tmrTimer Timer control. What should you do? A. Set the UpdateMode="Always" attribute to the updInnerPanel UpdatePanel control in line 07. B. Set the ChildrenAsTriggers="false" attribute to the updPanel UpdatePanel control in line 02. C. Add the following code fragment to line 13. <Triggers> <asp:PostBackTrigger ControlID="tmrTimer" /> </Triggers> D. Add the following code fragment to line 16. <Triggers> <asp:AsyncPostBackTrigger ControlID="tmrTimer" EventName="Tick" /> </Triggers> Answer: D 140. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. You add the following code fragment to an AJAX-enabled Web form. (Line numbers are included for reference only.) 01 <asp:ScriptManager ID="scrMgr" runat="server" /> 02 <asp:UpdatePanel ID="updPanel" runat="server" 03 UpdateMode="Conditional"> 04 <ContentTemplate> 05 <asp:Label ID="lblTime" runat="server" /> 06 <asp:UpdatePanel ID="updInnerPanel" 07 runat="server" UpdateMode="Conditional"> 08 <ContentTemplate> | English | Chinese | Japan | Korean | - 142 - Test Information Co., Ltd. All rights reserved.
  • 142.
    09 <asp:Timer ID="tmrTimer" runat="server" 10 Interval="1000" 11 OnTick="tmrTimer_Tick" /> 12 </ContentTemplate> 13 14 </asp:UpdatePanel> 15 </ContentTemplate> 16 17 </asp:UpdatePanel> The tmrTimer_Tick event handler sets the Text property of the lblTime Label control to the current time of the server. You need to configure the appropriate UpdatePanel control to ensure that the lblTime Label Control is properly updated by the tmrTimer Timer control. What should you do? A. Set the UpdateMode="Always" attribute to the updInnerPanel UpdatePanel control in line 07. B. Set the ChildrenAsTriggers="false" attribute to the updPanel UpdatePanel control in line 02. C. Add the following code fragment to line 13. <Triggers> <asp:PostBackTrigger ControlID="tmrTimer" /> </Triggers> D. Add the following code fragment to line 16. <Triggers> <asp:AsyncPostBackTrigger ControlID="tmrTimer" EventName="Tick" /> </Triggers> Answer: D 141. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code segment to create a client-script function. (Line numbers are included for | English | Chinese | Japan | Korean | - 143 - Test Information Co., Ltd. All rights reserved.
  • 143.
    reference only.) 01 functionupdateLabelControl(labelId, newText) { 02 var label = $find(labelId); 03 label.innerHTML = newText; 04 } The client script function uses ASP.NET AJAX and updates the text of any Label control in the Web form. When you test the client script function, you discover that the Label controls are not updated. You receive the following JavaScript error message in the browser: "'null' is null or not an object." You need to resolve the error. What should you do? A. Replace line 03 with the following line of code. label.innerText = newText; B. Replace line 02 with the following line of code. var label = $get(labelId); C. Replace line 02 with the following line of code. var label = Sys.UI.DomElement.getElementById($get(labelId)); D. Replace line 02 with the following line of code. var label = Sys.UI.DomElement.getElementById($find(labelId)); Answer: B 142. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You write the following code segment to create a client-script function. (Line numbers are included for reference only.) 01 function updateLabelControl(labelId, newText) { 02 var label = $find(labelId); 03 label.innerHTML = newText; 04 } The client script function uses ASP.NET AJAX and updates the text of any Label control in the Web form. When you test the client script function, you discover that the Label controls are not updated. You receive | English | Chinese | Japan | Korean | - 144 - Test Information Co., Ltd. All rights reserved.
  • 144.
    the following JavaScripterror message in the browser: "'null' is null or not an object." You need to resolve the error. What should you do? A. Replace line 03 with the following line of code. label.innerText = newText; B. Replace line 02 with the following line of code. var label = $get(labelId); C. Replace line 02 with the following line of code. var label = Sys.UI.DomElement.getElementById($get(labelId)); D. Replace line 02 with the following line of code. var label = Sys.UI.DomElement.getElementById($find(labelId)); Answer: B 143. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web form by using ASP.NET AJAX. You write the following client-script code fragment to handle the exceptions thrown from asynchronous postbacks. (Line numbers are included for reference only.) 01 <script type="text/javascript"> 02 function pageLoad() 03 { 04 var pageMgr = 05 Sys.WebForms.PageRequestManager.getInstance(); 06 07 } 08 09 function errorHandler(sender, args) 10 { 11 12 } | English | Chinese | Japan | Korean | - 145 - Test Information Co., Ltd. All rights reserved.
  • 145.
    13 </script> You needto ensure that the application performs the following tasks: ¡¤Use a common clien-script function named errorHandler. ¡¤Update a Label control that has an ID named lblEror with the error message. ¡¤Prevent the browser from displaying any message box or Javascript error What should you do? A. Insert the following code segment at line 06. pageMgr.add_endRequest(errorHandler); Insert the following code segment at line 11. if (args.get_error() != null) { $get('lblError').innerHTML = args.get_error().message; args.set_errorHandled(true); } B. Insert the following code segment at line 06. pageMgr.add_endRequest(errorHandler); Insert the following code segment at line 11. if (args.get_error() != null) { $get('lblError').innerHTML = args.get_error().message; } C. Insert the following code segment at line 06. pageMgr.add_pageLoaded(errorHandler); Insert the following code segment at line 11. if (args.get_error() != null) { $get('lblError').innerHTML = args.get_error().message; args.set_errorHandled(true); } D. Insert the following code segment at line 06. pageMgr.add_pageLoaded(errorHandler); Insert the following code segment at line 11. | English | Chinese | Japan | Korean | - 146 - Test Information Co., Ltd. All rights reserved.
  • 146.
    if (args.get_error() !=null) { $get('lblError').innerHTML = args.get_error().message; } Answer: A 144. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web form by using ASP.NET AJAX. You write the following client-script code fragment to handle the exceptions thrown from asynchronous postbacks. (Line numbers are included for reference only.) 01 <script type="text/javascript"> 02 function pageLoad() 03 { 04 var pageMgr = 05 Sys.WebForms.PageRequestManager.getInstance(); 06 07 } 08 09 function errorHandler(sender, args) 10 { 11 12 } 13 </script> You need to ensure that the application performs the following tasks: ¡¤Use a common clien-script function named errorHandler. ¡¤Update a Label control tat has an ID named lblError with the error message. ¡¤Prevent the browser from displaying any message box or Javascript error What should you do? A. Insert the following code segment at line 06. pageMgr.add_endRequest(errorHandler); | English | Chinese | Japan | Korean | - 147 - Test Information Co., Ltd. All rights reserved.
  • 147.
    Insert the followingcode segment at line 11. if (args.get_error() != null) { $get('lblError').innerHTML = args.get_error().message; args.set_errorHandled(true); } B. Insert the following code segment at line 06. pageMgr.add_endRequest(errorHandler); Insert the following code segment at line 11. if (args.get_error() != null) { $get('lblError').innerHTML = args.get_error().message; } C. Insert the following code segment at line 06. pageMgr.add_pageLoaded(errorHandler); Insert the following code segment at line 11. if (args.get_error() != null) { $get('lblError').innerHTML = args.get_error().message; args.set_errorHandled(true); } D. Insert the following code segment at line 06. pageMgr.add_pageLoaded(errorHandler); Insert the following code segment at line 11. if (args.get_error() != null) { $get('lblError').innerHTML = args.get_error().message; } Answer: A 145. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web form by using ASP.NET AJAX. The Web form contains the following code fragment. (Line numbers are included for reference only.) | English | Chinese | Japan | Korean | - 148 - Test Information Co., Ltd. All rights reserved.
  • 148.
    01 <script type="text/javascript"> 02 03 Sys.Application.add_init(initComponents); 04 05 function initComponents() { 06 07 } 08 09 </script> 10 11 <asp:ScriptManager ID="ScriptManager1" 12 runat="server" /> 13 <asp:TextBox runat="server" ID="TextBox1" /> You need to create and initialize a client behavior named MyCustomBehavior by using the initComponents function. You also need to ensure that MyCustomBehavior is attached to the TextBox1 Textbox control. Which code segment should you insert at line 06? A. $create(MyCustomBehavior, null, null, null, 'TextBox1'); B. $create(MyCustomBehavior, null, null, null, $get('TextBox1')); C. Sys.Component.create(MyCustomBehavior, 'TextBox1', null, null, null); D. Sys.Component.create(MyCustomBehavior, $get('TextBox1'), null, null, null); Answer: B 146. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web form by using ASP.NET AJAX. The Web form contains the following code fragment. (Line numbers are included for reference only.) 01 <script type="text/javascript"> 02 03 Sys.Application.add_init(initComponents); | English | Chinese | Japan | Korean | - 149 - Test Information Co., Ltd. All rights reserved.
  • 149.
    04 05 function initComponents() { 06 07 } 08 09 </script> 10 11 <asp:ScriptManager ID="ScriptManager1" 12 runat="server" /> 13 <asp:TextBox runat="server" ID="TextBox1" /> You need to create and initialize a client behavior named MyCustomBehavior by using the initComponents function. You also need to ensure that MyCustomBehavior is attached to the TextBox1 Textbox control. Which code segment should you insert at line 06? A. $create(MyCustomBehavior, null, null, null, 'TextBox1'); B. $create(MyCustomBehavior, null, null, null, $get('TextBox1')); C. Sys.Component.create(MyCustomBehavior, 'TextBox1', null, null, null); D. Sys.Component.create(MyCustomBehavior, $get('TextBox1'), null, null, null); Answer: B 147. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a login Web form by using the following code fragment. <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:TextBox runat="server" ID="txtUser" Width="200px" /> <asp:TextBox runat="server" ID="txtPassword" Width="200px" /> <asp:Button runat="server" ID="btnLogin" Text="Login" OnClientClick="login(); return false;" /> When a user clicks the btnLogin Button control, the login() client-side script is called to authenticate the user. The credentials provided in the TextBox controls are used to call the client-side script. You also add the following client-script code fragment in the Web form. (Line numbers are included for | English | Chinese | Japan | Korean | - 150 - Test Information Co., Ltd. All rights reserved.
  • 150.
    reference only.) 01 <scripttype="text/javascript"> 02 function login() { 03 var username = $get('txtUser').value; 04 var password = $get('txtPassword').value; 05 06 // authentication logic. 07 } 08 function onLoginCompleted(validCredentials, userContext, 09 methodName) 10 { 11 // notify user on authentication result. 12 } 13 14 function onLoginFailed(error, userContext, methodName) 15 { 16 // notify user on authentication exception. 17 } 18 </script> The ASP.NET application is configured to use Forms Authentication. The ASP.NET AJAX authentication service is activated in the Web.config file. You need to ensure that the following workflow is maintained: ¡¤On successful authentication, the onLoginCompleted clien-script function is called to notify the user. ¡¤On failure of authentication, the onLoginFailed clien-script function is called to display an error message. Which code segment should you insert at line 06? A. var auth = Sys.Services.AuthenticationService;auth.login(username, password, false, null, null,onLoginCompleted, onLoginFailed, null); B. var auth = Sys.Services.AuthenticationService;auth.set_defaultFailedCallback(onLoginFailed); var validCredentials = auth.login(username, password, false, null, null, null, null, null); | English | Chinese | Japan | Korean | - 151 - Test Information Co., Ltd. All rights reserved.
  • 151.
    if (validCredentials) onLoginCompleted(true, null,null); else onLoginCompleted(false, null, null); C. var auth = Sys.Services.AuthenticationService; auth.set_defaultLoginCompletedCallback(onLoginCompleted); try { auth.login(username, password, false, null, null, null, null, null); } catch (err) { onLoginFailed(err, null, null); } D. var auth = Sys.Services.AuthenticationService; try { var validCredentials = auth.login(username, password, false, null, null, null, null, null); if (validCredentials) onLoginCompleted(true, null, null); else onLoginCompleted(false, null, null); } catch (err) { onLoginFailed(err, null, null); } Answer: A 148. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a login Web form by using the following code fragment. <asp:ScriptManager ID="ScriptManager1" runat="server" /> | English | Chinese | Japan | Korean | - 152 - Test Information Co., Ltd. All rights reserved.
  • 152.
    <asp:TextBox runat="server" ID="txtUser"Width="200px" /> <asp:TextBox runat="server" ID="txtPassword" Width="200px" /> <asp:Button runat="server" ID="btnLogin" Text="Login" OnClientClick="login(); return false;" /> When a user clicks the btnLogin Button control, the login() client-side script is called to authenticate the user. The credentials provided in the TextBox controls are used to call the client-side script. You also add the following client-script code fragment in the Web form. (Line numbers are included for reference only.) 01 <script type="text/javascript"> 02 function login() { 03 var username = $get('txtUser').value; 04 var password = $get('txtPassword').value; 05 06 // authentication logic. 07 } 08 function onLoginCompleted(validCredentials, userContext, 09 methodName) 10 { 11 // notify user on authentication result. 12 } 13 14 function onLoginFailed(error, userContext, methodName) 15 { 16 // notify user on authentication exception. 17 } 18 </script> The ASP.NET application is configured to use Forms Authentication. The ASP.NET AJAX authentication service is activated in the Web.config file. You need to ensure that the following workflow is maintained: ¡¤On successfu authentication, the onLoginCompleted client-script function is called to notify the user. | English | Chinese | Japan | Korean | - 153 - Test Information Co., Ltd. All rights reserved.
  • 153.
    ¡¤On failure ofauthentication, the onLoginFailed clien-script function is called to display an error message. Which code segment should you insert at line 06? A. var auth = Sys.Services.AuthenticationService;auth.login(username, password, false, null, null,onLoginCompleted, onLoginFailed, null); B. var auth = Sys.Services.AuthenticationService;auth.set_defaultFailedCallback(onLoginFailed); var validCredentials = auth.login(username, password, false, null, null, null, null, null); if (validCredentials) onLoginCompleted(true, null, null); else onLoginCompleted(false, null, null); C. var auth = Sys.Services.AuthenticationService; auth.set_defaultLoginCompletedCallback(onLoginCompleted); try { auth.login(username, password, false, null, null, null, null, null); } catch (err) { onLoginFailed(err, null, null); } D. var auth = Sys.Services.AuthenticationService; try { var validCredentials = auth.login(username, password, false, null, null, null, null, null); if (validCredentials) onLoginCompleted(true, null, null); else onLoginCompleted(false, null, null); } catch (err) { | English | Chinese | Japan | Korean | - 154 - Test Information Co., Ltd. All rights reserved.
  • 154.
    onLoginFailed(err, null, null); } Answer:A 149. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. The application contains the following device filter element in the Web.config file. <filter name="isHtml" compare="PreferredRenderingType"argument="html32" /> The application contains a Web page that has the following image control. (Line numbers are included for reference only.) 01 <mobile:Image ID="imgCtrl" Runat="server"> 02 03 </mobile:Image> You need to ensure that the following conditions are met: ¡¤The imgCtrl Image control displays he highRes.jpg file if the Web browser supports html. ¡¤The imgCtrl Image control displays lowRes.gif if the Web browser does not support html Which DeviceSpecific element should you insert at line 02? A. <DeviceSpecific> <Choice Filter="isHtml" ImageUrl="highRes.jpg" /> <Choice ImageUrl="lowRes.gif" /> </DeviceSpecific> B. <DeviceSpecific> <Choice Filter="isHtml" Argument="false" ImageUrl="highRes.jpg" /> <Choice Filter="isHtml" Argument="true" ImageUrl="lowRes.gif" /> </DeviceSpecific> C. <DeviceSpecific> <Choice Filter="PreferredRenderingType" ImageUrl="highRes.jpg" /> <Choice ImageUrl="lowRes.gif" /> </DeviceSpecific> | English | Chinese | Japan | Korean | - 155 - Test Information Co., Ltd. All rights reserved.
  • 155.
    D. <DeviceSpecific> <Choice Filter="PreferredRenderingType" Argument="false" ImageUrl="highRes.jpg" /> <Choice Filter="PreferredRenderingType" Argument="true" ImageUrl="lowRes.gif" /> </DeviceSpecific> Answer: A 150. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. The application contains the following device filter element in the Web.config file. <filter name="isHtml" compare="PreferredRenderingType"argument="html32" /> The application contains a Web page that has the following image control. (Line numbers are included for reference only.) 01 <mobile:Image ID="imgCtrl" Runat="server"> 02 03 </mobile:Image> You need to ensure that the following conditions are met: ¡¤The imgCtrl Image control displays the highRes.jpg file if the Web browser supports html ¡¤The imgCtrl Image control displays lowRes.gif if the Web broser does not support html. Which DeviceSpecific element should you insert at line 02? A. <DeviceSpecific> <Choice Filter="isHtml" ImageUrl="highRes.jpg" /> <Choice ImageUrl="lowRes.gif" /> </DeviceSpecific> B. <DeviceSpecific> <Choice Filter="isHtml" Argument="false" ImageUrl="highRes.jpg" /> <Choice Filter="isHtml" Argument="true" ImageUrl="lowRes.gif" /> </DeviceSpecific> | English | Chinese | Japan | Korean | - 156 - Test Information Co., Ltd. All rights reserved.
  • 156.
    C. <DeviceSpecific> <Choice Filter="PreferredRenderingType" ImageUrl="highRes.jpg" /> <Choice ImageUrl="lowRes.gif" /> </DeviceSpecific> D. <DeviceSpecific> <Choice Filter="PreferredRenderingType" Argument="false" ImageUrl="highRes.jpg" /> <Choice Filter="PreferredRenderingType" Argument="true" ImageUrl="lowRes.gif" /> </DeviceSpecific> Answer: A 151. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application contains a mobile Web page. You add the following StyleSheet control to the Web page. <mobile:StyleSheet id="MyStyleSheet" runat="server"> <mobile:Style Name="StyleA" Font-Name="Arial" Font-Bold="True" Wrapping="NoWrap"> </mobile:Style> </mobile:StyleSheet> You need to add a Label control named MyLabel that uses the defined style in the MyStyleSheet StyleSheet control. Which markup should you use? A. <mobile:Label ID="MyLabel" Runat="server"StyleReference="MyStyleSheet:StyleA"> </mobile:Label> B. <mobile:Label ID="MyLabel" Runat="server" StyleReference="StyleA"> </mobile:Label> C. <mobile:Label ID="MyLabel" Runat="server"> <DeviceSpecific ID="DSpec" Runat="server"> | English | Chinese | Japan | Korean | - 157 - Test Information Co., Ltd. All rights reserved.
  • 157.
    <Choice Filter="MyStyleSheet" StyleReference="StyleA"/> </DeviceSpecific> </mobile:Label> D. <mobile:Label ID="MyLabel" Runat="server"> <DeviceSpecific ID="DSpec" Runat="server"> <Choice Argument="StyleA" StyleReference="MyStyleSheet" /> </DeviceSpecific> </mobile:Label> Answer: A 152. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application contains a mobile Web page. You add the following StyleSheet control to the Web page. <mobile:StyleSheet id="MyStyleSheet" runat="server"> <mobile:Style Name="StyleA" Font-Name="Arial" Font-Bold="True" Wrapping="NoWrap"> </mobile:Style> </mobile:StyleSheet> You need to add a Label control named MyLabel that uses the defined style in the MyStyleSheet StyleSheet control. Which markup should you use? A. <mobile:Label ID="MyLabel" Runat="server"StyleReference="MyStyleSheet:StyleA"> </mobile:Label> B. <mobile:Label ID="MyLabel" Runat="server" StyleReference="StyleA"> </mobile:Label> C. <mobile:Label ID="MyLabel" Runat="server"> <DeviceSpecific ID="DSpec" Runat="server"> <Choice Filter="MyStyleSheet" StyleReference="StyleA" /> </DeviceSpecific> | English | Chinese | Japan | Korean | - 158 - Test Information Co., Ltd. All rights reserved.
  • 158.
    </mobile:Label> D. <mobile:Label ID="MyLabel"Runat="server"> <DeviceSpecific ID="DSpec" Runat="server"> <Choice Argument="StyleA" StyleReference="MyStyleSheet" /> </DeviceSpecific> </mobile:Label> Answer: A 153. You modify an existing Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You add a theme to the ASP.NET application. You need to apply the theme to override any settings of individual controls. What should you do? A. In the Web.config file of the application, set the Theme attribute of the pages element to the name of the theme. B. In the Web.config file of the application, set the StyleSheetTheme attribute of the pages element to the name of the theme. C. Add a master page to the application. In the @Master directive, set the Theme attribute to the name of the theme. D. Add a master page to the application. In the @Master directive, set the StyleSheetTheme attribute to the name of the theme. Answer: A 154. You modify an existing Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You add a theme to the ASP.NET application. You need to apply the theme to override any settings of individual controls. What should you do? A. In the Web.config file of the application, set the Theme attribute of the pages element to the name of | English | Chinese | Japan | Korean | - 159 - Test Information Co., Ltd. All rights reserved.
  • 159.
    the theme. B. Inthe Web.config file of the application, set the StyleSheetTheme attribute of the pages element to the name of the theme. C. Add a master page to the application. In the @Master directive, set the Theme attribute to the name of the theme. D. Add a master page to the application. In the @Master directive, set the StyleSheetTheme attribute to the name of the theme. Answer: A 155. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application uses 10 themes and allows the users to select their themes for the Web page. When a user returns to the application, the theme selected by the user is used to display pages in the application. This occurs even if the user returns to log on at a later date or from a different client computer. The application runs on different storage types and in different environments. You need to store the themes that are selected by the users and retrieve the required theme. What should you do? A. ¡¤Use the Application object to store the name of the theme tha is selected by the user. B. ¡¤Retrieve the required theme name from the Application object each time the user visits a page C. ¡¤Use the Session object to store the name of the theme that is selected by the user. D. ¡¤Retrieve the required theme name fro the Session object each time the user visits a page. E. ¡¤Use the Response.Cookies collection to store the name of the theme that is selected by the user. F. ¡¤ U t he Reques Cook es co ec on t oi den y t he t he m t ha was se ec ed by t he use each ti m the se t. i ll ti tif e t l t r user visits a page. G. ¡¤Add a setting for the theme to the profile section of the Web.config file of the application. H. ¡¤Use the Profile.Theme string theme to store the name of the theme that is selected by the user. I. ¡¤Retrieve the required them name each time the user visits a page. Answer: D 156. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. | English | Chinese | Japan | Korean | - 160 - Test Information Co., Ltd. All rights reserved.
  • 160.
    The application uses10 themes and allows the users to select their themes for the Web page. When a user returns to the application, the theme selected by the user is used to display pages in the application. This occurs even if the user returns to log on at a later date or from a different client computer. The application runs on different storage types and in different environments. You need to store the themes that are selected by the users and retrieve the required theme. What should you do? A. ¡¤Use the Application object to store the name of the theme that is selected by the user. B. ¡¤Retrieve the reqired theme name from the Application object each time the user visits a page. C. ¡¤Use the Session object to store the name of the theme that is selected by the user. D. ¡¤Retrieve the required theme name from the Session object each time the user visits apage. E. ¡¤Use the Response.Cookies collection to store the name of the theme that is selected by the user. F. ¡¤ U t he Reques Cook es co ec on t oi den y t he t he m t ha was se ec ed by t he use each ti m t he se t. i ll ti tif e t l t r e user visits a page. G. ¡¤Add a setting for he theme to the profile section of the Web.config file of the application. H. ¡¤Use the Profile.Theme string theme to store the name of the theme that is selected by the user. I. ¡¤Retrieve the required theme name each time the user visits a page Answer: D 157. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application must redirect the original URL to a different ASPX page. You need to ensure that the users cannot view the original URL after the page is executed. You also need to ensure that each page execution requires only one request from the client browser. What should you do? A. Use the Server.Transfer method to transfer execution to the correct ASPX page. B. Use the Response.Redirect method to transfer execution to the correct ASPX page. C. Use the HttpContext.Current.RewritePath method to transfer execution to the correct ASPX page. D. Add the Location: new URL value to the Response.Headers collection. Call the Response.End() statement. Send the header to the client computer to transfer execution to the correct ASPX page. Answer: C | English | Chinese | Japan | Korean | - 161 - Test Information Co., Ltd. All rights reserved.
  • 161.
    158. You createa Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application must redirect the original URL to a different ASPX page. You need to ensure that the users cannot view the original URL after the page is executed. You also need to ensure that each page execution requires only one request from the client browser. What should you do? A. Use the Server.Transfer method to transfer execution to the correct ASPX page. B. Use the Response.Redirect method to transfer execution to the correct ASPX page. C. Use the HttpContext.Current.RewritePath method to transfer execution to the correct ASPX page. D. Add the Location: new URL value to the Response.Headers collection. Call the Response.End() statement. Send the header to the client computer to transfer execution to the correct ASPX page. Answer: C 159. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application uses Session objects. You are modifying the application to run on a Web farm. You need to ensure that the application can access the Session objects from all the servers in the Web farm. You also need to ensure that when any server in the Web farm restarts or stops responding, the Session objects are not lost. What should you do? A. Use the InProc Session Management mode to store session data in the ASP.NET worker process. B. Use the SQLServer Session Management mode to store session data in a common Microsoft SQL Server 2005 database. C. Use the SQLServer Session Management mode to store session data in an individual database for each Web server in the Web farm. D. Use the StateServer Session Management mode to store session data in a common State Server process on a Web server in the Web farm. Answer: B 160. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. | English | Chinese | Japan | Korean | - 162 - Test Information Co., Ltd. All rights reserved.
  • 162.
    The application usesSession objects. You are modifying the application to run on a Web farm. You need to ensure that the application can access the Session objects from all the servers in the Web farm. You also need to ensure that when any server in the Web farm restarts or stops responding, the Session objects are not lost. What should you do? A. Use the InProc Session Management mode to store session data in the ASP.NET worker process. B. Use the SQLServer Session Management mode to store session data in a common Microsoft SQL Server 2005 database. C. Use the SQLServer Session Management mode to store session data in an individual database for each Web server in the Web farm. D. Use the StateServer Session Management mode to store session data in a common State Server process on a Web server in the Web farm. Answer: B 161. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. The Web site uses C# as the programming language. You plan to add a code file written in Microsoft VB.NET to the application. This code segment will not be converted to C#. You add the following code fragment to the Web.config file of the application. <compilation debug="false"> <codeSubDirectories> <add directoryName="VBCode"/> </codeSubDirectories> </compilation> You need to ensure that the following requirements are met: ¡¤The existing VB.NET file can be used in the Web application ¡¤The file can be modified and compiled at run time What should you do? A. ¡¤Create a new folder named VBCode at the root of the application | English | Chinese | Japan | Korean | - 163 - Test Information Co., Ltd. All rights reserved.
  • 163.
    ¡¤Place the VB.NETcode file n this new folder. B. ¡¤Create a new folder named VBCode inside the App_Code folder of the application ¡¤Place the VB.NET code file in this new folder C. ¡¤Create a new class library that uses VB.NET as the programming language ¡¤Add the VB.NET code ile to the class library. ¡¤Add a reference to the class library in the application D. ¡¤ C ea e a ne w Mcr oso r t i ft Wndo w Co mm i ca on Founda on ( W ) se v ce p o ec t ha uses i s un ti ti CF ri r j t t VB.NET as the programming language. ¡¤Expose the VB.NET code functionalitythrough the WCF service. ¡¤Add a service reference to the WCF service project in the application Answer: B 162. You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. The Web site uses C# as the programming language. You plan to add a code file written in Microsoft VB.NET to the application. This code segment will not be converted to C#. You add the following code fragment to the Web.config file of the application. <compilation debug="false"> <codeSubDirectories> <add directoryName="VBCode"/> </codeSubDirectories> </compilation> You need to ensure that the following requirements are met: ¡¤The existing VB.NET file can be used in the Web application ¡¤The file can be modified and compiled at run time What should you do? A. ¡¤Create a new folder named VBCode at the root of the application ¡¤Place the VB.NET code file in this new folder B. ¡¤Create a new folder named VBCode inside the App_Code folder of the application | English | Chinese | Japan | Korean | - 164 - Test Information Co., Ltd. All rights reserved.
  • 164.
    ¡¤Place the VB.NETcode file in his new folder. C. ¡¤Create a new class library that uses VB.NET as the programming language ¡¤Add the VB.NET code file to the class library ¡¤Add a reference to the class library in the application D. ¡¤ C ea e a ne w Mcr oso r t i ft Wndo w Co mm i ca on Fundation (WCF) service project that uses i s un ti VB.NET as the programming language. ¡¤Expose the VB.NET code functionality through the WCF service ¡¤Add a service reference to the WCF service project in the application Answer: B 163. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application uses a set of general-purpose utility classes that implement business logic. These classes are modified frequently. You need to ensure that the application is recompiled automatically when a utility class is modified. What should you do? A. ¡¤Create the Web application by using a Microsoft Visual Studio ASP.NET Web site ¡¤Add the utility classes to the App_Code subfolder of the Web application B. ¡¤Create the Web aplication by using a Microsoft Visual Studio ASP.NET Web Application project. ¡¤Add the utility classes to the App_Code subfolder of the Web application C. ¡¤Create the Web application by using a Microsoft Visual Studio ASP.NET Web site ¡¤Add the utilty classes to the root folder of the Web application. D. ¡¤Create the Web application by using a Microsoft Visual Studio ASP.NET Web Application project ¡¤Add the utility classes to the root folder of the Web application Answer: A 164. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application uses a set of general-purpose utility classes that implement business logic. These classes are modified frequently. You need to ensure that the application is recompiled automatically when a utility class is modified. What should you do? | English | Chinese | Japan | Korean | - 165 - Test Information Co., Ltd. All rights reserved.
  • 165.
    A. ¡¤Create theWeb application by using a Microsoft Visual Studio ASP.NET Web site ¡¤Add the utility classes to the App_Code subfolder of the Web application B. ¡¤Create the Wb application by using a Microsoft Visual Studio ASP.NET Web Application project. ¡¤Add the utility classes to the App_Code subfolder of the Web application C. ¡¤Create the Web application by using a Microsoft Visual Studio ASP.NET Web site ¡¤Add theutility classes to the root folder of the Web application. D. ¡¤Create the Web application by using a Microsoft Visual Studio ASP.NET Web Application project ¡¤Add the utility classes to the root folder of the Web application Answer: A 165. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You add a Web page named HomePage.aspx in the application. The Web page contains different controls. You add a newly created custom control named CachedControl to the Web page. You need to ensure that the following requirements are met: ¡¤The custom control state remains static for one minute ¡¤The custom control settings do not affect the cache settings of other elements in the Web page What should you do? A. Add the following code fragment to the Web.config file of the solution. <caching> <outputCacheSettings> <outputCacheProfiles> <add name="CachedProfileSet" varyByControl="CachedControl" duration="60" /> </outputCacheProfiles> </outputCacheSettings> </caching> B. Add the following code fragment to the Web.config file of the solution. | English | Chinese | Japan | Korean | - 166 - Test Information Co., Ltd. All rights reserved.
  • 166.
    <caching> <outputCacheSettings> <outputCacheProfiles> <add name="CachedProfileSet" varyByParam="CachedControl" duration="60" /> </outputCacheProfiles> </outputCacheSettings> </caching> C. Add a class named ProfileCache that inherits from the ConfigurationSection class to the HomePage.aspx.cs page. Add the following to the Web.config file of the solution. <ProfileCache profile="CachedProfileSet" varyByControl="CachedControl" duration="60"> </ProfileCache> <caching> <outputCache enableOutputCache="true"/> </caching> D. Add a class named ProfileCache that inherits from the ConfigurationSection class to the HomePage.aspx.cs page. Add the following code fragment to the Web.config file of the solution. <ProfileCache profile="CachedProfileSet" varyByParam="CachedControl" duration="60"> </ProfileCache> <caching> <outputCache enableOutputCache="true"/> </caching> Answer: A 166. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. | English | Chinese | Japan | Korean | - 167 - Test Information Co., Ltd. All rights reserved.
  • 167.
    You add aWeb page named HomePage.aspx in the application. The Web page contains different controls. You add a newly created custom control named CachedControl to the Web page. You need to ensure that the following requirements are met: ¡¤The custom control state remains static for one minute ¡¤The custom control settings do not affect the cache settings of other elements in the Web page What should you do? A. Add the following code fragment to the Web.config file of the solution. <caching> <outputCacheSettings> <outputCacheProfiles> <add name="CachedProfileSet" varyByControl="CachedControl" duration="60" /> </outputCacheProfiles> </outputCacheSettings> </caching> B. Add the following code fragment to the Web.config file of the solution. <caching> <outputCacheSettings> <outputCacheProfiles> <add name="CachedProfileSet" varyByParam="CachedControl" duration="60" /> </outputCacheProfiles> </outputCacheSettings> </caching> C. Add a class named ProfileCache that inherits from the ConfigurationSection class to the | English | Chinese | Japan | Korean | - 168 - Test Information Co., Ltd. All rights reserved.
  • 168.
    HomePage.aspx.cs page. Add thefollowing to the Web.config file of the solution. <ProfileCache profile="CachedProfileSet" varyByControl="CachedControl" duration="60"> </ProfileCache> <caching> <outputCache enableOutputCache="true"/> </caching> D. Add a class named ProfileCache that inherits from the ConfigurationSection class to the HomePage.aspx.cs page. Add the following code fragment to the Web.config file of the solution. <ProfileCache profile="CachedProfileSet" varyByParam="CachedControl" duration="60"> </ProfileCache> <caching> <outputCache enableOutputCache="true"/> </caching> Answer: A | English | Chinese | Japan | Korean | - 169 - Test Information Co., Ltd. All rights reserved.