Tips to Pass 70-562 Exam (49 to 64)

Exam Code: 70-562 (Practice Exam Latest Test Questions VCE PDF)
Exam Name: TS: MS .NET Framework 3.5, ASP.NET Application Development
Certification Provider: Microsoft
Free Today! Guaranteed Training- Pass 70-562 Exam.

2016 Apr 70-562 Study Guide Questions:

Q49. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application contains two Web pages named OrderDetails.aspx and OrderError.htm. 

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

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

What should you do? 

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

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

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

Add the following section to the Web.config file. 

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

</customErrors> 

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

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

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

Add the following section to the Web.config file. 

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

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

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

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

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

Add the following section to the Web.config file. 

<customErrors mode="On"> 

</customErrors> 

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

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

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

ErrorPage="~/OrderError.htm" %> 

Add the following section to the Web.config file. 

<customErrors mode="Off"> 

</customErrors> 

Answer: C


Q50. You create a Web site by using the Microsoft ASP.NET 2.0. The Web site uses a global theme that is specified in the Web.config file. You create a new Web page theme named NewTheme. You need to override the global theme for a particular Web page by using NewTheme. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.) 

A. Add the following code to the Web page to override the global theme. 

Protected Sub Page_PreInit( _ 

ByVal sender As Object, ByVal e As EventArgs) 

Page.Theme = "NewTheme" End Sub 

B. Add the following code to the Web page to override the global theme: 

Protected Sub Page_Load( _ 

ByVal sender As Object, ByVal e As EventArgs) 

Page.Theme = "NewTheme" 

End Sub 

C. Set the Web page descriptor in the following manner. 

<@ Page Language="VB" AutoEventWireup="true" StyleSheetTheme="NewTheme" %> 

D. Set the Web page descriptor in the following manner. 

<@ Page Language="VB" AutoEventWireup="true" EnableTheming="false" %> 

E. Set each Web server control that you require to override the global theme in the following manner. <asp:Textbox id="TextBox1" runat="server" SkinID="NewTheme" /> 

Answer: AC


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

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

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

01 protected override void OnInit(EventArgs e) 

02 { 

03 base.OnInit(e); 


05 } 

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

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

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

Which code segment should you insert at line 04? 

A. Page.RegisterRequiresPostBack(this); 

B. Page.RegisterRequiresControlState(this); 

C. Page.UnregisterRequiresControlState(this); 

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

Answer: B


Q52. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application uses a set of general-purpose utility classes that implement business logic. These classes are modified frequently. 

You need to ensure that the application is recompiled automatically when a utility class is modified. 

What should you do? 

A. Create the Web application by using a Microsoft Visual Studio ASP.NET Web Application project. 

Add the utility classes to the root folder of the Web application. 

B. Create the Web application by using a Microsoft Visual Studio ASP.NET Web site. 

Add the utility classes to the root folder of the Web application. 

C. Create the Web application by using a Microsoft Visual Studio ASP.NET Web Application project. 

Add the utility classes to the App_Code subfolder of the Web application. 

D. Create the Web application by using a Microsoft Visual Studio ASP.NET Web site. 

Add the utility classes to the App_Code subfolder of the Web application. 

Answer: D


Q53. You are developing a Web application. 

When a user logs on to the Web site, the application queries a Microsoft SQL Server database for current orders associated with that user. 

You need to store the query results so that pages in the site can access the original result set only until the user logs out. 

What should you do? (More than one answer choice may achieve the goal. Select the BEST answer.) 

A. Store the query result in an Application variable. 

B. Pass the object from page to page by using a HiddenField control on each page. 

C. Store the query result in a Session variable. 

D. Cache the object and expire the cache when the user logs out. 

Answer: C


70-562 exam topics

Refresh 70-562 practice:

Q54. You are developing a Web application for an online retailer. 

The Web application contains order information. The order information must be exposed by using an RSS feed. 

You need to generate a private feed for the order information by using the least amount of code. 

What should you do? (More than one answer choice may achieve the goal. Select the BEST answer.) 

