70-562

54
Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98 Page 1 of 54 Question: 1 You are an application developer and you have about two years experience in developing Web- based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. The application must redirect the original URL to a different ASPX page. You must make sure that after the page is executed, the users cannot view the original URL. Besides this, you must make sure that only one request from the client browser is required by each page execution requires. So what action should you perform to achieve the two goals? A. You should transfer execution to the correct ASPX page by using the HttpContext.Current.RewritePath method. B. Add the Location: new URL value to the Response.Headers collection. Call the Response.End() statement. Send the header to the client computer to transfer execution to the correct ASPX page. C. You should transfer execution to the correct ASPX page by using the Server.Transfer method. D. You should transfer execution to the correct ASPX page by using the Response.Redirect method. Answer: A Question: 2 You are an application developer and you have about two years experience in developing Web- based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. A Web page is created. The Web page contains the following two XML fragments. (Line numbers are used for reference only.) 1 <script runat="server"> 2 3 </script> 4 <asp:ListView ID="ListView1" runat="server" 5 DataSourceID="SqlDataSource1" 6 7 > 8 <ItemTemplate> 9 <td> 10 <asp:Label ID="WireAmountLabel" runat="server" 11 Text='<%# Eval("WireAmount") %>' /> 12 </td> 13 </ItemTemplate> From a Microsoft SQL Server 2005 database table which has a column named WireAmount , the SqlDataSource1 object retrieves the dat a. Now you receive an order from your company CIO, according to his requirement, the column must be displayed in red color when the size of the WireAmount column value is greater than seven characters. The CIO assigns this task to you that you must make sure of this. So what action should you perform? A. 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 WireAmount = new Label(); WireAmount.ID = "WireAmountLabel"; if ( WireAmount.Text.Length > 7) {WireAmount.ForeColor = Color.Red; } else {WireAmount.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){

Upload: netra-wable

Post on 26-Jul-2015

21 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 1 of 54

Question: 1 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. The application must redirect the original URL to a different ASPX page. You must make sure that after the page is executed, the users cannot view the original URL. Besides this, you must make sure that only one request from the client browser is required by each page execution requires. So what action should you perform to achieve the two goals? A. You should transfer execution to the correct ASPX page by using the

HttpContext.Current.RewritePath method. B. Add the Location: new URL value to the Response.Headers collection. Call the

Response.End() statement. Send the header to the client computer to transfer execution to the correct ASPX page.

C. You should transfer execution to the correct ASPX page by using the Server.Transfer method. D. You should transfer execution to the correct ASPX page by using the Response.Redirect

method. Answer: A Question: 2 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. A Web page is created. The Web page contains the following two XML fragments. (Line numbers are used for reference only.) 1 <script runat="server"> 2 3 </script> 4 <asp:ListView ID="ListView1" runat="server" 5 DataSourceID="SqlDataSource1" 6 7 > 8 <ItemTemplate> 9 <td> 10 <asp:Label ID="WireAmountLabel" runat="server" 11 Text='<%# Eval("WireAmount") %>' /> 12 </td> 13 </ItemTemplate> From a Microsoft SQL Server 2005 database table which has a column named WireAmount , the SqlDataSource1 object retrieves the dat a. Now you receive an order from your company CIO, according to his requirement, the column must be displayed in red color when the size of the WireAmount column value is greater than seven characters. The CIO assigns this task to you that you must make sure of this. So what action should you perform? A. 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 WireAmount = new Label(); WireAmount.ID = "WireAmountLabel"; if ( WireAmount.Text.Length > 7) {WireAmount.ForeColor = Color.Red; } else {WireAmount.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){

Page 2: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 2 of 54

Label WireAmount = (Label) e.Item.FindControl("WireAmountLabel"); if ( WireAmount.Text.Length > 7) { WireAmount.ForeColor = Color.Red; } else {WireAmount.ForeColor = Color.Black; }}

C. 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 WireAmount = (Label) e.Item.FindControl("WireAmount"); if ( WireAmount.Text.Length > 7) {WireAmount.ForeColor = Color.Red; } else {WireAmount.ForeColor = Color.Black; } }

D. 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

WireAmount = new Label(); WireAmount.ID = "WireAmount"; if ( WireAmount.Text.Length > 7) {WireAmount.ForeColor = Color.Red; } else { WireAmount.ForeColor = Color.Black; }} Answer: B Question: 3 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. Two user controls are created by you. They are respectivley named UCtrlA.ascx and UCtrlB.ascx. The user controls postback to the server. You create a new Web page that has the following ASPX code. 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> You write the following code segment for the Web page for dynamically creating the user controls. public void LoadControls() { if (ViewState["CtrlA"] != null) { Control c; if ((bool)ViewState["CtrlA"] == true) { c = LoadControl("UCtrlA.ascx"); } else { c = LoadControl("UCtrlB.ascx"); } c.ID = "Ctrl"; PlHolder.Controls.Add(c); }} protected void Chk_CheckedChanged(object sender, EventArgs e) { ViewState["CtrlA"] = Chk.Checked; PlHolder.Controls.Clear(); LoadControls(); } According to the requirement of the company CIO, the user control that is displayed must be recreated during postback and retains its state. You have been assigned this task to make sure of this. Which method should be added to the Web page? A. protected override void OnLoadComplete(EventArgs e){ base.OnLoadComplete(e);

LoadControls();} B. protected override object SaveViewState(){ LoadControls(); return base.SaveViewState();}

Page 3: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 3 of 54

C. protected override void LoadViewState(object savedState){ base.LoadViewState(savedState); LoadControls();} D. protected override void Render(HtmlTextWriter writer){ LoadControls(); base.Render(writer);} Answer: C Question: 4 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You write the code fragment below. (Line numbers are used for reference only.) 1 <asp:RequiredFieldValidator 2 ID="rfValidator1" runat="server" 3 Display="Dynamic" ControlToValidate="TextBox1" 4 5 > 6 7 </asp:RequiredFieldValidator> 8 9 <asp:ValidationSummary DisplayMode="List" 10 ID="ValidationSummary1" runat="server" /> Now you receive an e-mail from your company CIO, according to his requirement, the error message must also be displayed in the validation summary list if it is displayed in the validation control. The company CIO assigns this task to you. So what should you do to make sure of this? A. The following code segment should be added to line 04. ErrorMessage="Required text in

TextBox1" B. The following code segment should be added to line 06. Required text in TextBox1 C. The following code segment should be added to line 04. Text="Required text in TextBox1" ErrorMessage="ValidationSummary1" D. The following code segment should be added to line 04. Text="Required text in TextBox1" Answer: A Question: 5 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You write the code fragment below. <asp:ListBox SelectionMode="Multiple" ID="ListBox1" runat="server"> </asp:ListBox> <asp:ListBox ID="ListBox2" runat="server"> </asp:ListBox> <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /> You must make sure that when you click the Button1 control, a selected list of items move from the ListBox1 control to the ListBox2 control when you click the Button1 control. Of the following code segments, which one should be used?

Page 4: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 4 of 54

A. foreach (ListItem li in ListBox1.Items) { if (li.Selected) { li.Selected = false; ListBox2.Items.Add(li); ListBox1.Items.Remove(li); }}

B. foreach (ListItem li in ListBox1.Items) { if (li.Selected) { 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); }}foreach (ListItem li in ListBox1.Items) { if (ListBox2.Items.Contains(li)) ListBox1.Items.Remove(li);}

D. foreach (ListItem li in ListBox1.Items) { if (li.Selected) { li.Selected = false; ListBox2.Items.Add(li); }}foreach (ListItem li in ListBox2.Items) { if (ListBox1.Items.Contains(li))

ListBox1.Items.Remove(li);} Answer: D Question: 6 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You create a file named movies.xml that contains the following code fragment. <Movies> <Movie ID="1" Name="Movie1" Year="2006"> <Desc Value="Movie desc"/> </Movie> <Movie ID="2" Name="Movie2" Year="2007"> <Desc Value="Movie desc"/> </Movie> <Movie ID="3" Name="Movie3" Year="2008"> <Desc Value="Movie desc"/> </Movie> </Movies> A Web form is added to the application. You write the following code segment in the Web form. (Line numbers are used for reference only.) 1 <form runat="server"> 2 <asp:xmldatasource 3 id="XmlDataSource1" 4 runat="server" 5 datafile="movies.xml" /> 6 7 </form> According to the requirement of the company, you have to implement the XmlDataSource control to display the XML data in a TreeView control. At line 6, which code segment should be inserted? A. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="MovDataSource1">

<DataBindings> <asp:TreeNodeBinding DataMember="Movie" Text="Name" /> </DataBindings></asp:TreeView> B. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="MovDataSource1">

<DataBindings> <asp:TreeNodeBinding DataMember="Movies" Text="Desc" /> </DataBindings></asp:TreeView>

C. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1"> <DataBindings> <asp:TreeNodeBinding DataMember="Movie" Text="Name" />

</DataBindings></asp:TreeView>

Page 5: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 5 of 54

D. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1"> <DataBindings> <asp:TreeNodeBinding DataMember="Movies" Text="Desc" />

