Exam 70-562 : Microsoft .NET Framework 3.5, ASP.NET Application Development – 8

Question: You work as an application developer at Company.com. The previous developer created an ASP.NET application using .NET Framework 3.5. You receive an instruction from management to create a Web page that will be used to display images and a description of the image. You have to make sure that the descriptions for the images can be edited through the application. You then write the code below (The line numbers is included for reference purposes):
01 <asp:FormView DataSourceID=”ds1″ DataKeyNames=”ImgID” runat=”server”>
02 <EditItemTemplate>
03 <asp:TextBox Text='<%# Bind(“Descr”) %>’ runat=”server”/>
04 <asp:Button Text=”Update” CommandName=”Update” runat=”server”/>
05 <asp:Button Text=”Cancel” CommandName=”Cancel” runat=”server”/>
06 </EditItemTemplate>
07 <ItemTemplate>
08 <asp:Label Text='<%# Eval(“Descr”) %>’ runat=”server” />
09 <asp:Button Text=”Edit” CommandName=”Edit” runat=”server”/>
10 </ItemTemplate>
11 </asp:FormView>
When you try to access the Web page you experience a problem with the application. To ensure productivity you need to make sure that the application is able to update every description effectively as well as storing it in the database.
What should you do?

  1. This can be accomplished by replacing line 08 with the following:
    <asp:Label ID=”lbl1″ Text='<%# Eval(“Descr”) %>’ runat=”server” />
  2. This can be accomplished by replacing line 08 with the following:
    <asp:Label Text='<%# Bind(“Descr”) %>’ runat=”server” />
  3. This can be accomplished by replacing line 03 with the following:
    <asp:TextBox ID=”txtBox1″ Text='<%# Bind(“Descr”) %>’ runat=”server”/>
  4. This can be accomplished by replacing line 03 with the following:
    <asp:TextBox Text='<%# Eval(“Descr”) %>’ runat=”server”/>

Correct Answer: 3


Question: You work as a Web Application Developer at Company.com. A previous developer created a Microsoft ASP.NET application that uses Microsoft .NET Framework 3.5. Your application contains a Web form with the code below:

<asp:TextBox runat="server" ID="txtBox1" />
<asp:Button runat="server" ID="btnSubmit" Text="Submit" OnClick="btnSubmit_Click" />
<asp:GridView runat="server" ID="gv1" /> 