A. Create a SyndicationFeed object, format the object by using a formatter object, and write the object to the output stream by using a TextWriter instance. 

B. Create a StringBuilder object and write the object to the output stream by using a TextWriter instance. 

C. Create a StringBuilder object and write the object to the output stream by using an XmlWriter instance. 

D. Create a SyndicationFeed object, format the object by using a formatter object, and write the object to the output stream by using an XmlWriter instance. 

Answer: D


Q55. You create a Microsoft Visual Studio solution that includes the following two projects: 

-An ASP.NET Web application project -A class library project named RulesEngine 

You deploy the Web application to a Web server that runs Windows Server 2003 and IIS 6.0. 

When you attempt to browse the application, you encounter the following error: 

Could not load file or assembly RulesEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. 

You need to identify the cause of the error. What should you do? (More than one answer choice may achieve the goal. Select the BEST answer.) 

A. On the Web server, launch the Global Assembly Cache Tool (gacutil.exe). 

B. On the Web server, open the application root directory and examine the contents of the \bin directory. C. In Visual Studio, verify that the Web application project contains a project reference to the RulesEngine project. 

C. On the Web server, examine the permissions on the %SystemRoot%\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files folder. 

Answer: B


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

The application has a Web form file named MovieReviews.aspx. 

The MovieReviews.aspx file connects to a LinqDataSource DataSource named LinqDataSource1 that has a primary key named MovieID. 

The application has a DetailsView control named DetailsView1. 

The MovieReviews.aspx file contains the following code fragment. (Line numbers are included for reference only.) 

01 <asp:DetailsView ID="DetailsView1" runat="server" 

02 DataSourceID="LinqDataSource1" 

04 /> 

05 <Fields> 06 <asp:BoundField DataField="MovieID" HeaderText="MovieID" 

07 InsertVisible="False" 

08 ReadOnly="True" SortExpression="MovieID" /> 

09 <asp:BoundField DataField="Title" HeaderText="Title" 

10 SortExpression="Title" /> 

11 <asp:BoundField DataField="Theater" HeaderText="Theater" 

12 SortExpression="Theater" /> 

13 <asp:CommandField ShowDeleteButton="false" 

14 ShowEditButton="True" ShowInsertButton="True" /> 

15 </Fields> 

16 </asp:DetailsView> 

You need to ensure that the users can insert and update content in the DetailsView1 control. 

You also need to prevent duplication of the link button controls for the Edit and New operations. 

Which code segment should you insert at line 03? 

A. AllowPaging="false" AutoGenerateRows="false" 

B. AllowPaging="true" AutoGenerateRows="false" DataKeyNames="MovieID" 

C. AllowPaging="true" AutoGenerateDeleteButton="false" AutoGenerateEditButton="true" AutoGenerateInsertButton="true" AutoGenerateRows="false" 

D. AllowPaging="false" AutoGenerateDeleteButton="false" AutoGenerateEditButton="true" AutoGenerateInsertButton="true" AutoGenerateRows="false" DataKeyNames="MovieID" 

Answer: B


Q57. DRAG DROP 

You are developing a page for a Web application. The page contains a method that returns a list of fruit names. 

You need to expose the method to the client as a Web service. 

How should you complete the page markup? 

To answer, drag the appropriate code segment or segments to the correct location or locations in the answer area. 


Answer: 



Q58. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. All the content pages in the application use a single master page. The master page uses a static navigation menu to browse the site. 

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

What should you do? 

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

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

< div id="menu" > 

< !-- Menu code here -- > 

< /div > 

< /asp:PlaceHolder > 

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

PlaceHolder placeHolder = 

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

Menu menuControl = new Menu(); 

placeHolder.Controls.Add(menuControl); 

B. Add the following code fragment to the master page. 

< asp: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 > 

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

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

< !-- Menu code here -- > 

< /asp:ContentPlaceHolder > 

Add the following code fragment to the content page. 

< asp:Content ContentPlaceHolderID="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: B


70-562 training

Validated 70-562 pack:

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