</DataBindings></asp:TreeView> Answer: C Question: 7 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. Look at the code fragment below. <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:TextBox runat="server" ID="txtUser" Width="200px" /> <asp:TextBox runat="server" ID="txtPassword" Width="200px" /> <asp:Button runat="server" ID="btnLogin" Text="Login" OnClientClick="login(); return false;" /> You use the above code fragment to create a login Web form. The login() client-side script is called to authenticate the user when a user clicks the btnLogin Button control. The credentials provided in the TextBox controls are used to call the client-side script. Look at the following code fragment: 01 <script type="text/javascript"> 02 function login() { 03 var username = $get('txtUser').value; 04 var password = $get('txtPassword').value; 05 06 // authentication logic. 07 } 08 function onLoginCompleted(validCredentials, userContext, 09 methodName) 10 { 11 // notify user on authentication result. 12 } 13 14 function onLoginFailed(error, userContext, methodName) 15 { 16 // notify user on authentication exception. 17 } 18 </script> The above client-script code fragment is also added in the Web form by you. You configure the ASP.NET application to use Forms Authentication. The ASP.NET AJAX authentication service is activated in the Web.config file. You must make sure that you can achieve this following two requirements: If authentication succeeds, the onLoginCompleted client-script function is called to notify the user; If authentication fails, the onLoginFailed client-script function is called to display an error message. At line6, which code segment should be inserted? A. var auth =

Sys.Services.AuthenticationService;auth.set_defaultLoginCompletedCallback(onLoginCompleted);try { auth.login(username, password, false, null, null, null, null, null); }catch (err) { onLoginFailed(err, null, null);}

B. var auth = Sys.Services.AuthenticationService; auth.login(username, password, false, null, null,onLoginCompleted, onLoginFailed, null);

Page 6: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 6 of 54

C. var auth = Sys.Services.AuthenticationService;try { var validCredentials = auth.login(username, password, false, null, null, null, null, null); if (validCredentials)

onLoginCompleted(true, null, null); else onLoginCompleted(false, null, null);}catch (err) { onLoginFailed(err, null, null);}

D. var auth = Sys.Services.AuthenticationService; auth.set_defaultFailedCallback(onLoginFailed);var validCredentials = auth.login(username, password, false, null, null, null, null, null);if (validCredentials)onLoginCompleted(true, null, null);elseonLoginCompleted(false, null, null);

Answer: B Question: 8 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You intend 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> In order to create a custom parameter class, you write the following code segment. public class DayParameter : Parameter { } You must make sure that the current date and time is returned by the custom parameter. Of the following code segments, which code segment should be added to the DayParameter class? A. protected override Parameter Clone(){ Parameter pm = new DayParameter(); pm.DefaultValue

= DateTime.Now; return pm;} B. protected DayParameter(): base("Value", TypeCode.DateTime, DateTime.Now.ToString()){} C. protected override void LoadViewState(object savedState){

((StateBag)savedState).Add("Value", DateTime.Now);} D. protected override object Evaluate(HttpContext context, Control control) { return

DateTime.Now;} Answer: D Question: 9 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. The application contains a Web form file named TVReviews.aspx and has DetailsView control named DetailsView01. The TVReviews.aspx file connects to a LinqDataSource DataSource named LinqDataSource01. LinqDataSource01has a primary key named TVID. The TVReviews.aspx file contains the following code fragment. (Line numbers are used for reference only.) 1 <asp:DetailsView ID="DetailsView1" runat="server"

Page 7: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 7 of 54

2 DataSourceID="LinqDataSource1"0304 /> 5 <Fields> 6 <asp:BoundField DataField="IVID" HeaderText="IVID" 7 InsertVisible="False" 8 ReadOnly="True" SortExpression="IVID" /> 9 <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> The company CIO assigns a task to you. According to his requirement, you must make sure that the users can insert and update content in the DetailsView1 control. Besides this, you have to prevent duplication of the link button controls for the Edit and New operations. At line 3, which code segment should be inserted? A..AllowPaging="true"AutoGenerateDeleteButton="false"AutoGenerateEditButton="true"AutoGen

erateInsertButton="tru B. AllowPaging="false"AutoGenerateRows="false" C.AllowPaging="false"AutoGenerateDeleteButton="false"AutoGenerateEditButton="true"AutoGen

erateInsertButton="tru D. AllowPaging="true"AutoGenerateRows="false"DataKeyNames="IVID" Answer: D Question: 10 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application which contains a Web form with a Label control named lblPrice . You define the following class. public class Product { public decimal Price { get; set; } } Look at the XML fragment below. You access the fragment by using a StringReader variable named xmlStream. <Product> <Price>35</Price> </Product> Now you get an e-mail from your company manager, the manager wants to view the price of the product, so you have to display the price of the product from the XML fragment in the lblPrice Label control. Of the following code segments, which one should be used? A. XmlSerializer xs = new XmlSerializer(typeof(Product));Product boughtProduct = xs.Deserialize(xmlStream) as Product;lblPrice.Text = boughtProduct.Price.ToString(); B. XmlDocument xDoc = new XmlDocument();xDoc.Load(xmlStream);Product boughtProduct = xDoc.OfType<Product>().First();lblPrice.Text = boughtProduct.Price.ToString(); C. DataTable dt = new DataTable();dt.ExtendedProperties.Add("Type", "Product");dt.ReadXml(xmlStream);lblPrice.Text = dt.Rows[0]["Price"].ToString();

Page 8: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 8 of 54

D. XmlReader xr = XmlReader.Create(xmlStream);Product boughtProduct = xr.ReadContentAs(typeof(Product), null) as Product;lblPrice.Text =

boughtProduct.Price.ToString(); Answer: A Question: 11 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You create a custom Web user control which will be compiled as a library. You name it JoinedControl. Look at the following code segment. (Line numbers are used for reference only.) 1 protected override void OnInit(EventArgs e) 2 { 3 base.OnInit(e); 4 5 } You write the above code segment for the JoinedControl control. In the ASP.NET application, all the master pages contain the following directive. <%@ Master Language="C#" EnableViewState="false" %> You must make sure that the state of the SharedControl control can persist on the pages that reference a master page. At line 4, which code segment should be inserted? A. Page.RegisterStartupScript("SharedControl","server"); B. Page.RegisterRequiresPostBack(this); C. Page.UnregisterRequiresControlState(this); D. Page.RegisterRequiresControlState(this); Answer: D Question: 12 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You write the code fragment below: <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" /> According to the requirement of the company CIO, each Label control value must be asynchronously updatable when you click the btnSubmit Button control. Of the following options, which code segment should be used?

Page 9: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 9 of 54

A. 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";}

B. protected void btnSubmit_Click(object sender, EventArgs e){ Label1.Text = "Label1 updated value"; Label2.Text = "Label2 updated value"; Label3.Text = "Label3 updated value";}

C. protected void btnSubmit_Click(object sender, EventArgs e){ Label1.Text = "Label1 updated value"; Label2.Text = "Label2 updated value"; ScriptManager1.RegisterDataItem(Label3,

"Label3 updated value");} D. 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";}

Answer: C Question: 13 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application which uses ASP.NET AJAX. According to the company requirement, this application has to be deployed in a Web farm environment. For the application, SessionState has to be configured. Which code fragment should you use? A. <sessionState mode="InProc" cookieless="UseCookies" /> B. <sessionState mode="InProc" cookieless="UseDeviceProfile" /> C. <sessionState mode="SQLServer" cookieless="false" sqlConnectionString="Integrated

Security=SSPI;data source=MySqlServer;" /> D. <sessionState mode="SQLServer" cookieless="UseUri" sqlConnectionString="Integrated Security=SSPI;data source=MySqlServer;" /> Answer: C Question: 14 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to modify an existing Microsoft ASP.NET application. After a theme is added to the ASP.NET application, you have to apply the theme to override any settings of individual controls. What action should you perform? A. A master page should be added to the application. The StyleSheetTheme attribute should be

set to the name of the theme in the @Master directive. B. A master page should be added to the application. The Theme attribute should be set to the

name of the theme in the @Master directive. C. You should set the Theme attribute of the pages element to the name of the theme in the

Web.config file of the application. D. You should set the StyleSheetTheme attribute of the pages element to the name of the theme

in the Web.config file of the application. Answer: C Question: 15 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web

Page 10: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 10 of 54

application. A class is created by you. The class contains the following code segment. (Line numbers are used for reference only.) 1 public object GetCachedProducts(sqlConnection conn) { 2 3 if (Cache["products"] == null) { 4 SqlCommand cmd = new SqlCommand( 5 "SELECT * FROM Products", conn); 7 conn.Open(); 8 Cache.Insert("products", GetData(cmd)); 9 conn.Close(); 10 } 11 return Cache["products"]; 12 } 13 14 public object GetData(SqlCommand prodCmd) { 15 16 } The GetCachedProducts method is called to provide this list from the Cache object once a Web form has to access a list of products. According to the requirement of the company CIO, the list of products must be always available in the Cache object. You are asked to make sure of this. At line 15, which code segment should be inserted? A. return prodCmd.ExecuteReader(); B. SqlDataAdapter da = new SqlDataAdapter(prodCmd);DataSet ds = new

DataSet();da.Fill(ds);return ds; C. SqlDataReader dr;prodCmd.CommandTimeout = int.MaxValue;dr =

prodCmd.ExecuteReader();return dr; D. SqlDataAdapter da = new SqlDataAdapter();da.SelectCommand = prodCmd;DataSet ds =

new DataSet();return ds.Tables[0]; Answer: B Question: 16 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. An error message pops up when the company CIO tries to access the application in a Web browser. The error message says that service is unavailable. The company CIO asks you to solve this problem. You must solve this problem making the CIO access the application. So what action should you perform? A. You should start Microsoft IIS 6.0. B. You should add the Web.config file for the application. C. You should start the Application pool. D. You should set the .NET Framework version. Answer: C Question: 17 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. In the root of the application a Web page named Default.aspx is created. Then you

Page 11: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 11 of 54

put an ImageResources.resx resource file in the App_GlobalResources folder. A localized resource named LogoImageUrl is contained in the ImageResources.resx file. You have to retrieve the value of LogoImageUrl. Of the following code segments, which one should be used? A. string logoImageUrl = (string)GetGlobalResource("Default", "LogoImageUrl"); B. string logoImageUrl = (string)GetLocalResource("LogoImageUrl"); C. string logoImageUrl = (string)GetLocalResource("ImageResources.LogoImageUrl"); D. string logoImageUrl = (string)GetGlobalResource("ImageResources", "LogoImageUrl"); Answer: D Question: 18 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You create a class. The class implements the IHttpHandler interface. Look at the code segment below: 1 public void ProcessRequest(HttpContext ctx) { 2 3 } You use the above code segment to implement the ProcessRequest method. You must make sure that when the handler is requested, the image named Alert.jpg is displayed in the browser. At line 2, which code segment should be inserted? A. StreamReader sr = new StreamReader(

File.OpenRead(ctx.Server.MapPath("Alert.jpg")));ctx.Response.Pics(sr.ReadToEnd());sr.Close();

B. 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();

C. 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();

D. StreamReader sr = new StreamReader( File.OpenRead(ctx.Server.MapPath("Alert.jpg")));ctx.Response.Pics("image/jpg");ctx.Response.TransmitFile(sr.ReadT

Answer: B Question: 19 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application which has a mobile Web form. The following ObjectList control is contained in the mobile Web form. <mobile:ObjectList ID="ObjectListCtrl" OnItemCommand="ObjectListCtrl_ItemCommand"Runat="server"> <Command Name="CmdDisplayDetails" Text="Details" /> <Command Name="CmdRemove" Text="Remove" /></mobile:ObjectList> An event handler named ObjectListCtrl_ItemCommand is created by you.

Page 12: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 12 of 54

Now you receive an e-mail from your company CIO, according to his requirement, the ObjectListCtrl_ItemCommand handler must detect the selection of the CmdDisplayDetails item. The Compmay has assigned this task to you. So you have to make sure of this. Of the following code segment, which one should you choose? A. public void ObjectListCtrl_ItemCommand( object sender, ObjectListCommandEventArgs e){ ObjectListCommand cmd = e.CommandSource as ObjectListCommand; if (cmd.Name == "CmdDisplayDetails") { }} B. public void ObjectListCtrl_ItemCommand( object sender, ObjectListCommandEventArgs e){ if (e.CommandName == "CmdDisplayDetails") { }} C. public void ObjectListCtrl_ItemCommand( object sender, ObjectListCommandEventArgs e){ if (e.CommandArgument.ToString() == "CmdDisplayDetails") { }} D. public void ObjectListCtrl_ItemCommand( object sender, ObjectListCommandEventArgs e){ ObjectListCommand cmd = sender as ObjectListCommand; if (cmd.Name == "CmdDisplayDetails") { }} Answer: B Question: 20 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. The application contains a DataSourceControl named ItemsDataSource. This DataSourceControl is bound to a Microsoft SQL Server 2005 table. The ItemName column is the primary key of the table. The ItemName column is the primary key of the table. In a FormView control you write the following code fragment. (Line numbers are used for reference only.) 1 <tr> 2 <td align="right"><b>Item:</b></td> 3 <td><asp:DropDownList ID="InsertItemDropDownList" 4 5 DataSourceID="ItemsDataSource" 6 DataTextField="ItemName" 7 DataValueField="ItemID" 8 RunAt="Server" /> 9 </td> 10 </tr> According to the company requirement, you must make sure that the changes made to the ItemID field can be written to the database. At line 4, which code fragment should be inserted? A. SelectedValue='<%# Bind("ItemID") %>' B. SelectedValue='<%# Eval("ItemID") %>' C. SelectedValue='<%# Bind("ItemName") %>' D. SelectedValue='<%# Eval("ItemName") %>' Answer: A Question: 21 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. The application make uses of 10 themes and users are permitted to choose their themes for the Web page. The theme selected by the user is used to display pages in the application when a user returns to the application. Even if the user returns to log on at a later date

Page 13: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 13 of 54

or from a different client computer, this also happens. The application runs on different storage types and in different environments. You have to store the themes which are chosen by the users, after this you have to retrieve the required theme. So what action should you perform? A. You should store the name of the theme that is chosen by the user by using the Session

object. Each time the user visits a page, you should retrieve the required theme name from the Session object. B. You should store the name of the theme that is chosen by the user by using the Application

object. Each time the user visits a page, you should retrieve the required theme name from the Application object. C. First, a setting for the theme should be added to the profile section of the Web.config file of the

application. Then you should store the name of the theme chosen by the user by using the Profile.Theme string theme. At last you should retrieve the required theme name each time the user visits a page.

D. You should store the name of the theme that is chosen by the user by using the Response.Cookies collection. Then you should use the Request.Cookies collection to identify the theme that was chosen by the user each time the user visits a page.

Answer: C Question: 22 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. According to the company requirement, a composite custom control named MyControl is created. Now an instance of the OrderFormData control has to be added to the MyControl control. Of the following code segments, which one should you use? A. protected override ControlCollection CreateControlCollection() { ControlCollection controls =

new ControlCollection(this); OrderFormData oFData = new OrderFormData("OrderForm"); controls.Add(oFData); return controls;} B. protected override void CreateChildControls() { Controls.Clear(); OrderFormData oFData =

new OrderFormData("OrderForm"); Controls.Add(oFData);} C. protected override void EnsureChildControls() { Controls.Clear(); OrderFormData oFData =

new OrderFormData("OrderForm"); oFData.EnsureChildControls(); if (!ChildControlsCreated) CreateChildControls();} D. protected override void RenderContents(HtmlTextWriter writer) { OrderFormData oFData =

new OrderFormData("OrderForm"); oFData.RenderControl(writer);} Answer: B Question: 23 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. A Web page which contains a TextBox control is created. The Web page is named enrollName.aspx and the TextBox control is named txtName. The Web page cross posts to a page named displayName.aspx. A Label control named LName is contained in this contains. Now you receive an e-mail from your company CIO. According to the requirement of the company CIO, The LName Label control must display the text that was enrolled in the txtName TextBox control. You have been assigned this task to make sure of this. Of the following code segments, which one should be used? A. TextBox txtName = PreviousPage.FindControl("txtName") as TextBox;LName.Text =

txtName.Text;

Page 14: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 14 of 54

B. LName.Text = Request.QueryString["txtName"]; C. TextBox txtName = FindControl("txtName") as TextBox;LName.Text = txtName.Text; D. TextBox txtName = Parent.FindControl("txtName") as TextBox;LName.Text = txtName.Text; Answer: A Question: 24 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application which consumes a Microsoft Windows Communication Foundation (WCF) service. The WCF service exposes the following method. [WebInvoke] string UpdateCustomerDetails(string custID); The application uses the code segment below to host the WCF service. WebServiceHost host = new WebServiceHost(typeof(CService), new Uri("http://win/")); ServiceEndpoint ep = host.AddServiceEndpoint(typeof(ICService), new WebHttpBinding(), ""); According to the company requirement, you have to invoke the UpdateCustomerDetails method. Of the code segments below, which one should be used? A. WebChannelFactory<ICService> wcf = new WebChannelFactory<ICService>(new Uri("http: //win/UpdateCustomerDetails"))ICService channel = wcf.CreateChannel();string s = channel.UpdateCustomerDetails("CustID12"); B. WebChannelFactory<ICService> wcf = new WebChannelFactory<ICService>(new Uri("http: //win"))ICService channel = wcf.CreateChannel();string s =

channel.UpdateCustomerDetails("CustID12"); C. 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"); D. ChannelFactory<ICService> cf = new ChannelFactory<ICService>(new WebHttpBinding(),

"http: //win/UpdateCustomerDetails")ICService channel = cf.CreateChannel();string s = channel.UpdateCustomerDetails("CustID12"); Answer: B Question: 25 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. The application contains the device filter element below in the Web.config file. <filter name="isHtml" compare="PreferredRenderingType" argument="html32" /> A Web page is contained in the application. The Web page has the following image control. (Line numbers are used for reference only.) 1 <mobile:Image ID="imgCtrl" Runat="server"> 2 3 </mobile:Image>

Page 15: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 15 of 54

Now you receive an e-mail from your company CIO, according to his requirement, if html is supported by the Web browser, the imgCtrl Image control must display the highRes.jpg file; if html is not supported by the Web browser , the imgCtrl Image control must display lowRes.gif. The compmay has assigned this task to you. So you have to achieve this two goals. At line 2, which DeviceSpecific element should be inserted? A. <DeviceSpecific> <Choice Filter="PreferredRenderingType" ImageUrl="highRes.jpg" />

<Choice ImageUrl="lowRes.gif" /></DeviceSpecific> B. <DeviceSpecific> <Choice Filter="isHtml" ImageUrl="highRes.jpg" /> <Choice

ImageUrl="lowRes.gif" /></DeviceSpecific> C. <DeviceSpecific> <Choice Filter="PreferredRenderingType" Argument="false"

ImageUrl="highRes.jpg" /> <Choice Filter="PreferredRenderingType" Argument="true" ImageUrl="lowRes.gif" /></DeviceSpecific> D. <DeviceSpecific> <Choice Filter="isHtml" Argument="false" ImageUrl="highRes.jpg" />

<Choice Filter="isHtml" Argument="true" ImageUrl="lowRes.gif" /></DeviceSpecific> Answer: B Question: 26 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. A Web page named HomePage.aspx which contains different controls is added in the application. Then you add a newly created custom control named CachedControl to the Web page. You must make sure that the custom control state remains static for one minute and the cache settings of other elements in the Web page is not affected by the custom control. So what should you do to achieve the two goals? A. The code fragment below should be added to the Web.config file of the solution. <caching> <outputCacheSettings> <outputCacheProfiles> <add name="CachedProfileSet"

varyByParam="CachedControl" duration="60" /> </outputCacheProfiles> </outputCacheSettings></caching>

B. The code fragment below should be added to the Web.config file of the solution. <caching> <outputCacheSettings> <outputCacheProfiles> <add name="CachedProfileSet" varyByControl="CachedControl" duration="60" /> </outputCacheProfiles>

</outputCacheSettings></caching> C. You should add a class named ProfileCache that inherits from the ConfigurationSection class

to the HomePage.aspx.cs page. Then you should add the following code fragment to the Web.config file of the solution. <ProfileCache profile="CachedProfileSet"

varyByParam="CachedControl" duration="60"></ProfileCache><caching> <outputCache enableOutputCache="true"/></caching> D. You should add a class named ProfileCache that inherits from the ConfigurationSection class

to the HomePage.aspx.cs page. Then you should add the following code fragment to the Web.config file of the solution. <ProfileCache profile="CachedProfileSet"

varyByControl="CachedControl" duration="60"></ProfileCache><caching> <outputCache enableOutputCache="true"/></caching> Answer: B Question: 27 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You deploy an ASP.NET Web application on a local computer, the application needs to connect to a local instance of Microsoft SQL Server 2005. You should choose Windows

Page 16: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 16 of 54

Authentication when connecting to this instance. On both local computers, you intend to install the database elements for the membership providers, besides this, you plan to install the database elements for the role management providers. What should you do? A. From the command line, run the aspnet_regsql.exe -E -S localhost -A mr command. B. From the command line, run the aspnet_regiis.exe -s localhost command. C. From the command line, run the sqlmetal.exe /server:localhost command. D. From the command line, run the sqlcmd.exe -S localhost E command. Answer: A Question: 28 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You write the following code fragment. (Line numbers are used for reference only.) 1 <asp:UpdatePanel ID="upnData" runat="server" 2 ChildrenAsTriggers="false" UpdateMode="Conditional"> 3 <Triggers>0405 </Triggers> 6 <ContentTemplate> 7 <!-- more content here --> 8 <asp:LinkButton ID="lbkLoad" runat="server" Text="Load" 9 onclick="lbkLoad_Click" /> 10 <asp:Button ID="btnSubmit" runat="server" Text="Submit" 11 Width="150px" onclick="btnSubmit_Click" />12 </ContentTemplate> 13 </asp:UpdatePanel> 14 <asp:Button ID="btnUpdate" runat="server" Text="Update" 15 Width="150px" onclick="btnUpdate_Click" /> Look at the table which contains some requirements. You must make sure that the requirements shown in the above table are met. So what action should you perform?

A. In line 2, the value of the ChildrenAsTriggers property should be set to true. At line 4, add the

following code fragment. <asp:AsyncPostBackTrigger ControlID="btnSubmit" /> <asp:PostBackTrigger ControlID="btnUpdate" />

B. In line 2, the value of the ChildrenAsTriggers property should be set to true. At line 4, add the following code fragment. <asp:AsyncPostBackTrigger ControlID="btnUpdate" />

<asp:PostBackTrigger ControlID="btnSubmit" /> C. In line 2, the value of the ChildrenAsTriggers property should be set to false. At line 4, add the

following code fragment at line 04. <asp:AsyncPostBackTrigger ControlID="btnUpdate" /> <asp:PostBackTrigger ControlID="btnSubmit" /> D. In line 2, the value of the ChildrenAsTriggers property should be set to false. At line 4, add the

following code fragment. <asp:AsyncPostBackTrigger ControlID="btnSubmit" /> <asp:PostBackTrigger ControlID="btnUpdate" />

Page 17: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 17 of 54

Answer: B Question: 29 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application which has a user control named UCtrl.ascx. Look at the code fragment below: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <html> ... <body> <form id="form1" runat="server"> <div> <asp:Label ID="lblHeader" runat="server"></asp:Label> <asp:Label ID="lbFooter" runat="server"></asp:Label> </div> </form> </body> </html> You create a Web page named Default.aspx by using the above code fragment. According to the company requirement, the UCtrl.ascx control should be dynamically added between the lblHeader and lblFooter Label controls. What action should you perform? A. Between the lblHeader and lblFooter label controls a PlaceHolder control named PlHldr should

be added. In the Init event of the Default.aspx Web page, you should write the code segment below. Control ctrl = LoadControl("UCtrl.ascx");PlHldr.Controls.Add(ctrl); B. In the Init event of the Default.aspx Web page, you should write the code segment below.

Control ctrl = LoadControl("UCtrl.ascx");this.Controls.AddAt(1, ctrl); C. In the Init event of the Default.aspx Web page, you should write the code segment below.

Control ctrl = LoadControl("UCtrl.ascx");lblHeader.Controls.Add(ctrl); D. Between the lblHeader and lblFooter label controls, a Literal control named Ltrl should be

added. In the Init event of the Default.aspx Web page, you shold write the following code segment. Control ctrl = LoadControl("UCtrl.ascx"); Answer: A Question: 30 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You create a Microsoft Windows Communication Foundation (WCF) service is created. This WCF service exposes the following service contract. (Line numbers are used for reference only.) 1 [ServiceContract] 2 public interface IBlogService 3 { 4 [OperationContract] 5 [WebGet(ResponseFormat=WebMessageFormat.Xml)] 6 Rss20FeedFormatter GetBlog(); 7 }

Page 18: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 18 of 54

You configure the WCF service, making it use the WebHttpBinding class and be exposed at the following URL: http://www.contoso.com/BlogService Now you receive an e-mail from your company CIO, according to his requirement, you have to store the result of the GetBlog operation in an XmlDocument variable named xmlBlog in a Web form. Of the following code segments, which one should you use? A. string url = @"http: //www.contoso.com/BlogService";XmlReader blogReader = XmlReader.Create(url);xmlBlog.Load(blogReader); B. string url = @"http: //www.contoso.com/BlogService/GetBlog";XmlReader blogReader = XmlReader.Create(url);xmlBlog.Load(blogReader); C. 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()); D. 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()); Answer: B Question: 31 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. Look at 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> You use the above code fragment to create an AJAX-enabled Web form. A dynamic client script is registered when the updFirstPanel UpdatePanel control is updated. You write the following code segment in the code-behind file of the Web form. (Line numbers are used for reference only.) 1 protected void Page_Load(object sender, EventArgs e) 2 { 3 if(IsPostBack) 4 { 5 string generatedScript = ScriptGenerator.GenerateScript();

Page 19: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 19 of 54

6 7 } 8 } You must make sure that only when an asynchronous postback is issued on the updFirstPanel UpdatePanel control, the client-script code is registered. At line6, which code segment should be inserted? A. ClientScript.RegisterClientScriptBlock(typeof(Page), "txtInfo_Script", generatedScript); B. ClientScript.RegisterClientScriptBlock(typeof(TextBox), "txtInfo_Script", generatedScript); C. ScriptManager.RegisterClientScriptBlock(txtInfo, typeof(TextBox), "txtInfo_Script",

generatedScript, false); D. ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "txtInfo_Script", generatedScript,