The code-behind file for the Web form contains the code below:
1 protected void Page_Load(object sender, EventArgs e)
2 {
3 DataSet ds1 = new DataSet();
4 SqlDataAdapter da1 = new SqlDataAdapter(cmd);
5 da1.Fill(ds1);
6 gv1.DataSource = ds1;
7 bv1.DataBind();
8 Session[“ds”] = ds1;
9 }
10 protected void btnSubmit_Click(object sender, EventArgs e)
11 {
12 // add code here
13 }
You have to make sure that the records in the gv1 GridView control are filtered by the value of the txtBox1 TextBox as soon as a Company.com user click the btnSubmit Button control. You need to determine the appropriate code that must be added to the code-behind file.
What should you do?

  1. You should consider adding:
    DataTable dtbl = Session[“ds”] as DataTable;
    DataView dview = dtbl.DefaultView;
    dview.RowFilter = “Value LIKE ‘” + txtBox1.Text + “%'”;
    gv1.DataSource = dview;
    gv1.DataBind();
  2. You should consider adding:
    DataSet dset = Session[“ds”] as DataSet;
    DataTable dtbl = dset.Tables[0];
    DataRow[] rows = dtbl.Select(“Value LIKE ‘” + txtBox1.Text + “%'”);
    gv1.DataSource = rows;
    gv1.DataBind();
  3. You should consider adding:
    DataSet dset = gv1.DataSource as DataSet;
    DataView dview = dset.Tables[0].DefaultView;
    dview.RowFilter = “Value LIKE ‘” + txtBox1.Text + “%'”;
    gv1.DataSource = dview;
    gv1.DataBind();
  4. You should consider adding:
    DataSet dset = Session[“ds”] as DataSet;
    DataView dview = dset.Tables[0].DefaultView;
    dview.RowFilter = “Value LIKE ‘” + txtBox1h.Text + “%'”;
    gv1.DataSource = dview;
    gv1.DataBind();

Correct Answer: 4


Question: You work as an application developer at Company.com. You are currently using Microsoft .NET Framework 3.5 to create an ASP.NET application for mobile devices. You create a device filter element in the Web.config file of the application as shown below:

<filter name="isHtml" compare="PreferredRenderingType" argument="html32" /> 

You a Web page named Display.aspx to the application. You add the following Image control to the Web page:

<mobile:Image ID="ic1" Runat="server">
// add code here
</mobile:Image> 

You have to make sure that the ic1 Image control displays the bg.jpg file when the Web browser supports html or bg.gif when html is not supported. You thus need to determine the appropriate DeviceSpecific element that has to be added to the Image control.
What should you do?

  1. Your best option would be to add:
    <DeviceSpecific>
    <Choice Filter=”PreferredRenderingType” ImageUrl=”bg.jpg” />
    <Choice ImageUrl=”bg.gif” />
    </DeviceSpecific>
  2. Your best option would be to add:
    <DeviceSpecific>
    <Choice Filter=”isHtml” ImageUrl=”bg.jpg” />
    <Choice ImageUrl=”bg.gif” />
    </DeviceSpecific>
  3. Your best option would be to add:
    <DeviceSpecific>
    <Choice Filter=”isHtml” Argument=”false” ImageUrl=”bg.jpg” />
    <Choice Filter=”isHtml” Argument=”true” ImageUrl=”bg.gif” />
    </DeviceSpecific>
  4. Your best option would be to add:
    <DeviceSpecific>
    <Choice Filter=”PreferredRenderingType” Argument=”false” ImageUrl=”bg.jpg” />
    <Choice Filter=”PreferredRenderingType” Argument=”true” ImageUrl=”bg.gif” />
    </DeviceSpecific>

Correct Answer: 2


Question: You work as an application developer at Company.com. You make use of .NET Framework 3.5 to create an ASP.NET application. You write the code below in order to add a Calendar server control to the Web page.

<asp:Calendar SelectionMode="DayWeek" ID="Cnd1" runat="server">
</asp:Calendar> 

You receive an instruction to disable the weekends in the Calendar control. You thus need to determine the appropriate code you need to add to the Cnd1 DayRender event handler.
What should you do?

  1. You should consider adding:
    if (e.Day.IsWeekend) {
    if (Cnd1.SelectedDates.Contains(e.Day.Date))
    Cnd1.SelectedDates.Remove(e.Day.Date);
    }
  2. You should consider adding:
    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);
    }
  3. You should consider adding:
    if (e.Day.IsWeekend) {
    e.Day.IsSelectable = false;
    }
  4. You should consider adding:
    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);
    }

Correct Answer: 3


Question: You are the newly appointed application developer at Company.com. The previous developer created an ASP.NET application using .NET Framework 3.5. You add the code segment below to the application:

<asp:ScriptManager ID="ScMan1" runat="server" />
<asp:UpdatePanel ID="updateLbl" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Lbl1" runat="server" />
<asp:Label ID="Lbl2" runat="server" />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" onclick="btnSubmit_Click" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:Label id="Lbl3" runat="server" /> 

You have to make sure that every Label control value is asynchronous updatable as soon as the btnSubmit Button control is selected.
What should you do?

  1. You should consider using the following code segment:
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
    Lbl1.Text = “Value 1 updated”;
    Lbl2.Text = “Value 2 updated”;
    ScMan1.RegisterDataItem(Lbl3, “Value 3 updated”);
    }
  2. You should consider using the following code segment:
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
    Lbl1.Text = “Value 1 updated”;
    Lbl2.Text = “Value 2 updated”;
    ScMan1.RegisterAsyncPostBackControl(Lbl3);
    Lbl3.Text = “Value 3 updated”;
    }
  3. You should consider using the following code segment:
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
    ScMan1.RegisterDataItem(Lbl1, “Value 1 updated”);
    ScMan1.RegisterDataItem(Lbl2, “Value 2 updated”);
    Lbl3.Text = “Value 3 updated”;
    }
  4. You should consider using the following code segment:
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
    Lbl1.Text = “Value 1 updated”;
    Lbl2.Text = “Value 2 updated”;
    Lbl3.Text = “Value 3 updated”;
    }

Correct Answer: 1

Tagged . Bookmark the permalink.

Leave a Reply