TS: Microsoft .NET Framework 3.5, ASP.NET Application Development C#                  itcertification39@gmail.com (IT Chan...
Exam AQUESTION 1You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.You create a ...
D. Insert the following code segment at line 06.   OnDataBound="FmtClr" Insert the following code segment at line 02.   pr...
<form id="form1" runat="server"><div><asp:Label ID="lblHeader" runat="server"></asp:Label><asp:Label ID="lbFooter" runat="...
Which method should you add to the Web page?A. protected override object SaveViewState() {   LoadControls(); return base.S...
A. protected override void CreateChildControls() {   Controls.Clear();   OrderFormData oFData = new OrderFormData("OrderFo...
D. CheckOrderFormEventHandler checkOrderForm = new CheckOrderFormEventHandler   (checkOrderFormCallBack);   protected virt...
The validation logic for the control is implemented in the Validate method in the following manner.protected static bool V...
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />You need to ensure that when you click the...
A. Add the following code segment to the Calendar1 DayRender event handler.   if (e.Day.IsWeekend) {   Day.IsSelectable = ...
B. XmlReader xr = XmlReader.Create(xmlStream);   Product boughtProduct = xr.ReadContentAs(typeof(Product), null) as Produc...
You create a class that contains the following code segment. (Line numbers are included for reference only.)01 public obje...
A. gvProducts.DataSource = rdr;   gvProducts.DataBind();   gvCategories.DataSource = rdr;   gvCategories.DataBind();B. gvP...
B. DataSet ds = Session["ds"] as DataSet;   DataView dv = ds.Tables[0].DefaultView;   dv.RowFilter = "CityName LIKE " + tx...
service contract. (Line numbers are included for reference only.)01 [ServiceContract]02 public interface IBlogService03 {0...
C. protected override object Evaluate(HttpContext context, Control control) { return DateTime.Now; }D. protected override ...
The application contains two Web pages named OrderDetails.aspx and OrderError.htm.If the application throws unhandled erro...
A. protected void btnSubmit_Click(object sender, EventArgs e) {     Label1.Text = "Label1 updated value";     Label2.Text ...
A. <script type="text/javascript" language="javascript">   var rm = Sys.WebForms.PageRequestManager.getInstance();   rm.ad...
}You embed the CalculatorScript.js file as a resource in a Class Library project.The namespace for this project is Calcula...
D. ScriptManager.RegisterClientScriptBlock(txtInfo, typeof(TextBox), "txtInfo_Script", generatedScript, false);Answer: DEx...
A. public void ObjectListCtrl_ItemCommand( object sender, ObjectListCommandEventArgs e) {   if (e.CommandName == "CmdDispl...
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.The application allows users ...
You need to ensure that the state of the SharedControl control can persist on the pages that reference amaster page.Which ...
response may be supplied from a shared cache.Private Default value. Sets Cache-Control: private to specify that the respon...
C. lstLanguages.PreRender += new EventHandler(BindData);D. lstLanguages.SelectedIndexChanged += new EventHandler(BindData)...
Which code fragment should you use?A. <httpHandlers> <add verb="*.media" path="*" validate="false" type="Contoso.Web.UI.  ...
You need to install the database elements for both the providers on the local computer.What should you do?A.   Run the sql...
B. Add a working directory in the property pages of the project to the location of the missing assembly.C. Change the outp...
Which two actions should you perform? (Each correct answer presents part of the solution.Choose two.)A.   Create a new app...
You need to ensure that the child controls of the server control are uniquely identified within the controlhierarchy of th...
C. Set the following value in the Web.config file.   <system.web> <pages validateRequest="false"/> </system.web>D. Set the...
</Movies>You add a Web form to the application.You write the following code segment in the Web form. (Line numbers are inc...
Explanation/Reference:QUESTION 55You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version ...
Answer: BExplanation/Reference:QUESTION 57You create a Microsoft ASP.NET application by using the Microsoft .NET Framework...
A.   Attach Microsoft Visual Studio.NET to the w3wp.exe process.B.   Attach Microsoft Visual Studio.NET to the inetinfo.ex...
A.   Clear the Disable Script Debugging (Other) check box.B.   Clear the Disable Script Debugging (Internet Explorer) chec...
A.   <identity impersonate="true" />B.   <anonymousIdentification enabled="true" />C.   <roleManager enabled="true"default...
70562 Questions
70562 Questions
70562 Questions
70562 Questions
70562 Questions
70562 Questions
70562 Questions
70562 Questions
70562 Questions
70562 Questions
70562 Questions
Upcoming SlideShare
Loading in...5
×

70562 Questions

752

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
752
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
50
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

70562 Questions

  1. 1. TS: Microsoft .NET Framework 3.5, ASP.NET Application Development C# itcertification39@gmail.com (IT Chanakya)
  2. 2. Exam AQUESTION 1You 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 forreference only.)01 <script runat="server">0203 </script>04 <asp:ListView ID="ListView1" runat="server"05 DataSourceID="SqlDataSource1"0607 >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. Thedatabase table has a column named LineTotal.You need to ensure that when the size of the LineTotal column value is greater than seven characters, thecolumn 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"); 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; } } itcertification39@gmail.com (IT Chanakya)
  3. 3. 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: AExplanation/Reference:QUESTION 2You 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 {0405 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: BExplanation/Reference:QUESTION 3You 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 aWeb page named Default.aspx.<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><html> ...<body> itcertification39@gmail.com (IT Chanakya)
  4. 4. <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);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: DExplanation/Reference:QUESTION 4You 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 theserver.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) { 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. itcertification39@gmail.com (IT Chanakya)
  5. 5. 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); }C. protected override void OnLoadComplete(EventArgs e) { base.OnLoadComplete(e); LoadControls(); }D. protected override void LoadViewState(object savedState) { base.LoadViewState(savedState); LoadControls(); }Answer: DExplanation/Reference:QUESTION 5You 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 MyControlclass. (Line numbers are included for reference only.)01 protected override void02 CreateChildControls() {03 Controls.Clear();04 OrderFormData oFData = new05 OrderFormData("OrderForm");0607 }You need to add the OrderFormData control to the MyControl control.Which code segment should you insert at line 06?A. Template.InstantiateIn(this); this.Controls.Add(oFData);B. Template.InstantiateIn(oFData); Controls.Add(oFData);C. this.TemplateControl = (TemplateControl)Template; -Cant Remember All-??? oFData.TemplateControl = (TemplateControl)Template; Controls.Add(oFData);D. this.TemplateControl = (TemplateControl)oFData; -Cant Remember All-??? Controls.Add(oFData);Answer: BExplanation/Reference:QUESTION 6You 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? itcertification39@gmail.com (IT Chanakya)
  6. 6. 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: AExplanation/Reference:QUESTION 7You 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 objectCheckOrderFormKey = 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 = 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); } itcertification39@gmail.com (IT Chanakya)
  7. 7. D. CheckOrderFormEventHandler checkOrderForm = new CheckOrderFormEventHandler (checkOrderFormCallBack); protected virtual void OnCheckOrderForm(EventArgs e) { if (checkOrderForm != null) RaiseBubbleEvent(checkOrderForm, e); }Answer: BExplanation/Reference:QUESTION 8You 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> <asp:CompareValidator ID="CompareValidator1" runat="server" Type="Date" EnableClientScript="true" ControlToValidate="TextBox1" Operator="DataTypeCheck" > </asp:CompareValidator>B. <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox1" ValidateEmptyText="True" onservervalidate="CustomValidator1_ServerValidate"> </asp: CustomValidator> <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> <asp:CompareValidator ID="CompareValidator1" runat="server" Type="Date" EnableClientScript="true" ControlToValidate="TextBox1" ValueToCompare="<%= DateTime.Now; %>"> </asp:CompareValidator>D. <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox1" ValidateEmptyText="True" onservervalidate="CustomValidator1_ServerValidate"> </asp: CustomValidator> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" EnableClientScript="false" InitialValue="<%= DateTime.Now; %>" > </asp:RequiredFieldValidator>Answer: AExplanation/Reference:QUESTION 9You 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. itcertification39@gmail.com (IT Chanakya)
  8. 8. 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; }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: CQUESTION 10You 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 void BulletedList1_Click( ?object sender, BulletedListEventArgs e) { //...}You need to add a BulletedList control named BulletedList1 to the Web page that is bound toXmlDataSource1.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" DataTextField="ID" DataValueField="Name" onclick="BulletedList1_Click"> </asp:BulletedList>Answer: CExplanation/Reference:QUESTION 11You 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> itcertification39@gmail.com (IT Chanakya)
  9. 9. <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 ListBox1control to the ListBox2 control.Which code segment should you use?A. foreach (ListItem li in ListBox1.Items) { if (li.Selected) { 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) { ListBox1.Items.Remove(li); } }F. foreach (ListItem li in ListBox1.Items) { if (ListBox2.Items.Contains(li)) ListBox1.Items.Remove(li); }Answer: CDExplanation/Reference:QUESTION 12You 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></asp:DropDownList>You also add a MultiView control named MultiView1 to the Web page. MultiView1 has three child Viewcontrols.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: AExplanation/Reference:ActiveViewIndex is Zero base Index.QUESTION 13You 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? itcertification39@gmail.com (IT Chanakya)
  10. 10. A. Add the following code segment to the Calendar1 DayRender event handler. if (e.Day.IsWeekend) { Day.IsSelectable = false; }B. Add the following code segment to the Calendar1 DayRender event handler. if (e.Day.IsWeekend) { 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: AExplanation/Reference:QUESTION 14You 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(); itcertification39@gmail.com (IT Chanakya)
  11. 11. B. XmlReader xr = XmlReader.Create(xmlStream); Product boughtProduct = xr.ReadContentAs(typeof(Product), null) as Product; 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: CExplanation/Reference:QUESTION 15You 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 includedfor reference only.)01 public object GetData() {02 SqlConnection cnn = new SqlConnection( )03 string strQuery = "SELECT * FROM Products";0405 }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: CExplanation/Reference:QUESTION 16You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. itcertification39@gmail.com (IT Chanakya)
  12. 12. You create a class that contains the following code segment. (Line numbers are included for reference only.)01 public object GetCachedProducts(sqlConnection conn) {0203 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 }1314 public object GetData(SqlCommand prodCmd) {1516 }Each time a Web form has to access a list of products, the GetCachedProducts method is called to providethis 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];D. SqlDataAdapter da = new SqlDataAdapter(prodCmd); DataSet ds = new DataSet(); da.Fill(ds); return ds;Answer: DExplanation/Reference:QUESTION 17You 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 areincluded 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();0607 rdr.Close();08 cnn.Close();You need to ensure that the gvProducts and gvCategories GridView controls display the data that is containedin the following two database tables:The Products database tabl The Categories database tabl Which code segment should you insert at line 06? itcertification39@gmail.com (IT Chanakya)
  13. 13. 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: DExplanation/Reference:QUESTION 18You 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 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 {1213 }You need to ensure that when the btnSearch Button control is clicked, the records in the gridCities GridViewcontrol 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(); itcertification39@gmail.com (IT Chanakya)
  14. 14. B. DataSet ds = Session["ds"] as DataSet; 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: BExplanation/Reference:QUESTION 19You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. Theapplication 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") ; 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: AExplanation/Reference:QUESTION 20You 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 itcertification39@gmail.com (IT Chanakya)
  15. 15. service contract. (Line numbers are included for reference only.)01 [ServiceContract]02 public interface IBlogService03 {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/BlogServiceYou need to store the result of the GetBlog operation in an XmlDocument variable named xmlBlog in a Webform.Which code segment should you use?A. string url = @"http: //www.contoso.com/BlogService/GetBlog"; XmlReader blogReader = XmlReader.Create(url); 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: AExplanation/Reference:QUESTION 21You 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 : 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); } itcertification39@gmail.com (IT Chanakya)
  16. 16. C. protected override object Evaluate(HttpContext context, Control control) { return DateTime.Now; }D. protected override Parameter Clone() { Parameter pm = new DayParameter(); pm.DefaultValue = DateTime.Now; return pm; }Answer: CExplanation/Reference:QUESTION 22You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. Theapplication 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) { 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: ADExplanation/Reference:It is better to use Try/Catch blocks around any code that is subject to errors instead of relying on a global errorhandler.An error handler that is defined in the Global.asax file will only catch errors that occur during processing ofrequests by the ASP.NET runtime. For example, it will catch the error if a user requests an .aspx file that doesnot occur in your application. However, it does not catch the error if a user requests a nonexistent .htm file.For non-ASP.NET errors, you can create a custom handler in Internet Information Services (IIS). The customhandler will also not be called for server-level errors.You cannot directly output error information for requests from the Global.asax file; you must transfer control toanother page, typically a Web Forms page. When transferring control to another page, use Transfer method.This preserves the current context so that you can get error information from the GetLastError method.After handling an error, you must clear it by calling the ClearError method of the Server object(HttpServerUtility class).QUESTION 23You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. itcertification39@gmail.com (IT Chanakya)
  17. 17. 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 toremote users.You need to ensure that the OrderError.htm Web page is displayed for unhandled errors only in theOrderDetails.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" 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: CExplanation/Reference:DebugIndicates whether the page should be compiled with debug symbols. true if the page should be compiled withdebug symbols; otherwise, false. Because this setting affects performance, you should only set the attribute totrue during development.ErrorPageDefines a target URL for redirection if an unhandled page exception occurs.QUESTION 24You 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 isasynchronously updatable.Which code segment should you use? itcertification39@gmail.com (IT Chanakya)
  18. 18. 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); Label3.Text = "Label3 updated value"; }Answer: BExplanation/Reference:Use the RegisterDataItem method to send data from the server to the client during asynchronous postbacks,regardless of whether the control receiving the data is inside an UpdatePanel control.Use RegisterAsyncPostBackControl for Registers a control as a trigger for asynchronous postbacks.QUESTION 25You 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 includedfor reference only.)01 <script runat="server">02 protected void Button_Handler(object sender, EventArgs e)03 {04 // some long-processing operation.05 }06 </script>07 <div>08 <asp:ScriptManager ID="defaultScriptManager"09 runat="server" />1011 <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 btnSubmitButton control are suppressed.Which code fragment should you insert at line 10? itcertification39@gmail.com (IT Chanakya)
  19. 19. 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); 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: CExplanation/Reference:rm.abortPostBack(); Cancel the postback that is currently runningargs.set_cancel(true); Cancel this postbackQUESTION 26You 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; } return a/b; itcertification39@gmail.com (IT Chanakya)
  20. 20. }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 theJavaScript 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 theresource 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: CExplanation/Reference:QUESTION 27You 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 forreference only.)01 protected void Page_Load(object sender, EventArgs e)02 {03 if(IsPostBack)04 {05 string generatedScript = ScriptGenerator.GenerateScript();0607 }08 }You need to ensure that the client-script code is registered only when an asynchronous postback is issued onthe 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), "txtInfo_Script", generatedScript); itcertification39@gmail.com (IT Chanakya)
  21. 21. D. ScriptManager.RegisterClientScriptBlock(txtInfo, typeof(TextBox), "txtInfo_Script", generatedScript, false);Answer: DExplanation/Reference:QUESTION 28You 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); }}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") { }Answer: AExplanation/Reference:QUESTION 29You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. Theapplication 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 theCmdDisplayDetails item.Which code segment should you write? itcertification39@gmail.com (IT Chanakya)
  22. 22. A. public void ObjectListCtrl_ItemCommand( object sender, ObjectListCommandEventArgs e) { if (e.CommandName == "CmdDisplayDetails") { }}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: AExplanation/Reference:QUESTION 30You 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 navigationmenu to browse the site.You need to ensure that the content pages can optionally replace the static navigation menu with their ownmenu 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> 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);B. Add the following code fragment to the master page <asp:ContentPlaceHolder ID="MenuPlaceHolder" runat="server"> <!-- Menu code here --> </asp:ContentPlaceHolder> Add the following code fragment to the content page <asp:Content ContentPlaceHolderID="MenuPlaceHolder"> <asp:menu ID="menuControl" runat="server"> </ asp: menu </asp:Content>C. Add the following code fragment to the master page <asp:ContentPlaceHolder ID="MenuPlaceHolder" runat="server"> <!-- Menu code here --> </asp:ContentPlaceHolder> 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);D. Add the following code fragment to the master page <asp:PlaceHolder ID="MenuPlaceHolder" runat="server"> <!-- Menu code here --> </asp:ContentPlaceHolder> Add the following code fragment to the content page <asp:Content PlaceHolderID="MenuPlaceHolder"> <asp:menu ID="menuControl" runat="server"> </ asp: menu </asp:Content>Answer: BExplanation/Reference:QUESTION 31 itcertification39@gmail.com (IT Chanakya)
  23. 23. 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;0405 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 userscomment.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: DExplanation/Reference:QUESTION 32You 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.resxresource file in the App_GlobalResources folder. The ImageResources.resx file contains a localized resourcenamed 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");D. string logoImageUrl = (string)GetLocalResource("ImageResources.LogoImageUrl");Answer: CExplanation/Reference:QUESTION 33You 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 referenceonly.)01 protected override void OnInit(EventArgs e)02 {03 base.OnInit(e);0405 }All the master pages in the ASP.NET application contain the following directive.<%@ Master Language="C#" EnableViewState="false" %> itcertification39@gmail.com (IT Chanakya)
  24. 24. You need to ensure that the state of the SharedControl control can persist on the pages that reference amaster 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: BExplanation/Reference:QUESTION 34You 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 thedata 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 forreference only.)01 protected void Page_Load(object sender, EventArgs e)02 {03 string connstr;0405 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 = new12 SqlCacheDependency("Region", "Location");13 Response.Cache.SetExpires(expires);14 Response.Cache.SetValidUntilExpires(true);15 Response.AddCacheDependency(dependency);1617 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);D. Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate);Answer: BExplanation/Reference:HttpCacheabilityNoCache Sets the Cache-Control: no-cache header. Without a field name, the directive applies to the entirerequest and a shared (proxy server) cache must force a successful revalidation with the origin Web serverbefore satisfying the request. With a field name, the directive applies only to the named field; the rest of the itcertification39@gmail.com (IT Chanakya)
  25. 25. response may be supplied from a shared cache.Private Default value. Sets Cache-Control: private to specify that the response is cacheable only on the clientand not by shared (proxy server) caches.Server Specifies that the response is cached only at the origin server. Similar to the NoCache option. Clientsreceive a Cache-Control: no-cache directive but the document is cached on the origin server. Equivalent toServerAndNoCache.ServerAndNoCache Applies the settings of both Server and NoCache to indicate that the content is cachedat the server but all others are explicitly denied the ability to cache the response.Public Sets Cache-Control: public to specify that the response is cacheable by clients and shared (proxy)caches.ServerAndPrivate Indicates that the response is cached at the server and at the client but nowhere else.Proxy servers are not allowed to cache the response.QUESTION 35You 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);Answer: DExplanation/Reference:QUESTION 36You 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. 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); itcertification39@gmail.com (IT Chanakya)
  26. 26. C. lstLanguages.PreRender += new EventHandler(BindData);D. lstLanguages.SelectedIndexChanged += new EventHandler(BindData);Answer: AExplanation/Reference:QUESTION 37You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. Theapplication 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"); }Answer: AQUESTION 38You 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 TextBoxcontrol.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: DQUESTION 39You 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 theIHttpHandler 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 havethe .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. itcertification39@gmail.com (IT Chanakya)
  27. 27. 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" /> </httpHandlers>Answer: CQUESTION 40You 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 byusing the following code segment. (Line numbers are included for reference only.)01 public void ProcessRequest(HttpContext ctx) {0203 }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); } 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: CExplanation/Reference:QUESTION 41You 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 Server2005. The instance uses Windows Authentication. You plan to configure the membership providers and therole management providers. itcertification39@gmail.com (IT Chanakya)
  28. 28. 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: DQUESTION 42You 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 Salesgroup 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: CQUESTION 43You 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 untrusteddomains.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>D. <system.web> <authentication mode="Windows"> </authentication> <authorization> <deny users="*" /> </ authorization> </system.web>Answer: AQUESTION 44You are maintaining a Microsoft ASP.NET Web Application that was created by using the Microsoft .NETFramework version 3.5.You obtain the latest version of the project from the source control repository. You discover that an assemblyreference 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. itcertification39@gmail.com (IT Chanakya)
  29. 29. 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: AQUESTION 45You have a Microsoft ASP.NET Framework version 1.0 application. The application does not use any featuresthat 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 theapplication.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: AQUESTION 46You 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="UseCookies" sqlConnectionString="Integrated Security=SSPI;data source=MySqlServer;"/>D. <sessionState mode="SQLServer"cookieless="UseUri" sqlConnectionString="Integrated Security=SSPI; data source=MySqlServer;"/>Answer: CExplanation/Reference:When you configure an AJAX-enabled ASP.NET Web site, use only the default value of UseCookies for thecookieless attribute. Settings that use cookies encoded in the URL are not supported by the ASP.NET AJAXclient script libraries.QUESTION 47You 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 isolationmode, 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 IISAdministration Tool to reconfigure your server to run the application in a separate process." You need toensure that the following requirements are met:All the applications run on the server All the applications remain in process isolation mode All theapplications do not change their configuration. itcertification39@gmail.com (IT Chanakya)
  30. 30. 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: ACQUESTION 48You 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 aprimary 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 referenceonly.)01 <asp:DetailsView ID="DetailsView1" runat="server"02 DataSourceID="LinqDataSource1"0304 />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"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: BExplanation/Reference:QUESTION 49You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.You create a custom-templated server control. itcertification39@gmail.com (IT Chanakya)
  31. 31. You need to ensure that the child controls of the server control are uniquely identified within the controlhierarchy of the page.Which interface should you implement?A. the ITemplatable interfaceB. the INamingContainer interfaceC. the IRequiresSessionState interfaceD. the IPostBackDataHandler interfaceAnswer: BQUESTION 50You 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:RequiredFieldValidator02 ID="rfValidator1" runat="server"03 Display="Dynamic" ControlToValidate="TextBox1"0405 >0607 </asp:RequiredFieldValidator>0809 <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 thevalidation summary list.What should you do?A. Add the following code segment to line 06. Required text in TextBox1B. 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: CExplanation/Reference:QUESTION 51You 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 applicationsthat 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" itcertification39@gmail.com (IT Chanakya)
  32. 32. 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: CExplanation/Reference:The request validation feature of ASP.NET 1.1 prevents the server from accepting content that containsunencoded HTML. You can disable request validation by setting the validateRequest attribute to false in the@ Page directive or in the configuration section.Disable Request Validation on a PageTo disable request validation on a page, you must set the validateRequest attribute of the @ Page directiveto false:<%@ Page validateRequest="false" %>Note When request validation is disabled, content is submitted to a page. The page developer must makesure that the content is correctly encoded or is correctly processed.Disable Request Validation for Your ApplicationTo disable request validation for your application, you must modify or create a Web.config file for yourapplication and then set the validateRequest attribute of the <PAGES /> section to false:QUESTION 52You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. Theapplication 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 cancommunicate 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" binding="wsDualHttpBinding" / </client>Answer: BQUESTION 53You 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> itcertification39@gmail.com (IT Chanakya)
  33. 33. </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:xmldatasource03 id="XmlDataSource1"04 runat="server"05 datafile="movies.xml" />0607 </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" /> </DataBindings> </asp:TreeView>D. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="MovDataSource1"> <DataBindings> <asp:TreeNodeBinding DataMember="Movies" Text="Desc" /> </DataBindings> </asp:TreeView>Answer: AExplanation/Reference:QUESTION 54You 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:EmployeIDFirstNamLastNamThe 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 itcertification39@gmail.com (IT Chanakya)
  34. 34. Explanation/Reference:QUESTION 55You 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 SQLServer 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"0405 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: BExplanation/Reference:QUESTION 56You 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 bemodified 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"/><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. itcertification39@gmail.com (IT Chanakya)
  35. 35. Answer: BExplanation/Reference:QUESTION 57You 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"> <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: BExplanation/Reference:QUESTION 58You 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 pagesare 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: BExplanation/Reference:ensure that during the initial request to the application, the code-behind files for the Web pages are compiledis Batch="True" (Batch default=true)You also need to optimize the performance of the application.is Debug="false" (Debug default=false)QUESTION 59You 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 remotedebugging on the ContosoTest server.You need to debug the application remotely from another computer named ContosoDev.What should you do? itcertification39@gmail.com (IT Chanakya)
  36. 36. 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: AQUESTION 60You 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 namedContosoUser.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: CQUESTION 61You 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 theJavaScript 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: DExplanation/Reference:displays the details of the client-side object on the debugger console.Object use Sys.Debug.traceDump method.if Display Text use Sys.Debug.trace method.QUESTION 62You 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.) itcertification39@gmail.com (IT Chanakya)
  37. 37. 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: BEQUESTION 63You 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 andnot 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: CExplanation/Reference:is accessible only when the user is logged on to the Web serveris localOnly="true" (default=true)not on individual Web pages.is pageOutput="false" (default=false)QUESTION 64You 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: BQUESTION 65You 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.0application 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? itcertification39@gmail.com (IT Chanakya)
  38. 38. A. <identity impersonate="true" />B. <anonymousIdentification enabled="true" />C. <roleManager enabled="true"defaultProvider="AspNetWindowsTokenRolePRovider" />D. <authorization> <allow users="*" /> </authorization>Answer: AQUESTION 66You 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 inthe 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 completesolution. 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: CDFQUESTION 67You 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: DExplanation/Reference: itcertification39@gmail.com (IT Chanakya)

×