false); Answer: C Question: 32 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. A set of general-purpose utility classes is used by the application. These classes implement business logic and are modified very often. You must make sure that if a utility class is modified, the application is recompiled automatically. So what should you do? A. You should use a Microsoft Visual Studio ASP.NET Web site to create the Web application.

Then you should add the utility classes to the root folder of the Web application. B. You should use a Microsoft Visual Studio ASP.NET Web site to create the Web application.

Then you should add the utility classes to the App_Code subfolder of the Web application. C. You should use a Microsoft Visual Studio ASP.NET Web Application project to create the Web application. Then you should add the utility classes to the root folder of the Web application. D. You should use a Microsoft Visual Studio ASP.NET Web Application project to create the Web application. Then you should add the utility classes to the App_Code subfolder of the Web application. Answer: B Question: 33 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. Now you are managing this application. From the source control repository, you get the latest version of the project. When trying to compile the project on your computer, the assembly reference is missing. You have to solve this problem making suring that you can compile the project on your computer. What action should you perform? A. In the property pages of the project, change the output path to the location of the missing

assembly. B. In the property pages of the project, add a reference path to the location of the missing

assembly. C. In the property pages of the project, add a working directory to the location of the missing

assembly. D. You should delete the assembly reference. After this, you should add a reference to the

missing assembly by browsing for it on your computer.

Page 20: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 20 of 54

Answer: B Question: 34 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. In order to display photos and captions, a Web page is created. By using the application, the caption of each photo in the database can be modified. 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> The application throws an error when you access the Web page. You must make sure that the application successfully updates each caption and stores it in the database. What action should you perform? A. You should utilize the Bind function for the Label control while not the Eval function. B. The ID attribute should be added to the Label control. C. The ID attribute should be added to the TextBox control. D. You should utilize the Eval function for the TextBox control while not the Bind function. Answer: C Question: 35 You are an application developer and you have about two years experience in developing Web based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. As the technical support, you?0?30??4re assigned a task to monitor the execution of the application at daily intervals. The application configuration has to be modified to enable WebEvent monitoring. What action should you perform? A. First you should enable the Debugging in the Web site option in the ASP.NET configuration

settings. Then you should modify the Request Execution timeout to 10 seconds. B. First you should use the command below to register the aspnet_perf.dll performance counter

library. regsvr32 C:\WINDOWS\Micro soft.NET\Framework\v2.0.50727\aspnet_perf.dll C. You should add the code fragment below to the <healthMonitoring> section of the Web.config

file of the application. <profiles> <add name="Default" minInstances="1" maxLimit="Infinite" minInterval="00:00:10" custom="" /></profiles>

D. You should add the code fragment to the <system.web> section of the Web.config file of the application. <healthMonitoring enabled="true" heartbeatInterval="10"> <rules> <add name="Heartbeats Default" eventName="Heartbeat" provider="EventLogProvider" profile="Critical"/> </rules></healthMonitoring>

Page 21: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 21 of 54