You host the application on a server named ContosoTest that runs Microsoft IIS 6.0. You set up remote debugging on the ContosoTest server. 

You need to debug the application remotely from another computer named ContosoDev. 

What should you do? 

A. Attach Microsoft Visual Studio.NET to the w3wp.exe process. 

B. Attach Microsoft Visual Studio.NET to the inetinfo.exe process. 

C. Attach Microsoft Visual Studio.NET to the Msvsmon.exe process. 

D. Attach Microsoft Visual Studio.NET to the WebDev.WebServer.exe process. 

Answer: A


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

You create a custom Web user control named CustomControl. You add the control to the Web application. 

The Web application uses a POST parameter named ControlTimer. 

You need to ensure that based on the following factors, the Web form caches a separate rendering of the custom Web user control: -The POST parameters -The major versions of a browser -The application names of a browser 

Which code segment should you use to decorate CustomControl? 

A. [PartialCaching(3000, null, "ControlTimer", null)] 

B. [PartialCaching(3000, "browser", "ControlTimer", null)] 

C. [PartialCaching(3000, "ControlTimer", null, "browser")] 

D. [PartialCaching(3000, null, "browser; ControlTimer", null )] 

Answer: C


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

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

<asp:Calendar SelectionMode="DayWeek" 

ID="Calendar1" runat="server"> 

</asp:Calendar> 

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

What should you do? 

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

if (e.Day.IsWeekend) { 

B. Day.IsSelectable = false; 

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

if (e.Day.IsWeekend) { 

if (Calendar1.SelectedDates.Contains(e.Day.Date)) 

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

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

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

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

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

st.DayOfWeek == DayOfWeek.Sunday) { 

list.Add(st); 

foreach (DateTime dt in list) { 

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

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

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

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

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

st.DayOfWeek == DayOfWeek.Sunday) { 

list.Add(st); 

foreach (DateTime dt in list) { 

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

Answer: A


Q62. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application has a mobile Web form that contains the following ObjectList control. 

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

Runat="server"> 

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

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

</mobile:ObjectList> You create an event handler named ObjectListCtrl_ItemCommand. 

You need to ensure that the ObjectListCtrl_ItemCommand handler detects the selection of the CmdDisplayDetails item. 

Which code segment should you write? 

A. public void ObjectListCtrl_ItemCommand( 

object sender, ObjectListCommandEventArgs e) 

if (e.CommandName == "CmdDisplayDetails") 

B. public void ObjectListCtrl_ItemCommand( 

object sender, ObjectListCommandEventArgs e) 

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

C. public void ObjectListCtrl_ItemCommand( 

object sender, ObjectListCommandEventArgs e) 

ObjectListCommand cmd = sender as ObjectListCommand; 

if (cmd.Name == "CmdDisplayDetails") 

D. public void ObjectListCtrl_ItemCommand( 

object sender, ObjectListCommandEventArgs e) 

ObjectListCommand cmd = e.CommandSource as ObjectListCommand; 

if (cmd.Name == "CmdDisplayDetails") 

Answer: A


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

You define the following class. 

public class Product { 

public decimal Price { get; set; } 

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

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

<Product> 

<Price>35</Price> 

</Product> 

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

Which code segment should you use? 

A. DataTable dt = new DataTable(); 

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

dt.ReadXml(xmlStream); 

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

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

Product boughtProduct = 

xr.ReadContentAs(typeof(Product), null) as Product; lblPrice.Text = boughtProduct.Price.ToString(); 

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

Product boughtProduct = 

xs.Deserialize(xmlStream) as Product; 

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

D. XmlDocument xDoc = new XmlDocument(); 

xDoc.Load(xmlStream); 

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

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

Answer: C


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

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

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

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

<html> 

... 

<body> 

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

<div> 

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

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

</div> 

</form> 

</body> 

</html> 

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

What should you do? 

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

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

this.Controls.AddAt(1, ctrl); 

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

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

lblHeader.Controls.Add(ctrl); 

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

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

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

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

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

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

PlHldr.Controls.Add(ctrl); 

Answer: D