Answer: D Question: 36 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. A custom control named OrderForm is created by you. You write the following code segment. public delegate voidCheckOrderFormEventHandler(EventArgs e);private static readonly object CheckOrderFormKey = new object();public event CheckOrderFormEventHandlerCheckOrderForm { add { Events.AddHandler(CheckOrderFormKey, value); } remove { Events.RemoveHandler(CheckOrderFormKey, value); }} According to the requirement of the company CIO, you have to provide a method that enables the OrderForm control to raise the CheckOrderForm event. Of the following code segments, which one should be used? A. protected virtual void OnCheckOrderForm(EventArgs e) { CheckOrderFormEventHandler checkOrderForm = Events[CheckOrderFormKey] as CheckOrderFormEventHandler; if (checkOrderForm != null) checkOrderForm(e);} B. CheckOrderFormEventHandler checkOrderForm = new CheckOrderFormEventHandler(checkOrderFormCallBack);protected virtual void OnCheckOrderForm(EventArgs e) { if (checkOrderForm != null) checkOrderForm(e);} C. CheckOrderFormEventHandler checkOrderForm = new CheckOrderFormEventHandler(checkOrderFormCallBack);protected virtual void OnCheckOrderForm(EventArgs e) { if (checkOrderForm != null) RaiseBubbleEvent(checkOrderForm, e);} D. protected virtual void OnCheckOrderForm(EventArgs e) { CheckOrderFormEventHandler checkOrderForm = (CheckOrderFormEventHandler)Events[ typeof(CheckOrderFormEventHandler)]; if (checkOrderForm != null) checkOrderForm(e);} Answer: A Question: 37 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. There is a server named WiikigoTest that runs Microsoft IIS 6.0. The application is hosted on the wiikigoTest server. On the WiikigoTest server, you build remote debugging. There is another computer which is namd WiikigoComp. Now you get an order from the company CIO, according to his requirement, you have to debug the application remotely from computer WiikigoComp. What action should you perform? A. Microsoft Visual Studio.NET should be attached to the Msvsmon.exe process. B. Microsoft Visual Studio.NET should be attached to the w3wp.exe process. C. Microsoft Visual Studio.NET should be attached to the WebDev.WebServer.exe process. D. Microsoft Visual Studio.NET should be attached to the inetinfo.exe process. Answer: B

Page 22: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 22 of 54

Question: 38 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. In order to create a client-script function, you write the code segment below. (Line numbers are used for reference only.) 1 function updateLabelControl(labelId, newText) { 2 var label = $find(labelId); 3 label.innerHTML = newText; 4 } ASP.NET AJAX is used by the client script function which updates the text of any Label control in the Web form. You find that the Label controls are not updated after testing the client script function. You receive the following JavaScript error message in the browser: "'null' is null or not an object." You have to solve this problem. So what action should you perform? A. You should replace line 3 with the following line of code. label.innerText = newText; B. You should replace line 2 with the following line of code. var label = $get(labelId); C. You should replace line 2 with the following line of code. var label = Sys.UI.DomElement.getElementById($get(labelId)); D. You should replace line 2 with the following line of code. var label = Sys.UI.DomElement.getElementById($find(labelId)); Answer: B Question: 39 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. The application contains an ASPX page named ErrorPage.aspx. Now you receive an e-mail from the company CIO, in the e-mail, the company CIO asks you to manage the unhandled application exceptions. According to the company requirement, you have to display the ErrorPage.aspx page and write the exception information in the Event log file. You have to accomplish the two tasks. So what should you do? (choose more than one) A. The following code fragment should be added to the Web.config file. <customErrors

mode="Off" defaultRedirect="ErrorPage.aspx" /> B. The following code fragment should be added to the Web.config file. <customErrors

mode="On" defaultRedirect="ErrorPage.aspx" /> C. The following code segment should be added to the ErrorPage.aspx file. void

Page_Error(object sender, EventArgs e){ Exception exc = Server.GetLastError(); //Write Exception details to event log Server.ClearError();}

D. The following code segment should be added to the Global.asax file. void Application_Error(object sender, EventArgs e){ Exception exc = Server.GetLastError(); //Write Exception details to event log}

Answer: B, D Question: 40 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. Now you receive an e-mail from your company CIO, according to his requirement, text that contains HTML code has to be submitted to a page in the application. As the technical

Page 23: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 23 of 54

support, you are assigned this task. You must make sure that you can successfully submit the HTML code, but other applications that run on the Web server cannot be affected when you perform this. So what action should you perform? A. The following attribute should be added to the @Page directive. ValidateRequest="true" B. The following attribute should be added to the @Page directive. EnableEventValidation="true" C. You should set the following value in the Machine.config file. <system.web> <pages validateRequest="false"/></system.web> D. You should set the following value in the Web.config file. <system.web> <pages validateRequest="false"/></system.web> Answer: D Question: 41 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You intend to to capture the timing and performance information of the application. Now you get an order from your company manager, the manager requires that only when the user is logged on to the Web server and not on individual Web pages, they are allowed to access the information. As the It support, the manager has assigned this task to you. You must acheiev this goal. So of the following options, which should be added to the Web.config file? A. <compilation debug="false" urlLinePragmas="true" /> B. <compilation debug="true" /> C. <trace enabled="true" writeToDiagnosticsTrace="true" pageOutput="true" localOnly="true" /> D. <trace enabled="true" pageOutput="false" localOnly="true" /> Answer: D Question: 42 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. In order to create a JavaScript file named CounterScript.js, you write the following code segment. function divide(a, b) { if (b == 0) { var errorMsg = Messages.DivideByZero; alert(errorMsg); return null; } return a/b; } The CounterScript.js file is embedded as a resource in a Class Library project. The namespace for this project is Counter.Resources. There is a resource file named MessageResources.resx. The JavaScript function uses the JavaScript Messages object to retrieves messages from this resource file. You add an AJAX Web form in the ASP.NET application. You reference the Class Library in the application. An ASP.NET AJAX ScriptReference element is added to the AJAX Web form by you. After you reference the Class Library in the application, an ASP.NET AJAX ScriptReference element is added to the AJAX Web form. You must make sure that the error messages that are defined in the resource file is available to the JavaScript function. Which code segment should be added in the AssemblyInfo.cs file?

Page 24: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 24 of 54

A. [assembly: ScriptResource ("Counter.Resources.CounterScript", "Counter.Resources.MessageResources.resx", "Messages")] B. [assembly: ScriptResource ("CounterScript", "MessageResources", "Messages")] C. [assembly: ScriptResource ("CounterScript.js", "MessageResources.resx", "Messages")] D. [assembly: ScriptResource ("Counter.Resources.CounterScript.js", "Counter.Resources.MessageResources", "Messages")] Answer: D Question: 43 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. In order to add a Calendar server control to a Web page, you write the code fragment below: <asp:Calendar SelectionMode="DayWeek" ID="Calendar1" runat="server"> </asp:Calendar> You have to disable the non-week days in the Calendar control. What should you do? A. The following code segment should be added 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);} B. The following code segment should be added to the Calendar1 DayRender event handler. if (e.Day.IsWeekend) { e.Day.IsSelectable = false;} C. The following code segment should be added to the Calendar1 DayRender event handler. if (e.Day.IsWeekend) { if (Calendar1.SelectedDates.Contains(e.Day.Date)) Calendar1.SelectedDates.Remove(e.Day.Date);} D. The following code segment should be added 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);} Answer: B Question: 44 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. Look at the code fragment below (Line numbers are used for reference only). 1 <healthMonitoring> 2 <providers> 3 <add name="EventLogProvider" 4 type="System.Web.Management.EventLogWebEventProvider 5 /> 6 <add name="WmiWebEventProvider" 7 type="System.Web.Management.WmiWebEventProvider 8 /> 9 </providers> 10 <eventMappings> 11

Page 25: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 25 of 54

12 </eventMappings> 13 <rules> 14 <add name="Security Rule" eventName="Security Event" 15 provider="WmiWebEventProvider" /> 16 <add name="AppError Rule" eventName="AppError Event" 17 provider="EventLogProvider" /> 18 </rules>19 </healthMonitoring> The code fragment is added to the Web.config file of the application. Now you get an order from your company mangager, according to his requirement, Security-related Web Events must be mapped to Microsoft Windows Management Instrumentation (WMI) events. What's more, Web Events caused by problems with configuration or application code must be logged into the Windows Application Event Log. You are appointed to accomplish this task. You have to configure Web Events, making it meet these requirements. At line 11, which code fragment should be inserted? A. <add name="Security Event" type="System.Web.Management.WebAuditEvent"/><add

name="AppError Event" type="System.Web.Management.WebErrorEvent"/> B. <add name="Security Event" type="System.Web.Management.WebAuditEvent"/><add

name="AppError Event" type="System.Web.Management.WebRequestErrorEvent"/> C. <add name="Security Event"

type="System.Web.Management.WebApplicationLifetimeEvent"/><add name="AppError Event" type="System.Web.Management.WebErrorEvent"/> D. <add name="Security Event"

type="System.Web.Management.WebApplicationLifetimeEvent"/><add name="AppError Event" type="System.Web.Management.WebRequestErrorEvent"/> Answer: A Question: 45 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You use ASP.NET AJAX to create a Web form which contains the code fragment below. (Line numbers are used for reference only.) 01 <script type="text/javascript"> 02 03 Sys.Application.add_init(initComponents); 04 05 function initComponents() { 06 07 } 08 09 </script> 10 11 <asp:ScriptManager ID="ScriptManager1" 12 runat="server" /> 13 <asp:TextBox runat="server" ID="TextBox1" /> You have to use the initComponents function to create and initialize a client behavior named MyCustomBehavior. And you must make sure that MyCustomBehavior is attached to the TextBox1 Textbox control. At line 6, which code segment should be inserted? A. $create(MyCustomBehavior, null, null, null, $get('TextBox1'));

Page 26: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 26 of 54

B. $create(MyCustomBehavior, null, null, null, 'TextBox1'); C. Sys.Component.create(MyCustomBehavior, $get('TextBox1'), null, null, null); D. Sys.Component.create(MyCustomBehavior, 'TextBox1', null, null, null); Answer: A Question: 46 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You create a page which includes 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 must make sure that the lstLanguages ListBox control maintains the selection of the user during postback. In the constructor of the page, which line of code should be inserted? A. lstLanguages.SelectedIndexChanged += new EventHandler(BindData); B. lstLanguages.PreRender += new EventHandler(BindData); C. this.Init += new EventHandler(BindData); D. this.PreRender += new EventHandler(BindData); Answer: C Question: 47 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You create two controls, one is a composite custom control named MyControl. Another one is a templated custom control named BillFormDat a. You write the code segment below to override the method named CreateChildControls() in the MyControl class. (Line numbers are used for reference only.) 1 protected override void 2 CreateChildControls() { 3 Controls.Clear(); 4 BillFormData oFData = new 5 BillFormData("BillForm"); 6 7 } The BillFormData control has to be added to the MyControl control. At line 6, which code segment should be inserted? A. this.Controls.Add(oFData);this.TemplateControl = (TemplateControl)Template; B. oFData.TemplateControl = (TemplateControl)Template;Controls.Add(oFData); C. Controls.Add(oFData);Template.InstantiateIn(this);

Page 27: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 27 of 54

D. Template.InstantiateIn(oFData);Controls.Add(oFData); Answer: D Question: 48 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET application. There is a mobile Web page in the application. Look at the following StyleSheet control: <mobile:StyleSheet id="MyStyleSheet" runat="server"> <mobile:Style Name="StyleA" Font-Name="Arial" Font-Bold="True" Wrapping="NoWrap"> </mobile:Style></mobile:StyleSheet> You add it to the Web page. Now according to the requirement of the company CIO, you have to add a Label control named MyLabel. This Label control uses the defined style in the MyStyleSheet StyleSheet control. Which markup should you use? A. <mobile:Label ID="MyLabel" Runat="server"

StyleReference="MyStyleSheet:StyleA"></mobile:Label> B. <mobile:Label ID="MyLabel" Runat="server" StyleReference="StyleA"></mobile:Label> C. <mobile:Label ID="MyLabel" Runat="server"> <DeviceSpecific ID="DSpec" Runat="server">

<Choice Filter="MyStyleSheet" StyleReference="StyleA" /> </DeviceSpecific></mobile:Label> D. <mobile:Label ID="MyLabel" Runat="server"> <DeviceSpecific ID="DSpec" Runat="server">

<Choice Argument="StyleA" StyleReference="MyStyleSheet" /> </DeviceSpecific></mobile:Label>

Answer: A Question: 49 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. Look at the following code fragment. (Line numbers are used for reference only.) 1 <asp:ScriptManager ID="scrMgr" runat="server" /> 2 <asp:UpdatePanel ID="updPanel" runat="server" 3 UpdateMode="Conditional"> 4 <ContentTemplate> 5 <asp:Label ID="lblTime" runat="server" /> 6 <asp:UpdatePanel ID="updInnerPanel" 7 runat="server" UpdateMode="Conditional"> 8 <ContentTemplate> 9 <asp:Timer ID="tmrTimer" runat="server" 10 Interval="1000" 11 OnTick="tmrTimer_Tick" /> 12 </ContentTemplate> 13 14 </asp:UpdatePanel> 15 </ContentTemplate> 16 17 </asp:UpdatePanel>

Page 28: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 28 of 54

The above code fragment is added to an AJAX-enabled Web form. The tmrTimer_Tick event handler sets the Text property of the lblTime Label control to the current time of the server. Now you receive an order from your company manager, according to his requirement, the tmrTimer Timer control must properly update the lblTime Label Control. In order to make sure of this, you configure the appropriate UpdatePanel control. What action should you perform? A. The ChildrenAsTriggers="false" attribute should be set to the updPanel UpdatePanel control in

line 02. B. The UpdateMode="Always" attribute should be set to the updInnerPanel UpdatePanel control

in line 07. C. The following code fragment should be added to line 16. <Triggers>

<asp:AsyncPostBackTrigger ControlID="tmrTimer" EventName="Tick" /></Triggers> D. The following code fragment should be added to line 13. <Triggers> <asp:PostBackTrigger ControlID="tmrTimer" /></Triggers> Answer: C Question: 50 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. There is a Microsoft ASP.NET Framework version 1.0 application which runs on Microsoft IIS 6.0. Any features, if they are deprecated in the Microsoft .NET Framework version 3.5 are not used by the applicaton. Now you get an order from the company CIO, according to his requirement, the application should use the ASP.NET Framework version 3.5. The company CIO assigns this task to you. The application has to be configured to achieve this while not recompiled. So what action should you perform? A. The supportedRuntime configuration element should be added in the Web.config file and the

version attribute should be set to v3.5. B. You should edit the ASP.NET runtime version in IIS 6.0. C. You should edit the System.Web section handler version number in the machine.config file. D. The requiredRuntime configuration element should be added to the Web.config file and set the

version attribute to v3.5. Answer: B Question: 51 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. A Web form is created, you add the code fragment below. <asp:Repeater ID="rptData" runat="server" DataSourceID="SqlDataSource1" ItemDataBound="rptData_ItemDataBound"> <ItemTemplate> <asp:Label ID="lblQuantity" runat="server" Text='<%# Eval("QuantityOnHand") %>' /> </ItemTemplate> </asp:Repeater> There is a table which is named Commodities. The SqlDataSource1 DataSource control retrieves the Quantity column values from this table. In order to create the rptData_ItemDataBound event handler, you write the code segment below. (Line numbers are used for reference only.)

Page 29: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 29 of 54

1 protected void rptData_ItemDataBound(object sender, 2 RepeaterItemEventArgs e) 3 { 4 5 if(lbl != null) 6 if(int.Parse(lbl.Text) < 10) 7 lbl.ForeColor = Color.Red; 8 } Now you receive an order from your company manager, according to his requirement, you have to retrieve a reference to the lblQuantity Label control into a variable named lbl. At line 4, which code segment should be inserted? A. Label lbl = rptData.FindControl("lblQuantity") as Label; B. Label lbl = e.Item.Parent.FindControl("lblQuantity") as Label; C. Label lbl = Page.FindControl("lblQuantity") as Label; D. Label lbl = e.Item.FindControl("lblQuantity") as Label; Answer: D Question: 52 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. The value of the Application Restarts counter increases unexpectedly when you review the application performance counters. You company manager asks you to find out the reasons for this increase. So what may cause this increase? (choose more than one) A. This incease may be caused by the addition of a new assembly in the Bin directory of the

application. B. This incease may be caused by the restart of the Microsoft IIS 6.0 host. C. This incease may be caused by the restart of the Microsoft Windows Server 2003 that hosts

the Web application. D. This incease may be caused by the addition of a code segment that requires recompilation to

the ASP.NET Web application. E. This incease may be caused by the modification to the Web.config file in the system.web

section for debugging the application. F. This incease may be caused by the enabling of HTTP compression in the Microsoft IIS 6.0

manager for the application. Answer: A, D, E Question: 53 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. From the BaseValidator class, you obtain a new validation control. Look at the manner below: protected static bool Validate(string value) { ...} The validation logic for the control is implemented in the Validate method in the manner above. Now according to the requirement of the company CIO, the Validaton method has to be

Page 30: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 30 of 54

overrided. The company CIO assigns this task to you. Of the following override methods, which one should be used? A. Protected override bool ControlPropertiesValid() { string value = getcontrolvalidationvalue(this.ValidationGroup); bool isValid = Validate(value); return isValid;} B. Protected override bool EvaluateIsValid() { string value = GetControlValidationValue(this.ControlToValidate); bool isValid = Validate(value); return

isValid;} C. Protected override bool ControlPropertiesValid() { string value = GetControlValidationValue(this.Attributes["ControlToValidate"]); bool isValid = Validate(value); this.PropertiesValid = isValid; return true;} D. Protected override bool EvaluateIsValid() { string value = GetControlValidationValue( this.Attributes["AssociatedControl"]); bool isValid = Validate(value); return isValid;} Answer: B Question: 54 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. A Web form is created. And the Web form 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> For the GetData method of the DAL class, you write the following code segment. (Line numbers are used for reference only.) 1 public object GetData() { 2 SqlConnection cnn = new SqlConnection(); 3 string strQuery = "SELECT * FROM Products"; 4 5 } Now you receive an order from your company manager, according to his requirement, the sorting functionality of the gvProducts GridView control can be used by users. You have to make sure of this. At line 4, which code segment should be inserted? A. SqlDataAdapter da = new SqlDataAdapter(strQuery, cnn);DataSet ds = new DataSet();da.Fill(ds);ds.ExtendedProperties.Add("Sortable", true);return ds.Tables[0].Select(); B. SqlCommand cmd = new SqlCommand(strQuery, cnn);cnn.Open();return

cmd.ExecuteReader(); C. SqlCommand cmd = new SqlCommand(strQuery, cnn);cnn.Open();return cmd.ExecuteReader(CommandBehavior.KeyInfo); D. SqlDataAdapter da = new SqlDataAdapter(strQuery, cnn);DataSet ds = new

DataSet();da.Fill(ds);return ds; Answer: D Question: 55

Page 31: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 31 of 54

You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. An XmlDataSource control named XmlDataSource01 is added to the Web page. XmlDataSource01 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> The code segment below is written in the code-behind file of the Web page. protected void BulletedList1_Click( object sender, BulletedListEventArgs e) { //... } Now you receive an order from your company manager, according to his requirement, a BulletedList control named BulletedList01 has to be added to the Web page that is bound to XmlDataSource1. You have been assigned this task. Of the following code fragments, which one should be used? A. <asp:BulletedList ID="BulletedList01" runat="server" DisplayMode="LinkButton" DataSourceID="XmlDataSource01" DataTextField="Name" DataValueField="ID" onclick="BulletedList01_Click"></asp:BulletedList> B. <asp:BulletedList ID="BulletedList01" runat="server" DisplayMode="HyperLink" DataSourceID="XmlDataSource01" DataTextField="ID" DataValueField="Name" onclick="BulletedList01_Click"></asp:BulletedList> C. <asp:BulletedList ID="BulletedList01" runat="server" DisplayMode="LinkButton" DataSource="XmlDataSource01" DataTextField="Name" DataValueField="ID" onclick="BulletedList01_Click"></asp:BulletedList> D. <asp:BulletedList ID="BulletedList01" runat="server" DisplayMode="HyperLink" DataSourceID="XmlDataSource01" DataTextField="Name" DataMember="ID" onclick="BulletedList01_Click"></asp:BulletedList> Answer: A Question: 56 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You want to set up authentication for the Web application. Users from untrusted domains must be supported by the application. You must make sure that the application is available to anonymous users. Of the following code fragments, which one should be added to the Web.config file? A. <system.web> <authentication mode="Windows"> </authentication> <authorization> <deny

users="?" /> </authorization></system.web> B. <system.web> <authentication mode="Windows"> </authentication> <authorization> <deny

users="*" /> </authorization></system.web> C. <system.web> <authentication mode="Forms"> <forms loginUrl="login.aspx" />

</authentication> <authorization> <deny users="?" /> </authorization></system.web> D. <system.web> <authentication mode="Forms"> <forms loginUrl="login.aspx" />

</authentication> <authorization> <deny users="*" /> </authorization></system.web>

Page 32: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 32 of 54

Answer: C Question: 57 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. In order to access the results of a query, a FormView control is created. The query contains the fields below: EmployeeID FirstName LastName According to the requirement of the company manager, the user must be able to view and update the FirstName field. You have 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") %>"

/A Answer: A Question: 58 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You add a TextBox control named TextBox01. The code segment below is written 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;} Now you receive an order from your company manager, according to his requirement, you have to validate the value of TextBox01. Of the following code fragments, which one should be added to the Web page? A. <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox01" ValidateEmptyText="True"

onservervalidate="CustomValidator1_ServerValidate"></asp:CustomValidator><asp:CompareValidator ID="CompareValidator1" runat="server" Type="Date" EnableClientScript="true"

ControlToValidate="TextBox01" ValueToCompare="<%= DateTime.Now; %>"></asp:CompareValidator>

B. <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox01" ValidateEmptyText="True"

onservervalidate="CustomValidator1_ServerValidate"></asp:CustomValidator><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox01"

InitialValue="<%= DateTime.Now; %>" ></asp:RequiredFieldValidator>

Page 33: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 33 of 54

C. <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox01" ValidateEmptyText="True"onservervalidate="CustomValidator1_ServerValidate"></asp:Custom

Validator><asp:Com ID="CompareValidator1" runat="server" Type="Date" EnableClientScript="true" ControlToValidate="TextBox1" Operator="DataTypeCheck" ></asp:CompareValidator>

D. <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox01" onservervalidate="CustomValidator1_ServerValidate"></asp:CustomValidator><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" EnableClientScript="false" InitialValue="<%= DateTime.Now; %>" ></asp:RequiredFieldValidator>

Answer: C Question: 59 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. There are two pages in the application. The two HtML pages are respectively named ErrorPage.htm and PageNotIdentified.htm. Now you receive an order from your company manager, according to his requirement, the PageNotFound.htm page must be displayed when the user requests a page that does not exist, and the ErrorPage.htm page must be displayed when any other error occurs. A. <customErrors mode="Off"> <error statusCode="400" redirect="ErrorPage.htm"/> <error statusCode="404" redirect="PageNotFound.htm"/></customErrors> B. <customErrors mode="On"> <error statusCode="400" redirect="ErrorPage.htm"/> <error statusCode="404" redirect="PageNotFound.htm"/></customErrors> C. <customErrors mode="On" defaultRedirect="ErrorPage.htm"> <error statusCode="404" redirect="PageNotFound.htm"/></customErrors> D. <customErrors mode="Off" defaultRedirect="ErrorPage.htm"> <error statusCode="404" redirect="PageNotFound.htm"/></customErrors> Answer: C Question: 60 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. A Web page which has a GridView control named GridView01 is created. There is a database and a table respectively named Area and Site. The GridView1 control displays the data from the database and the table. You write the code segment below to populate the GridView1 control. (Line numbers are used for reference only.) 1 protected void Page_Load(object sender, EventArgs e) 2 { 3 string connstr; 4 5 SqlDependency.Start(connstr); 6 using (SqlConnection connection = 7 new SqlConnection(connstr)) 8 { 09 SqlCommand sqlcmd = new SqlCommand(); 10 DateTime expires = DateTime.Now.AddMinutes(30); 11 SqlCacheDependency dependency = new 12 SqlCacheDependency("Region", "Location");

Page 34: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 34 of 54

13 Response.Cache.SetExpires(expires); 14 Response.Cache.SetValidUntilExpires(true); 15 Response.AddCacheDependency(dependency); 16 17 sqlcmd.Connection = connection; 18 GridView1.DataSource = sqlcmd.ExecuteReader(); 19 GridView1.DataBind(); 20 } 21 } Now you receive an order from your company manager, according to his requirement, the proxy servers must be able to cache the content of the GridView01 control. You have been assigned to make sure of this. At line6, which code segment should be inserted? A. Response.Cache.SetCacheability(HttpCacheability.Public); B. Response.Cache.SetCacheability(HttpCacheability.Private); C. Response.Cache.SetCacheability (HttpCacheability.ServerAndPrivate); D. Response.Cache.SetCacheability (HttpCacheability.Server); Answer: A Question: 61 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. There are several departments in your company. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. Windows Authentication is used for the application. Now according to the business requirement, the Service department has to access a particular file. So you set up NTFS file system permissions for the Service department. But after the setup, the file is available to all the users. You receive an order from your company manager, according to his requirement, only users of the Service department are allowed to access the file. You have been assigned this task. So what step should you perform next? A. The rights should be removed from the application pool identity to the file. B. The rights should be removed from the ASP.NET user to the file. C. The <authentication mode="[None]"> section should be removed to the Web.config file. D. The <identity impersonate="true"/> section should be removed to the Web.config file. Answer: D Question: 62 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. 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> A MultiView control which contains three child View controls is added named MultiView1 to the Web page. You name the MultiView control MultiView01. Now you receive an order from your company manager, according to his requirement, you must be able to use the DropDownList01 DropDownList control to choose the View controls. You must achieve this goal. Of the following code segments, which one should be used?

Page 35: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 35 of 54

A. int idx = int.Parse(DropDownList1.SelectedValue);MultiView1.ActiveViewIndex = idx; B. int idx = int.Parse(DropDownList1.SelectedValue);MultiView1.Views[idx].Visible = true; C. int idx = DropDownList1.SelectedIndex;MultiView1.ActiveViewIndex = idx; D. int idx = DropDownList1.SelectedIndex;MultiView1.Views[idx].Visible = true; Answer: C Question: 63 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET application. 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); } } Look at the device filter element below, it is added ito the Web.config file. <filter name="FltrScreenSize" type="MyWebApp.CapabilityEvaluator,MyWebApp" method="ChkScreenSize" /> In order to identify whether the size of the device display is less than 80 characters, you have to write a code segment. Of the following code segments, which one should you use? A. MobileCapabilities currentMobile;currentMobile = Request.Browser as MobileCapabilities;if (currentMobile.HasCapability( "CapabilityEvaluator.ChkScreenSize", "").ToString()=="80"){ } B. MobileCapabilities currentMobile;currentMobile = Request.Browser as MobileCapabilities;if(currentMobile.HasCapability("FltrScreenSize","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( "FltrScreenSize","").ToString()=="80"){ } Answer: B Question: 64 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application which uses Session objects. Now you are modifying the application, making it run on a Web farm. Now your company CIO posts two requirements. According to his requirement, the application must be able to access the Session objects, besides this, the Session objects cannot be lost if any server in the Web farm restarts or has no response. You are assigned a task to achieve the two goals. So what action should you perform?

Page 36: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 36 of 54

A. You should store session data in a common State Server process on a Web server in the Web farm by using the StateServer Session Management mode.

B. You should store session data in the ASP.NET worker process by using the InProc Session Management mode.

C. You should store session data in a common Microsoft SQL Server 2005 database by using the InProc Session Management mode.

D. You should store session data in an individual database for each Web server in the Web farm by using the SQLServer Session Management mode.

Answer: C Question: 65 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET application. You use ASP.NET AJAX to create a Web form. In order to handle the exceptions thrown from asynchronous postbacks, you write the following client-script code fragment. (Line numbers are used for reference only.) 1 <script type="text/javascript"> 2 function pageLoad() 3 { 4 var pageMgr = 5 Sys.WebForms.PageRequestManager.getInstance(); 6 7 } 8 9 function errorHandler(sender, args) 10 { 11 12 } 13 </script> Now you receive an order from your company manager, according to his requirement, the application must use a common client-script function named errorHandler, update a Label control that has an ID named lblError with the error message, and must prevent the browser from displaying any message box or Javascript error. You have been assigned this task to make sure of these. So what action should you perform? A. Insert the following code segment at line 06. pageMgr.add_pageLoaded(errorHandler); Insert

the following code segment at line 11. if (args.get_error() != null) { $get('lblError').innerHTML = args.get_error().message;}

B. Insert the following code segment at line 06. pageMgr.add_endRequest(errorHandler); Insert the following code segment at line 11. if (args.get_error() != null) { $get('lblError').innerHTML = args.get_error().message; args.set_errorHandled(true);}

C. Insert the following code segment at line 06. pageMgr.add_endRequest(errorHandler); Insert the following code segment at line 11. if (args.get_error() != null) { $get('lblError').innerHTML = args.get_error().message;}

D. Insert the following code segment at line 06. pageMgr.add_pageLoaded(errorHandler); Insert the following code segment at line 11. if (args.get_error() != null) { $get('lblError').innerHTML = args.get_error().message; args.set_errorHandled(true);}

Answer: B Question: 66

Page 37: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 37 of 54

You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. C# is used by the Web site as the programming language. According to the requirement of the company CIO, you have to add a code file written in Microsoft VB.NET to the application. But this code segment will not be converted to C#. The code fragment below is added to the Web.config file of the application. <compilation debug="false"> <codeSubDirectories> <add directoryName="VBCode"/> </codeSubDirectories> </compilation> Now the company CIO posts two requirements, according to his requirement, the existing VB.NET file must be used in the Web application and can be modified and compiled at run time. You have to make sure of this. So what action should you perform? A. Inside the App_Code folder of the application, you should create a new folder named VBCode.

Then you should place the VB.NET code file in this new folder. B. At the root of the application, create a new folder named VBCode. Then you should place the

VB.NET code file in this new folder. C. You should create a new Microsoft Windows Communication Foundation (WCF) service

project that uses VB.NET as the programming language. Then you should expose the VB.NET code functionality through the WCF service. At last a service reference should be added to the WCF service project in the application.

D. You should create a new class library that uses VB.NET as the programming language. Then the VB.NET code file should be added to the class library. And a reference should be added to

the class library in the application. Answer: A Question: 67 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET AJAX application. In the AJAX application, a JavaScript code segment does not exhibit the desired behavior. An error icon is displayed in the status bar by Microsoft Internet Explorer, but you are not prompted to debug the script. Therefore you have to perform the configuration on the Internet Explorer, making it prompt you to debug the script. So what should you do? (choose more than one) A. You should select the Show friendly HTTP error messages check box. B. You should clear the Disable Script Debugging (Other) check box. C. You should clear the Disable Script Debugging (Internet Explorer) check box. D. You should select the Display a notification about every script error check box. E. You should select the Enable third-party browser extensions check box. Answer: C, D Question: 68 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. A custom-templated server control is created. Now you receive an order from your

Page 38: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 38 of 54

company manager, according to his requirement, within the control hierarchy of the page,the child controls of the server control must be uniquely identified. In the options below, which interface should you implement? A. The ITemplatable interface B. The INamingContainer interface C. The IRequiresSessionState interface D. The IPostBackDataHandler interface Answer: B Question: 69 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You use the default ASP.NET version 2.0 application pool and Windows Authentication to deploy the application on a Microsoft IIS 6.0 Web server. The application has the functionality of uploading files to a location on a different server. Now you receive some reports from users, in the e-mail, users report that when they try to submit a file, an access denied error is sent to them. As the technical support, you have to solve this problem. The Web.config file has to be modified. Of the following code fragments, which one should be used? A. <anonymousIdentification enabled="true" /> B. <identity impersonate="true" /> C. <authorization> <allow users="*" /></authorization> D. <roleManager enabled="true" defaultProvider="AspNetWindowsTokenRolePRovider" /> Answer: B Question: 70 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET application. Look at the following code fragment. (Line numbers are included for reference only.) 1 <script runat="server"> 2 protected void Button_Handler(object sender, EventArgs e) 3 { 4 // some long-processing operation. 5 } 6 </script> 7 <div> 8 <asp:ScriptManager ID="defaultScriptManager" 9 runat="server" /> 10 11 <asp:UpdatePanel ID="defaultPanel" 12 UpdateMode="Conditional" runat="server"> 13 <ContentTemplate> 14 <!-- more content here --> 15 <asp:Button ID="btnSubmit" runat="server" 16 Text="Submit" OnClick="Button_Handler" /> 17 </ContentTemplate> 18 </asp:UpdatePanel> 19 </div>

Page 39: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 39 of 54

In the application, you use the above code fragment to create a Web form. Now your company manager asks you to use ASP.NET AJAX to create a client-side script code. According to the requirement of the company manager, any subsequent Click events on the btnSubmit Button control must be suppressed when a request is being processed. The manager asks you to make sure of this. At line 10, which code fragment should be inserted? A. <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>

B. <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>

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') { rm.abortPostBack(); alert('A previous request is still in progress.'); } }</script>

D. <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>

Answer: D Question: 71 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application which consumes an ASMX Web service. Look at the URL below: http://www.contoso.com/TemperatureService/Convert.asmx This URL hosts the Web service Now you receive an order from your company manager, according to his requirement, the client computers must be able to communicate with the service as part of the <system.serviceModel> configuration. You have been assigned this task. Of the following code fragment, which one should be used? A. <client> <endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx"binding="wsDualHttpBinding"

/></client> B. <client> <endpointaddress="http: //www.contoso.com/TemperatureService/Convert.asmx"binding="wsHttpBinding" /></client> C. <client> <endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx"binding="basicHttpBinding" /></client> D. <client> <endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx"binding="ws2007HttpBinding"

/></client> Answer: C Question: 72

Page 40: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 40 of 54

You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You write the following code segment to create a class named MultimediaDownloader. The class implements the IHttpHandler interface. namespace Contoso.Web.UI { public class MultimediaDownloader : IHttpHandler { ... } } The MultimediaDownloader class returns the content of the multimedia files from the Web server and processes requests for the files that have the .media file extension. The .media file extension is mapped to the aspnet_isapi.dll file in Microsoft IIS 6.0. According to the requirement of the company CIO, you have to configure the MultimediaDownloader class in the Web.config file of the application. Which code fragment should be used? A. <httpHandlers> <add verb="*" path="*.media" validate="false" type="Contoso.Web.UI.MultimediaDownloader" /></httpHandlers> B. <httpHandlers> <add verb="GET,POST" path="*" validate="true" type="Contoso.Web.UI.MultimediaDownloader" /></httpHandlers> C. <httpHandlers> <add verb="*.media" path="*" validate="false" type="Contoso.Web.UI.MultimediaDownloader" /></httpHandlers> D. <httpHandlers> <add verb="HEAD" path="*.media" validate="true" type="Contoso.Web.UI.MultimediaDownloader" /></httpHandlers> Answer: A Question: 73 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. In order to create a Web form, you write the following code segment in the code-behind file. (Line numbers are used for reference only.) 1 string strQuery = "select * from Products;" 2 + "select * from Categories"; 3 SqlCommand cmd = new SqlCommand(strQuery, cnn); 4 cnn.Open(); 5 SqlDataReader rdr = cmd.ExecuteReader(); 6 7 rdr.Close(); 8 cnn.Close(); There are two database tables. One is the Products database table, another one is the Categories database table. Now you receive an order from your company manager, according to his requirement, the gvProducts and gvCategories GridView controls must display the data that is contained in the tables. You have been assigned this task. At line 6, which code segment should be inserted? A. gvProducts.DataSource = rdr;gvCategories.DataSource = rdr;gvProducts.DataBind();rdr.NextResult();gvCategories.DataBind();

Page 41: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 41 of 54

B. gvProducts.DataSource = rdr;gvProducts.DataBind();gvCategories.DataSource = rdr;gvCategories.DataBind(); C. gvProducts.DataSource = rdr;gvCategories.DataSource = rdr;gvProducts.DataBind();gvCategories.DataBind(); D. gvProducts.DataSource = rdr;rdr.NextResult();gvCategories.DataSource = rdr;gvProducts.DataBind();gvCategories.DataBind(); Answer: A Question: 74 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. A page is created. The page contains the control below: <asp:Calendar EnableViewState="false" ID="calBegin" runat="server" /> You write the code segment below 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;} According to the requirement of the company CIO, the calBegin Calendar control must maintain the selected date. You are assigned to make sure of this. Which code segment should be inserted in the constructor of the page? A. this.Init += new EventHandler(LoadDate);this.PreRender += new EventHandler(SaveDate); B. this.Load += new EventHandler(LoadDate);this.PreRender += new EventHandler(SaveDate); C. this.Load += new EventHandler(LoadDate);this.Unload += new EventHandler(SaveDate); D. this.Init += new EventHandler(LoadDate);this.Unload += new EventHandler(SaveDate); Answer: B Question: 75 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET AJAX application. In order to debug the JavaScript code in the AJAX application, Microsoft Visual Studio 2008 debugger is attached to the Microsoft Internet Explorer instance. Now you receive an order from your company manager, according to his requirement, the application must display the details of the client-side object on the debugger console. The manager asks you to make sure of this. So what action should you perform? A. In order to make sure of this, the Sys.Debug.assert method should be used. B. In order to make sure of this, the Sys.Debug.traceDump method should be used. C. In order to make sure of this, the Sys.Debug.fail method should be used. D. In order to make sure of this, the Sys.Debug.trace method should be used. Answer: B Question: 76 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application on a Microsoft IIS 6.0 Web server. The server hosts the .NET Framework version 1.1 Web applications and runs on a worker process isolation mode. An error message pops up when

Page 42: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 42 of 54

you browse the application. The error message is "It is impossible to run different versions of ASP.NET in the same IIS process. Please reconfigure your server to run the application in a separate process by using the IIS Adinistratration Tool." You must make sure that all the applications run on the server and remain in process isolation mode, and do not change their configurations. What action should you perform? (choose more thano one) A. You should configure the IIS 6.0, making it run the WWW service in the IIS 5.0 isolation mode. B. You should add the new application to the application pool that you create. C. In the Application Pool Properties dialog box, you should disable the Recycle worker

processes option. D. You should configure the new application, making it use the .NET Framework version 2.0 in

the IIS 6.0 Manager. E. You should set autoConfig="false" on the <processModel> property in the machine.config file. Answer: B, D Question: 77 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. There is a server named WiikigoTest which runs Microsoft IIS 5.0. The WiikigoTest server hosts the application. There is a computer named WiikigoComp. You log on to the Wiikigo.com domain by using this computer with an account named WiikigoUser. Both the WiikigoComp and WiikigoTest are members of the Wiikigo.com domain. Now you receive an order from your company manager, according to his requirement, remote debugging should be allowed. So you have to set up the appropriate permission for remote debugging. What action should you do? A. The ContosoUser account should be added to the domain Administrators group. B. You should set the Remote Debugging Monitor, making it use Windows Authentication. C. On the ContosoTest server, you should change the ASP.NET worker process, making it run as

the local Administrator account. D. The ContosoUser account should be added to the local Administrators group on the

ContosoTest server. Answer: D Question: 78 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You create a Web form is created. The Web form 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.) 1 protected void Page_Load(object sender, EventArgs e) 2 { 3 DataSet objDS = new DataSet();

Page 43: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 43 of 54

4 SqlDataAdapter objDA = new SqlDataAdapter(objCmd); 5 objDA.Fill(objDS); 6 gridCities.DataSource = objDs; 7 gridCities.DataBind(); 8 Session["ds"] = objDS; 9 } 10 protected void btnSearch_Click(object sender, EventArgs e) 11 { 12 13 } Now you get an e-mail from your company CIO, according to his requirement, by using the value of the txtSearch TextBox, the records in the gridCities GridView control are filtered when the btnSearch Button control is clicked. You're assigned this task to make sure of this. At line 12, which code segment you be inserted? A. DataSet ds = gridCities.DataSource as DataSet; DataView dv = ds.Tables[0].DefaultView;

dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'"; gridCities.DataSource = dv; gridCities.DataBind(); B. DataSet ds = Session["ds"] as DataSet; DataView dv = ds.Tables[0].DefaultView; dv.RowFilter

= "CityName LIKE '" + txtSearch.Text + "%'"; gridCities.DataSource = dv; gridCities.DataBind(); C. DataTable dt = Session["ds"] as DataTable; DataView dv = dt.DefaultView; dv.RowFilter =

"CityName LIKE '" + txtSearch.Text + "%'"; gridCities.DataSource = dv; gridCities.DataBind(); D. DataSet ds = Session["ds"] as DataSet; DataTable dt = ds.Tables[0]; DataRow[] rows = dt.Select("CityName LIKE '" + txtSearch.Text + "%'"); gridCities.DataSource = rows;

gridCities.DataBind(); Answer: B Question: 79 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application which permits users to post comments to a page. Other users can also view this page. You add a SqlDataSource control named SqlDS1. You write the following code segment. (Line numbers are included for reference only.) 1 private void SaveComment() 2 { 3 string ipaddr; 4 5 SqlDS1.InsertParameters["IPAddress"].DefaultValue = ipaddr; 6 ... 7 SqlDS1.Insert(); 8 } Now you receive an order from your company manager, according to his requirement, the IP Address of each user who posts a comment must be captured along with the user's comment. At line 4, which code segment should be inserted? A. ipaddr = Application["REMOTE_ADDR"].ToString(); B. ipaddr = Server["REMOTE_ADDR"].ToString(); C. ipaddr = Request.ServerVariables["REMOTE_ADDR"].ToString(); D. ipaddr = Session["REMOTE_ADDR"].ToString();

Page 44: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 44 of 54

Answer: C Question: 80 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. Now you company CIO wants to deploy the application to a test server. He assigns this task to you. The code-behind files for the Web pages must be compiled during the initial request to the application. You must make sure of this. Besides this, you have to improve the performance of the application. Of the following code fragments, which one should be added to the Web.config file? A. <compilation debug="false" batch="false"> B. <compilation debug="true"> C. <compilation debug="true" batch="true"> D. <compilation debug="false"> Answer: D Question: 81 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. In the application, a single master page is used by all the content pages. The master page browses the site by using a static navigation menu. Now you receive an order from your company manager, according to his requirement, the content pages must be able to optionally replace the static navigation menu with their own menu controls. You have been assigned to make sure of this. So what action should you perform to achieve this goal? A. 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>

B. 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);

C. Add the following code fragment to the master page. <asp:PlaceHolder ID="MenuPlaceHolder" runat="server"> <!-- Menu code here --></asp:PlaceHolder> Add the following code fragment to the content page. <asp:Content PlaceHolderID="MenuPlaceHolder"> <asp:menu ID="menuControl" runat="server"></asp:menu></asp:Content> D. 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);

Answer: A Question: 82 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named

Page 45: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 45 of 54

Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application which runs on Microsoft IIS 6.0. A page named usedPage.aspx is created. Now your company assigns a task to you. According to his requirement, the browser must display the URL of the usedPage.aspx page and the page named newPage.aspx. You have to achieve this goal. So in the options below, which code segment should be used? A. Response.Redirect("newPage.aspx"); B. Server.Transfer("newPage.aspx"); C. if (Request.Url.UserEscaped) { Response.RedirectLocation = "oldPage.aspx"; Response.Redirect("newPage.aspx", true);}else { Response.Redirect("newPage.aspx");} D. if (Request.Url.UserEscaped) { Server.TransferRequest("newPage.aspx");}else { Response.Redirect("newPage.aspx", true);} Answer: B Question: 83 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. There are two Web pages in the application. The two Web pages are respectively named BillDetails.aspx and BillError.htm. A stack trace is displayed to remote users if the application throws unhandled errors in the BillDetails.aspx Web page. You must make sure that the BillError.htm Web page is displayed for unhandled errors only in the BillDetails.aspx Web page. So what action should you perform? A. Set the Page attribute for the BillDetails.aspx Web page in the following manner. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="BillDetails.aspx.cs" Inherits="BillDetails" Debug="true" %> Add the following section to the Web.config file. <customErrors mode="On" defaultRedirect="BillError.htm"> B. Set the Page attribute for the BillDetails.aspx Web page in the following manner. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="BillDetails.aspx.cs" Inherits="BillDetails" %> Add the following section to the Web.config file. <customErrors mode="Off" defaultRedirect="BillError.htm"></customErrors> C. Set the Page attribute for the BillDetails.aspx Web page in the following manner. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="BillDetails.aspx.cs" Inherits="BillDetails" Debug="true" ErrorPage="~/BillError.htm" %> Add the following section to the Web.config file. <customErrors mode="Off"></customErrors> D. Set the Page attribute for the BillDetails.aspx Web page in the following manner. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="BillDetails.aspx.cs" Inherits="BillDetails" ErrorPage="~/BillError.htm" Debug="false" %> Add the following section to the Web.config file. <customErrors mode="On"></customErrors> Answer: D Question: 84 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You create a class. The class implements the IHttpHandler interface. Look at the code segment below: 01 Public Sub ProcessRequest(ByVal ctx As HttpContext) 02 03 End Sub You use the above code segment to implement the ProcessRequest method.

Page 46: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 46 of 54

You must make sure that when the handler is requested, the image named Alert.jpg is displayed in the browser. At line 2, which code segment should be inserted? A. ctx.Response.ContentType = "image/jpg"Dim fs As FileStream = File.OpenRead( _ ctx.Server.MapPath("Alert.jpg"))Dim b As IntegerWhile (b = fs.ReadByte()) <> -1 ctx.Response.OutputStream.WriteByte(CByte(b))End WhileFs.Close() B. Dim sr As New StreamReader( _ File.OpenRead(ctx.Server.MapPath("Alert.jpg")))ctx.Response.Pics(sr.ReadToEnd())sr.Close() C. ctx.Response.TransmitFile("image/jpg")Dim fs As FileStream = File.OpenRead( _ ctx.Server.MapPath("Alert.jpg"))Dim b As IntegerWhile (b = fs.ReadByte()) <> -1 ctx.Response.OutputStream.WriteByte(CByte(b))End WhileFs.Close() D. Dim sr As New StreamReader( _

File.OpenRead(ctx.Server.MapPath("Alert.jpg")))ctx.Response.Pics("image/jpg")ctx.Response.TransmitFile(sr.ReadToE

Answer: A Question: 85 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. A Web page is created. The Web page contains the following two XML fragments. (Line numbers are used for reference only.) 1 <script runat="server"> 2 3 </script> 4 <asp:ListView ID="ListView1" runat="server" 5 DataSourceID="SqlDataSource1" 6 7 > 8 <ItemTemplate> 9 <td> 10 <asp:Label ID="WireAmountLabel" runat="server" 11 Text='<%# Eval("WireAmount") %>' /> 12 </td> 13 </ItemTemplate> From a Microsoft SQL Server 2005 database table which has a column named WireAmount , the SqlDataSource1 object retrieves the data. Now you receive an order from your company CIO, according to his requirement, the column must be displayed in red color when the size of the WireAmount column value is greater than seven characters. The CIO assigns this task to you that you must make sure of this. So what action should you perform? A. Insert the following code segment at line 06. OnItemDataBound="FmtClr" Insert the following

code segment at line 02. Protected Sub FmtClr(ByVal sender As Object, _ ByVal e As ListViewItemEventArgs) Dim WireAmount As Label = _

DirectCast(e.Item.FindControl("WireAmountLabel"), Label) If WireAmount IsNot Nothing Then If WireAmount.Text.Length > 7 Then WireAmount.ForeColor = Color.Red Else WireAmount.ForeColor = Color.Black End If

End IfEnd Sub B. Insert the following code segment at line 06. OnItemDataBound="FmtClr" Insert the following

code segment at line 02. Protected Sub FmtClr(ByVal sender As Object, _ ByVal e As ListViewItemEventArgs) Dim WireAmount As Label = _

DirectCast(e.Item.FindControl("WireAmount"),

Page 47: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 47 of 54

Label) If WireAmount.Text.Length > 7 Then WireAmount.ForeColor = Color.Red Else WireAmount.ForeColor = Color.Black End IfEnd Sub C. Insert the following code segment at line 06. OnDataBinding="FmtClr" Insert the following

code segment at line 02. Protected Sub FmtClr(ByVal sender As Object, _ ByVal e As EventArgs)

Dim WireAmount As New Label() WireAmount.ID = "WireAmount" If WireAmount.Text.Length > 7 Then

WireAmount.ForeColor = Color.Red Else WireAmount.ForeColor = Color.Black End IfEnd Sub D. Insert the following code segment at line 06. OnDataBound="FmtClr" Insert the following code

segment at line 02. Protected Sub FmtClr(ByVal sender As Object, _ ByVal e As EventArgs) Dim WireAmount As New Label() WireAmount.ID = "WireAmountLabel" If

WireAmount.Text.Length > 7 Then WireAmount.ForeColor = Color.Red Else WireAmount.ForeColor = Color.Black End IfEnd Sub Answer: A Question: 86 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application which contains a Web form with a Label control named lblPrice . You define the following class. Public Class Product Public Property Price() As Decimal Get End Get Set(ByVal value As Decimal) End Set End Property End Class Look at the XML fragment below. You access the fragment by using a StringReader variable named xmlStream. <Product> <Price>35</Price> </Product> Now you get an e-mail from your company manager, the manager wants to view the price of the product, so you have to display the price of the product from the XML fragment in the lblPrice Label control. Of the following code segments, which one should be used? A. Dim xDoc As New XmlDocument()xDoc.Load(xmlStream)Dim boughtProduct As Product = xDoc.OfType(Of Product)().First()lblPrice.Text = boughtProduct.Price.ToString() B. Dim dt As New DataTable()dt.ExtendedProperties.Add("Type", "Product")dt.ReadXml(xmlStream)lblPrice.Text = dt.Rows(0)("Price").ToString() C. Dim xr As XmlReader = XmlReader.Create(xmlStream)Dim boughtProduct As Product =

TryCast( _ xr.ReadContentAs(GetType(Product), Nothing), Product)lblPrice.Text = boughtProduct.Price.ToString() D. Dim xs As New XmlSerializer(GetType(Product))Dim boughtProduct As Product = TryCast( _ xs.Deserialize(xmlStream), Product)lblPrice.Text = boughtProduct.Price.ToString() Answer: D

Page 48: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 48 of 54

Question: 87 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application which has a user control named UCtrl.ascx. Look at the code fragment below: <%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %> <html> ... <body> <form id="form1" runat="server"> <div> <asp:Label ID="lblHeader" runat="server"></asp:Label> <asp:Label ID="lbFooter" runat="server"></asp:Label> </div> </form> </body> </html> You create a Web page named Default.aspx by using the above code fragment. According to the company requirement, the UCtrl.ascx control should be dynamically added between the lblHeader and lblFooter Label controls. What action should you perform? A. Between the lblHeader and lblFooter label controls, a PlaceHolder control named PlHldr

should be added. In the Init event of the Default.aspx Web page, write the code segment below. Dim ctrl As Control = LoadControl("UserCtrl.ascx")PlHldr.Controls.Add(ctrl)

B. In the Init event of the Default.aspx Web page, write the code segment below. Dim ctrl As Control = LoadControl("UserCtrl.ascx")Me.Controls.AddAt(1, ctrl)

C. In the Init event of the Default.aspx Web page write the code segment below. Dim ctrl As Control = LoadControl("UserCtrl.ascx")lblHeader.Controls.Add(ctrl)

D. Between the lblHeader and lblFooter label controls, a Literal control named Ltrl should be added. In the Init event of the Default.aspx Web page, write the following code segment. Dim ctrl As Control = LoadControl("UserCtrl.ascx")

Answer: A Question: 88 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. A class is created by you. The class contains the following code segment. (Line numbers are used for reference only.) 1 Public Function GetCachedProducts( _ ByVal conn As SqlConnection) As Object 2 3 If Cache("products") Is Nothing Then 4 Dim cmd As New SqlCommand("SELECT * FROM Products", conn) 5 conn.Open() 6 Cache.Insert("products", GetData(cmd)) 7 conn.Close() 8 End If 9 Return Cache("products") 10 End Function11 12 Public Function GetData(ByVal prodCmd As SqlCommand) As Object 13 14 End Function

Page 49: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 49 of 54

The GetCachedProducts method is called to provide this list from the Cache object once a Web form has to access a list of products. According to the requirement of the company CIO, the list of products must be always available in the Cache object. You are asked to make sure of this. At line 13, which code segment should be inserted? A. Dim da As New SqlDataAdapter()da.SelectCommand = prodCmdDim ds As New

DataSet()Return ds.Tables(0) B. Return prodCmd.ExecuteReader() C. Dim da As New SqlDataAdapter(prodCmd)Dim ds As New DataSet()da.Fill(ds)Return ds D. Dim dr As SqlDataReaderprodCmd.CommandTimeout = Integer.MaxValuedr = prodCmd.ExecuteReader()Return dr Answer: C Question: 89 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You intend 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> In order to create a custom parameter class, you write the following code segment. Public Class DayParameter Inherits Parameter End Class You must make sure that the current date and time is returned by the custom parameter. Of the following code segments, which code segment should be added to the DayParameter class? A. Protected Overloads Overrides Function _ Clone() As Parameter Dim pm As Parameter = New DayParameter() pm.DefaultValue = DateTime.Now Return pmEnd Function B. Protected Overloads Overrides Function _ Evaluate(ByVal context As HttpContext, _ ByVal

control As Control) As Object Return DateTime.NowEnd Function C. Protected Sub New() MyBase.New("Value", TypeCode.DateTime,

DateTime.Now.ToString())End Sub D. Protected Overloads Overrides Sub _ LoadViewState(ByVal savedState As Object)

DirectCast(savedState, _ StateBag).Add("Value", DateTime.Now)End Sub Answer: B, C Question: 90 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web

Page 50: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 50 of 54

application. According to the company requirement, a composite custom control named MyControl is created. Now an instance of the OrderFormData control has to be added to the MyControl control. Of the following code segments, which one should you use? A. Protected Overloads Overrides Sub _ CreateChildControls() Controls.Clear() Dim oFData As

New OrderFormData("OrderForm") Controls.Add(oFData)End Sub B. Protected Overloads Overrides Sub _ RenderContents(ByVal writer As HtmlTextWriter) Dim

oFData As New OrderFormData("OrderForm") oFData.RenderControl(writer)End Sub C. Protected Overloads Overrides Sub _ EnsureChildControls() Controls.Clear() Dim oFData As

New OrderFormData("OrderForm") oFData.EnsureChildControls() If Not ChildControlsCreated Then CreateChildControls() End IfEnd Sub D. Protected Overloads Overrides Function _ CreateControlCollection() As ControlCollection Dim

controls As New ControlCollection(Me) Dim oFData As New OrderFormData("OrderForm") controls.Add(oFData) Return controlsEnd Function Answer: A Question: 91 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. 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> A MultiView control which contains three child View controls is added named MultiView1 to the Web page. You name the MultiView control MultiView01. Now you receive an order from your company manager, according to his requirement, you must be able to use the DropDownList01 DropDownList control to choose the View controls. You must achieve this goal. Of the following code segments, which one should be used? A. Dim idx As Integer =

Integer.Parse(DropDownList01.SelectedValue)MultiView1.Views(idx).Visible = True B. Dim idx As Integer = DropDownList01.SelectedIndexMultiView01.ActiveViewIndex = idx C. Dim idx As Integer = DropDownList01.SelectedIndexMultiView01.Views(idx).Visible = True D. Dim idx As Integer =

Integer.Parse(DropDownList01.SelectedValue)MultiView1.ActiveViewIndex = idx Answer: B Question: 92 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. In the application, a single master page is used by all the content pages. The master page browses the site by using a static navigation menu. Now you receive an order from your company manager, according to his requirement, the content pages must be able to optionally replace the static navigation menu with their own menu controls.

Page 51: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 51 of 54

You have been assigned to make sure of this. So what action should you perform to achieve this goal? A. The following code fragment should be added to the master page. <asp:PlaceHolder

ID="MenuPlaceHolder runat="server"> <!-- Menu code here --></asp:PlaceHolder> Add the following code fragment

to the content page. <asp:Content PlaceHolderID="MenuPlaceHolder"> <asp:menu ID="menuControl" runat="server"></asp:menu></asp:Content> B. The following code fragment should be added 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. Dim

placeHolder As PlaceHolder = TryCast( _ Page.Master.FindControl("MenuPlaceHolder"), PlaceHolder)Dim menuControl As New Menu()placeHolder.Controls.Add(menuControl) C. The following code fragment should be added 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> D. The following code fragment should be added 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. Dim

placeHolder As ContentPlaceHolder = _ TryCast(Page.Master.FindControl("MenuPlaceHolder"), _ ContentPlaceHolder)Dim menuControl As New Menu()placeHolder.Controls.Add(menuControl) Answer: C Question: 93 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. There is a server named WiikigoTest that runs Microsoft IIS 6.0. The application is hosted on the wiikigoTest server. On the WiikigoTest server, you build remote debugging. There is another computer which is namd WiikigoComp. Now you get an order from the company CIO, according to his requirement, you have to debug the application remotely from computer WiikigoComp. What action should you perform? A. Microsoft Visual Studio.NET should be attached to the Msvsmon.exe process. B. Microsoft Visual Studio.NET should be attached to the w3wp.exe process. C. Microsoft Visual Studio.NET should be attached to the WebDev.WebServer.exe process. D. Microsoft Visual Studio.NET should be attached to the inetinfo.exe process. Answer: B Question: 94 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. A Web form is created, you add the code fragment below. <asp:Repeater ID="rptData" runat="server" DataSourceID="SqlDataSource1"

Page 52: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 52 of 54

ItemDataBound="rptData_ItemDataBound"> <ItemTemplate> <asp:Label ID="lblQuantity" runat="server" Text='<%# Eval("QuantityOnHand") %>' /> </ItemTemplate> </asp:Repeater> There is a table which is named Commodities. The SqlDataSource1 DataSource control retrieves the Quantity column values from this table. In order to create the rptData_ItemDataBound event handler, you write the code segment below. (Line numbers are used for reference only.) 1 Protected Sub rptData_ItemDataBound(ByVal sender As Object, _ 2 ByVal e As RepeaterItemEventArgs) 3 4 If lbl IsNot Nothing Then 5 If Integer.Parse(lbl.Text) < 10 Then 6 lbl.ForeColor = Color.Red 7 End If 8 End If 9 End Sub Now you receive an order from your company manager, according to his requirement, you have to retrieve a reference to the lblQuantity Label control into a variable named lbl. At line 3, which code segment should be inserted? A. Dim lbl As Label = _ TryCast(rptData.FindControl("lblQuantity"), Label) B. Dim lbl As Label = _ TryCast(e.Item.Parent.FindControl("lblQuantity"), Label) C. Dim lbl As Label = _ TryCast(Page.FindControl("lblQuantity"), Label) D. Dim lbl As Label = _ TryCast(e.Item.FindControl("lblQuantity"), Label) Answer: B Question: 95 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. You create two controls, one is a composite custom control named MyControl. Another one is a templated custom control named BillFormData. You write the code segment below to override the method named CreateChildControls() in the MyControl class. (Line numbers are used for reference only.) 1 Protected Overloads Overrides Sub CreateChildControls() 2 Controls.Clear() 3 Dim oFData As New BillFormData("BillForm") 4 5 End Sub The BillFormData control has to be added to the MyControl control. At line 4, which code segment should be inserted? A. oFData.TemplateControl = DirectCast(Template, TemplateControl)Controls.Add(oFData) B. Controls.Add(oFData)Template.InstantiateIn(Me) C. Template.InstantiateIn(oFData)Controls.Add(oFData) D. Me.Controls.Add(oFData)Me.TemplateControl = DirectCast(Template, TemplateControl) Answer: C Question: 96

Page 53: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 53 of 54

You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. Two user controls are created by you. They are respectivley named UCtrlA.ascx and UCtrlB.ascx. The user controls postback to the server. You create a new Web page that has the following ASPX code. 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> You write the following code segment for the Web page for dynamically creating the user controls. Public Sub LoadControls() If ViewState("CtrlA") IsNot Nothing Then Dim c As Control If CBool(ViewState("CtrlA")) = True Then c = LoadControl("UserCtrlA.ascx") Else c = LoadControl("UserCtrlB.ascx") End If c.ID = "Ctrl" PlHolder.Controls.Add(c) End If End Sub Protected Sub Chk_CheckedChanged(ByVal sender As Object, _ ByVal e As EventArgs) ViewState("CtrlA") = Chk.Checked PlHolder.Controls.Clear() LoadControls() End Sub According to the requirement of the company CIO, the user control that is displayed must be recreated during postback and retains its state. You have been assigned this task to make sure of this. Which method should be added to the Web page? A. Protected Overloads Overrides Sub _ OnLoadComplete(ByVal e As EventArgs) MyBase.OnLoadComplete(e) LoadControls()End Sub B. Protected Overloads Overrides Sub _ LoadViewState(ByVal savedState As Object) MyBase.LoadViewState(savedState) LoadControls()End Sub C. Protected Overloads Overrides Function _ SaveViewState() As Object LoadControls() Return MyBase.SaveViewState()End Function D. Protected Overloads Overrides _ Sub Render(ByVal writer As HtmlTextWriter) LoadControls() MyBase.Render(writer)End Sub Answer: B Question: 97 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. A custom-templated server control is created. Now you receive an order from your company manager, according to his requirement, within the control hierarchy of the page?0?50??1the child controls of the server control must be uniquely identified. In the options below, which interface should you implement? A. the IPostBackDataHandler interface

Page 54: 70-562

Exam Name: TS: MS.NET Framework 3.5, ASP.NET Application Development Exam Type: Microsoft Exam Code: 70-562(CSharp) Total Questions: 98

Page 54 of 54

B. the ITemplatable interface C. the INamingContainer interface D. the IRequiresSessionState interface Answer: C Question: 98 You are an application developer and you have about two years experience in developing Web-based applications by using Microsoft ASP.NET. Now you are employed in a company named Wiikigo. You use the Microsoft .NET Framework version 3.5 to create a Microsoft ASP.NET Web application. In order to create a Web form, you write the following code segment in the code-behind file. (Line numbers are used for reference only.) 1 Dim strQuery As String = "select * from Products;" + _ "select * from Categories" 2 Dim cmd As New SqlCommand(strQuery, cnn) 3 cnn.Open() 4 Dim rdr As SqlDataReader = cmd.ExecuteReader() 5 6 rdr.Close() 7 cnn.Close() There are two database tables. One is the Products database table, another one is the Categories database table. Now you receive an order from your company manager, according to his requirement, the gvProducts and gvCategories GridView controls must display the data that is contained in the tables. You have been assigned this task. At line 5, which code segment should be inserted? A. gvProducts.DataSource = rdrgvCategories.DataSource = rdrgvProducts.DataBind()rdr.NextResult()gvCategories.DataBind() B. gvProducts.DataSource = rdrgvProducts.DataBind()gvCategories.DataSource = rdrgvCategories.DataBind() C. gvProducts.DataSource = rdrgvCategories.DataSource = rdrgvProducts.DataBind()gvCategories.DataBind() D. gvProducts.DataSource = rdrrdr.NextResult()gvCategories.DataSource = rdrgvProducts.DataBind()gvCategories.DataBind() Answer: A

End of Document