70-515 187 Q&S TS: Web Applications Development with Microsoft .NET Framework 4

What should you do?

You are developing an ASP.NET MVC 2 Web application that displays product details. The global.asax.cs file contains the following code segment
01 public static void registerRoutes(RouteCollection routes)
02 {
03 routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
04 routes.MapRoute("Default", "{controller}/{action}/{id}", new {controller = "Home", action = "index", id = UrlParameter.Optional});
05 }
The URL "/products/PRODUCTNAME", where PRODUCTNAME is the name of the product, must give details for the product that is stored in a Microsoft SQL Server database.
You need to ensure that the routes are registered correctly.
What should you do?
A. Replace line 04 with the following code segment
routes.MapRoute("products/{productName}, "ProductDetails", new {controller = "Products", action = "index", productName = UrlParameter.Optional});
B. Add the following code segment between lines 04 and 05
routes.MapRoute("ProductDetails, "products/{productName}", new {controller = "Products", actions="index", productName = UrlParameter.Optional});
C. Replace lines 03 and 04 with the following code segment
routes.MapRoute("products/{productName}", "ProductDetails", new {controller ="Products", action="Index", productName=UrlParameter.Optional});
D. Add the following code segment between lines 03 and 04.
routes.MapRoute("ProductDetails","products/{productName}", new {controller="products", action ="Index", productName = UrlParameter.Optional});


Answer Clike
You are implementing an ASP.NET web page that contains a ScriptManager control.

You are implementing an ASP.NET web page that contains a ScriptManager control.
You need to ensure that only the required Microsoft AJAX Framework Javascript files are loaded.
A. Set the AjaxFrameworkMode property of the ScriptManager to Enabled, and reference each javascript file by adding a ScriptReference for each required file.
B. Set the AjaxFrameworkMode property of the ScriptManager to Explicit, and reference each JavaScript file by adding a ScriptReference for each required file.
C. Set the AjaxFrameworkMode property of the ScriptManager to Disabled, and reference each JavaScript file by adding a ScriptReference for each required file.
D. Set the AjaxFrameworkMode property of the ScriptManager to Enabled, and manually add a reference to each required JavaScript file to the HTML page head element.


Answer Clike
Which client endpoint configuration should you use?

You are developing an ASP.NET web application.
The application consumes a WCF service that implements a contract named IcontosoService.
The service is located on the local network and is exposed using the following endpoint <endpoint name="udpDiscover" kind="udpDiscoveryEndpoint"/> You need to consume the service by using the WS-Discovery protocol.
Which client endpoint configuration should you use?
A. <endpoint name="contosoEndpoint" address="oneway-basic" binding="basicHttpBinding" contract="IContosoService"/>
B. <endpoint name="contosoEndpoint" kind="dynamicEndpoint" binding="wsHttpBinding" contract="IContosoService"/>
C. <endpoint name="contosoEndpoint" address="twoway-basic" binding="basicHttpBinding" contract="IContosoService"/>
D. <endpoint name="contosoEndpoing" address="dynamicEndpoint" binding="wsHttpBinding" contract="*"/>


Answer Clike
What should you do?

You are developing an ASP.NET web page.
You need to ensure that content flows from right to left.
What should you do?
A. In the @Page directive, add an attribute named dir with a value of "RightToLeft"
B. In the @Page directive, add an attribute named dir with a value of "RTL"
C. In the <html> tag, add an attribute named dir with a value of "RTL"
D. In the <html> tag, add an attribute named dir with a value of "RightToLeft"


Answer Clike
What should you do?

You are implementing an ASP.NET application that uses data-bound GridView controls in multiple pages.
You add JavaScript code to periodically update specific types of data items in these GridView controls.
You need to ensure that the JavaScript code can locate the HTML elements created for each row in these GridView controls, without needing to be changed if the controls are moved from one page to another.
What should you do?
A. Replace the GridView control with a ListView control.
B. Set the ClientIDMode attribute to Predictable in the web.config file.
C. Set the ClientIDRowSuffix attribute of each unique GridView control to a different value.
D. Set the @ OutputCache directive’s VaryByControl attribute to the ID of the GridView control.


Answer Clike
Which markup should you use?

You are developing an ASP.NET Web page.
The page uses the MicrosoftAjax.js script file and the MicrosoftAjaxWebForms.js script file.
You need to ensure that both scripts are combined into a single script.
Which markup should you use?
A.

B.

C.

D.



Answer Clike
What should you do?

You are developing a Asp.net MVC 2 application
The following Customer class is rendered by the Html.DisplayForModel helper method. public class Customer
{
public string FirstName { get; set;}
public string LastName { get; set;}
public string EmailAddress { get; set;}
}
You create a partial view named Email.ascx in the Views/Shared/DisplayTemplates folder. Email.ascx performs custom formatting of e-mail addresses.
You need to ensure that the custom formatting is applied to only the EmailAddress property.
What should you do?
A. Rename Email.ascx to String.ascx.
B. Add the following attribute to the EmailAddress property.
[DataType(DataType.EmailAddress)]
C. Add the following attribute tot the EmailAddress property
[UIHint("Email")]
D. Rename Email.ascx to EmailAddress.ascx


Answer Clike
What should you do?

You are updating an ASP.NET Web Application. The application includes the fallowing classes.

An application page contains the fallowing markup.

You need to ensure that the page displays a list of supervisors with their corresponding employees.
What should you do?
A. Bind rptEmployees during the OnItemCommand event of rptSupervisor.
B. Bind rptEmployees during the OnItemDataBound event of rptEmployees.
C. Set the rptEmployees DataSourceID attribute to "Employees".
D. Set the rptEmployees DataSource attribute to <%# Eval("Employees") %>


Answer Clike
Which interface should you implement on the control?

You are developing an ASP.NET templated server control.
You need to ensure that a new ID namespace is created within the page control hierarchy when the control is added to a page.
Which interface should you implement on the control?
A. IDataItemContainer
B. INamingContainer
C. IDataKeysControl
D. IExtenderControl


Answer Clike
Which control markup should you use?

You are implementing an ASP.NET page that includes a text box.
You need to validate values that are typed by users to ensure that only numeric values are submitted.
Which control markup should you use?
A. <asp:TextBox ID="txt1" runat="server" CausesValidation="true" ValidationGroup= "Numeric" />
B. <asp:TextBox ID="txt1" runat="server" EnableClientScript="true" ValidationGroup= "Numeric" />
C. <asp:TextBox ID="txt1" runat="server" />
<asp:RegularExpressionValidator ID="val1" runat="server" ControlToValidate="txt1" ValidationExpression="[0-9]*" ErrorMessage="Invalid input value" />
D. <asp:TextBox ID="txt1" runat="server" />
<asp:RegularExpressionValidator ID="val1" EnableClientScript="true" ControlToValidate="txt1" ValidationExpression="[0-9]*" ErrorMessage="Invalid input value" />


Answer Clike
Which two actions should you perform?

You are debugging an ASP.NET web page. The page includes the following method:
[WebMethod]
public string GetServerString()
{

}
The page also includes the following markup:
<asp:ScriptManager ID="sm1" runat="server" />
The following JavaScript code is used to call the GetServerString method:

The AJAX calls to the GetServerString method are failing.
You need to ensure that the AJAX call to the GetServerString method succeeds.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Set the EnablePageMethods property of the ScriptManager control to true.
B. Set the EnablePartialRendering property of the ScriptManager control to true.
C. Change the WebMethod attribute of the GetServerString method to WebMethod(EnableSession=true).
D. Declare the GetServerString method as static.


Answer Clike
Which event should you handle?

You are developing an ASP.NET web page. The page includes a DropDownList control.
You need to call a client-side function when the user changes the value of the control.
Which event should you handle?
A. Click
B. SelectedIndexChanged
C. Change
D. Select


Answer Clike
What should you do?

You are developing an ASP.NET AJAX extender control.
The extender includes the following segment.

You need to ensure that the extender can be user to extend only text boxes and that the targetID property can reference only buttons.
What should you do?
A. Apply the following attribute to the class.
[ValidationProperty("TextBox")]
Apply the fallowing attribute to TargetID
[Filterable(true)]
B. Apply the following attribute to the class.
[TargetControlType(typeof(TextBox))]
Apply the following attribute to TargetID
[Filterable(true)]
C. Apply the following attribute to the class.
[ValidationProperty("TextBox")]
Apply the following attribute to TargetID
[IDReferenceProperty(typeof(Button))]
D. Apply the following attribute to the class.
[TargetControlType(typeof(TextBox))]
Apply the following attribute to TargetID
[IDReferenceProperty(typeof(Button))]


Answer Clike
Which two actions should you perform?

You are adding new capabilities to an ASP.NET web site. The site currently connects to a Microsoft SQL Server database by using the credentials of the CONTOSOAppIdentity account, which has been granted access to only objects within the database.
The application requires the following implementation:
. Database objects that support ASP.NET roles must be added to the existing database.
. The ContosoAppIdentity user must be granted only the minimum privileges that are required to support all features of ASP.NET roles.
You need to add the ASP.NET roles support.
Which two actions should you perform? (Each correct answer presents part of the complete solution. Choose two.)
A. Use the aspnet_regsql tool.
B. Use the aspnet_regiis tool.
C. Add the CONTOSOAppIdentity user to the asp_Roles_FullAccess database role.
D. Add the CONTOSOAppIdentity user to the db_accessadmin database role.


Answer Clike
Which LINQ to Entities query should you use?

You are developing an ASP.NET web application.
The application includes the following Entity Data Model (EDM):

You instantiate an ObjectContext for the EDM named context.
You need to find the total number of addresses that are associated with customers that have a non-null middle name.
Which LINQ to Entities query should you use?
A. var query = context.Customers
.Where(c => c.MiddleName != null)
.Select(c => c.CustomerAddresses.Count();
B. var query = context.Customers
.Where(c => c.MiddleName != null)
.SelectMany(c => c.CustomerAddresses.Count();
C. var query = context.Addresses
.SelectMany(a => a.CustomerAddresses.OfType<Customer>()
.Where(c => c.MiddleName != null)).Count();
D. var query = context.Addresses
.GroupBy(a => a.CustomerAddresses
.Where(ca => ca.Customer.MiddleName != null)).Count();


Answer Clike
What should you do?

You are developing an ASP.NET web application that you will deploy to an Internet Information Services (IIS) 7.0 server.
The application will run in Integrated pipeline mode. The application contains a phot gallery of images that are stored in a Microsoft SQL Server database.
You need to ensure that the application can retrieve images from the database without blocking IIS worker process threads.
What should you do?
A. Create a synchronous HttpHandler that is registered in the <httpHandlers> section in the web.config file.
B. Create an asynchronous HttpHandler that is registered in the <handlers> section under system.webServer in the web.config file.
C. Create a custom HttpModule that is registered in the <httpModules> section in the web.config file.
D. Create an asynchronous HttpHandler that is registered in the <httpHandlers> section in the web.config file.


Answer Clike
What should you do?

You are developing an ASP.NET web page.
The page includes the following EntityDataSource control:
<asp:EntityDataSource ID="EntityDataSource1" runat="server"
ConnectionString="name=AdventureWorksEntities"
DefaultContainerName="AdventureWorksEntities" EnableFlattening="False"
EntitySetName="Products" />
The page must filter the data that is displayed in a grid on a query string parameter named ProductPrefix. The grid must display products whose ProductName starts with the query string value.
You need to ensure that the page generates the appropriate database query.
What should you do?
A. Add the following element to the EntityDataSource control:

B. Add the following element to the EntityDataSource control:

C. Add the following element to the EntityDataSource control:

D. Add the following element to the EntityDataSource control:



Answer Clike
Which code segment should you use?

You are developing an ASP.NET web page that includes a Panel Control that has ID ContentSection. You need to add a text box control to the Panel control.
Which code segment should you use?
A. this.ContentSection.Controls.Add(
this.FindControl(contentSection.ID + "asp:TextBox"));
B. this.LoadTemplate("asp:TextBox")
.InstantiateIN(ContentSection);
C. this.RequiresControlState(
this.LoadControl(typeof(TextBox),null));
D. this.ContentSection.Controls.Add(
this.LoadControl(typeof(TextBox),null));


Answer Clike
What should you do?

You are deloping an ASP.NET Dynamic Data Web application. The application uses entities from a global library named Entities. The Application_Start event contains the following code segment:

You need to ensure that the application shows the Order and Customer entities and hides all other entities.
What should you do?
A. Set the ScaffoldAllTables property of the ContextConfiguration to true.
B. Create a partial class for each entity except Order and Customer within the Entities library and apply the [ScaffoldTable(false)] attribute.
C. Create a partial class for the Order and Customer entities within the web application and apply the [ScaffoldTable(true)] attribute.
D. Create a partial class for the Order and Customer entities within the Entities library and apply the [ScaffoldTable(true)] attribute.


Answer Clike
Which markup should you use?

You are developing an ASP.NET MVC2 application.
You add an area named Admin to the application. Admin contains a controller class name to MainController.
You create a view named Index outside the Admin area. You need to add a link in the Index view that will call the Default action.
Which markup should you use?
A. <%= Html.ActionLink("Admin","Default", "Main", new {area="admin"},null )%>
B. <%= Html.RouteLink("Admin","Default", new {area="admin"},"Main" )%>
C. <%= Html.RenderAction("Admin","Default", new {area="admin"}); %>
D. <%= Html.Action("Admin","Default",new {area="admin"}) %>


Answer Clike
Which control should you use?

You are developing as ASP.NET Web application that will display a list of values.
The application must display the values in a tabular format in columns from top to bottom. You need to choose a control that can be bound directly to the list to render this display.
Which control should you use?
A. Datagrid
B. Datalist
C. GridView
D. DataPager


Answer Clike
What should you do?

You are developing an ASP.NET web application.
The application includes a class library named Contoso.dll that will be used by other ASP.Net applications on the same server.
You need to ensure that only one copy of the class library exists on the server.
What should you do?
A. Add the following code segment to the top of each web page.
<%@ Register TagPrefix="cc" NameSpace="contoso"
Assembly="contoso" %>
B. Install the class library into the Global Assembly Cache on the server.
C. Deploy the class library on the App_Code folder
D. Add the following assembly attribute to the Contoso class library’s AssemblyInfo.cs file.
[assembly: AssemblyConfiguration("Shared")]


Answer Clike
Which markup should you use?

You are developing an ASP.NET web page that includes a textbox control that has ID txtDate. You need to ensure that the user enters a valid date in the text box.
Which markup should you use?
A.

B. <asp:CompareValidator ID="valDate" runat="server"
Type="Date" ControlToCompare="txtDate"
Operator="DataTypeCheck"/>
C. <asp:CompareValidator ID="valDate" runat="server"
Type="Date" ControlToValidate="txtDate"
Operator="DataTypeCheck"/>
D. <asp:CompareValidator ID="valDate" runat="server"
Type="Date" ControlToValidate="txtDate"
Operator="Equal"/>


Answer Clike
Which code segment should you add?

You are developing an ASP.NET MVC 2 Web Application that displays daily blog posts.
Visitors access a blog post page by using a Web address to pass in the year, month, and day -for example, contoso.com/2010/07/20.
The application must register the appropriate route to use the Display action of the blog controller.
Only page visits with a four digit year, two-digit month and two-digit dat can be passed to the action.
You need to ensure that the route is registered correctly,
Which code segment should you add?
A.

B.

C.

D.



Answer Clike
What should you do?

You are developing an ASP.NET MVC 2 application.
You create a login user control named login.ascx.
You need to display Login.ascx in a view.
What should you do?
A. Use an HTML server-side include.
B. Use the HTML.Display method
C. Use the HTML.Partial method.
D. Use the @Import directive


Answer Clike
Which two controls should you add to the page?

You are developing an ASP.NET web page.
The page must display data from XML file named Inventory.xml. Inventory.xml contains data in the following format.

You need to display Vehicle elements that have the inStock attribute set to YES.
Which two controls should you add to the page? (Each control presents part of the solution.Choose two.)
A. <asp:GridView ID=”GridView1" runat="server"
AutoGenerateColumns="True"
DataSource="inventoryXMLDataSource">
….
</asp:GridView>
B. <asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="True"
DataSourceID="inventoryXMLDataSource">
….
</asp:GridView>
C. <asp:XMLDataSource ID="InventoryXMLDataSource"
runat="server" DataFile="Inventory.xml"
XPath="/Inventory/Car[@InStock=’Yes’]">
</asp:XMLDataSource>
D. <asp:XMLDataSource ID="InventoryXMLDataSource"
runat="server" DataFile="Inventory.xml"
XPath="/Inventory/Car/InStock=’Yes’">
<Data>Inventory.xml</Data>
</asp:XMLDataSource>


Answer Clike
What should you do?

You are creating an ASP.NET web page that contains several FileUpload controls.
The page will be posted to the server after one or more image files are selected for upload.
You need to ensure that all uploaded files are saved to the server within one call to a single event handler.
What should you do?
A. Read the HttpRequest.Files property and call the HttpPostedFile.SaveAs method for each file.
B. Read the HttpRequest.inputStream property and call the System.Io.File.WriteLines method or each file.
C. Read the HttpRequest.inputStream property and call the HttpResponse.WriteLine method for each file.
D. Read the HttpRequest.Files property and call the System.Io.File.WriteLines method for each file.


Answer Clike
Which code segment should you add at line 03?

You are developing an ASP.NET Web application.
The application includes a Icomparer<string> implementation named CaseInsensitiveComparer that compares strings without case sensitivity You add the following method.(Line numbers are included for reference only.)
01 public IEnumerable<string>SortWords(string[] words)
02 {
3
04 }
You need to sort the array by word length and then by alphabetic order, ignoring case.
Which code segment should you add at line 03?
A. return words.Orderby(a => a, new CaseInsensitiveComparer()).ThenBy(a =>a.Length);
B. return words.Orderby(a =>a.Length).Orderby(a => a,new CaseInSensitiveComparer());
C. return words.Orderby(a =>a.Length).ThenBy(a=> a, new CaseInSensitiveComparer());
D. return words.Orderby(a =>a.Length.toString(), new CaseInSensitiveComparer());


Answer Clike
Which two actions should you perform?

You are implementing an ASP.Net web page that includes a Treeview control.
You need to ensure that the TreeView control nodes are populated only when they are first expanded.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Set the PopulateNodesFromClient property of the TreeView control to true.
B. Add an event handler to the TreeNodeDataBound event that includes code to populate the node.
C. Set the PopulateOnDemand property of the TreeNode control to true.
D. Add an event handler to the TreeNodePopulate event than includes code to populate the node.


Answer Clike
Wich code segment should you use?

You are implementing an ASP.NET web application.The application defines the following classes. public class Person

The applicaction must generate XML from personList, wich is a collection of Person instances.The following XML is an example of the schema than the generated XML must use.
<Persons>
<Person Name="John Doe">
<Address Email="[email protected]"/>
<Address AlternativeEmail="[email protected]"/>
<Address MSNInstanceMessenger="[email protected]"/>
</Person>
…..
</Persons>
You need to generate the XML.
Wich code segment should you use?
A.

B.

C.

D.



Answer Clike
What should you do?

You are developing an ASP.Net MVC 2 view and controller.
The controller includes an action method that retrieves rows from a Product table in Microsoft SQL Server database. You need to cache the data that the action method returns.
What should you do?
A. Add the following <outputCacheSettings> section to the web.config file.
<system.web>
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="ProductView" duration="60"
varyByParam="*"/>
</outputCacheProfiles>
</outputCacheSettings>
</caching>
</system.web>
B. Add the following line of code to the controller.
Cache.insert("key", "ProductView", null, DateTime.Now.AddMinutes(60),TimeSpan.Zero);
C. Add the following attribute to the action method
[OutputCache(Duration=60)];
D. Add the following directive to the top of the view
<%@ OutPutCache Duration="60" VaryByParam="*" %>


Answer Clike
You’re developing an ASP web page.

You’re developing an ASP web page. the pages requires access to types that are defined in an assembly named Contoso.businessobjects.dll. You need to ensure that the page can access these types.
A. <%@ assembly ID= "Contoso.bussinessobjects" %>
B. <%@ assembly target name= "Contoso.bussinessobjects" %>
C. <%@ assembly name= "Contoso.bussinessobjects" %>
D. <%@ assenbly Virtual Path= "Contoso.bussinessobjects" %>


Answer Clike
You are developing an ASP.NET web page.

You are developing an ASP.NET web page. The page includes functionality to make a web request and to display the responde in a specified HTML element.
You need to add a client-side function to write the response to the specified HTML element.Which function should you add?
A. function loadData(url,element){
$(element).ajaxStart(function(){
$(this).text(url);
});
}
B. function loadData(url,element){
$(element).ajaxSend(function(){
$(this).text(url);
});
}
C. function loadData(url,element){
$.post(element,function(url){
$(element).text(url);
});
}
D. function loadData(url,element){
$.get(url,function(data){
$(element).text(data);
});
}


Answer Clike
What should you do?

You are developing an ASP.NET web application. Your designer creates a theme named General for general use in the application. The designer also makes page-specific changes to the default properties of certain controls.
You need to apply the General theme to all pages, and you must ensure that the page-specific customizations are preserved.
What should you do?
A. Add the following configuration to the web.config file.
<configuration>
<system.web>
<pages theme="General"/>
</system.web>
</configuration>
Set the following page directive on pages that have customizations.
<%@ Page EnableTheming="true" %>
B. Add the following configuration to the web.config file.
<configuration>
<system.web>
<pages styleSheetTheme="General"/>
</system.web>
</configuration>
C. Add the following configuration to the web.config file.
<configuration>
<system.web>
<pages theme="General"/>
</system.web>
</configuration>
Set the following page directive on pages that have customizations.
<%@ Page StyleSheetTheme="General" %>
D. Add the following configuration to the web.config file.
<configuration>
<system.web>
<pages theme="General"/>
</system.web>
</configuration>
Set the following page directive on pages that have customizations.
<%@ Page EnableTheming="false" %>


Answer Clike
What should you do?

You are developing an ASP.Net web application.
The application includes a master page named CustomerMaster.master that contains a public string property name EmployeeName application also includes a second master page named NestedMaster.master that is defined by the following directive.
<%@ Master Language="C#"
MasterPageFile="~/CustomMaster.Master"
CodeBehind="NestedMaster.Master.cs"
Inherits="MyApp.NestedMaster"%>
You add a content page that uses the NestedMaster.master page file.The content page contains a label control named lblEmployeeName. You need to acces the EmployeeName value and display the value within the lblEmployeeName label.
What should you do?
A. Add the following code segment to the code-behind file of the content page. public void Page_load(object s, EventArgs e)

B. Add the following directive to the content page.
<%@ MasterTypeVirtualPAth="~/CustomMaster.master" %>
Add the following code segment to the code-behind file of the content page. public void Page_load(object s, EventArgs e)

C. Add the following code segment to the code-behind file of the content page.

D. Add the following code segment to the code-behind file of the content page.



Answer Clike
Which page directive you use?

You are perfoming security testing on an existing asp.net web page.
You notice that you are able to issue unauthorised postback requests to the page. You need to prevent unauthorised post back requests. which page directive you use?
A. <[email protected] strict = "true" %>
B. <[email protected] enableViewStateMac = "true" %>
C. <[email protected] EnableEventValidation = "true" %>
D. <[email protected] Aspcompact = "true" %>


Answer Clike
Which code would you use to get a string property from custom.master?

You have a master page custom.master. You create a nested.master page using it.
You then have a content page that uses the nested.master as its master page.
Which code would you use to get a string property from custom.master?
A. master.master
B. parent.master
C. this.master
D. unknown


Answer Clike
Migration .net 3.5 to 4.0

Migration .net 3.5 to 4.0
You have migrated a web application from .net 3.5 to 4.0. the application hat to render same as in .net 3.5.
A. <assembles> someoptions </assembles>
B. <pages controlRenderingCompatibilityVersion="3.5"/>
C. <compilation targetframework = "3.5" />
D. <xhtmlConformance mode="Legacy" />


Answer Clike
Which configuration should you add to the web.config file?

You are developing an ASP.NET Web application.
The application is configured to use the membership and role providers.
You need to allow all users to perform an HTTP GET for application resources, but you must allow only the user named Moderator to perform a POST operation.
Which configuration should you add to the web.config file?
A. <authorization>
<deny verbs="GET" users="*"/>
<allow verbs="POST" users="Moderator"/>
<deny verbs="POST" users="*"/>
</authorization>
B. <authorization>
<deny verbs="POST" users="*"/>
<allow verbs="POST" users="Moderator"/>
<allow verbs="GET" users="*"/>
</authorization>
C. <authorization>
<allow verbs="GET" users="*"/>
<allow verbs="POST" users="Moderator"/>
<deny verbs="POST" users="*"/>
</authorization>
D. <authorization>
<allow verbs="GET" users="*"/>
<deny verbs="POST" users="Moderator"/>
<deny verbs="POST" users="*"/>
</authorization>


Answer Clike
What should you do?

You are developing an ASP.NET Web application.
The application must pass an object that contains user-specific data between multiple pages.
The object is more than 100 KB in size when serialized. You need to minimize the amount of data is sent to the user.
What should you do?
A. Pass the object data in a hidden field.
B. Store the object instance in a session variable.
C. Use a cookie that contains the object data.
D. Encode the object data and pass it in a query string parameter.


Answer Clike
Which two actions should you perform

Corrected : Question No: 149
You create an ASP.NET server control in the SampleControl namespace.
The control uses a JavaScript file names Refresh.js to implement AJAX functionality. You need to ensre that the JavaScript file is included in the assembly.
Which two actions should you perform (Choose 2)
A. Add the following assembly attribute to the AssemblyInfo file. [assembly: WebResource("SampleControl.Refresh.js", "application/x-javascript")]
B. Add the following assembly attribute to the AssemblyInfo file. [assembly:ScriptResource("SampleControl.Refresh.js")]
C. In the Properties window for the Refresh.js file, set the Build Action to Embedded Resource.
D. In the Properties window for the Refresh.js file, set the Build Action to Content.


Answer Clike
Which two actions should you perform

You are developing a WCF service.
The service includes an operation names GetProduct.
You need to ensure that GetProduct will accept a POST request and will indicate that the returned data is XML.
Which two actions should you perform (Choose 2)
A. Add the WebGet attribute to the service contract.
B. Set WebOperationContext.Current.OutgoingRequest.ContentType to "text/xml" in the GetProduct method.
C. Add the WebInvoke attribute to the service contract.
D. Set WebOperationContext.Current.OutgoingResponse.ContentType to "text/xml" in the GetProduct method.


Answer Clike
ASP.net MVC dotn display a column

ASP.net MVC dotn display a column
Using LINQ to SQL class
[MetadataType(typeof(ProductMetadata))]
public pertial class Product
{

}
public class ProductMetadata
{

}
A. Add the following attribute to Product class
[DisplayColumn("DiscontinueDate","DiscontinueDate",false)
B. Add the following attribute to ProductMetadata class
[DisplayColumn("DiscontinueDate","DiscontinueDate",false)
C. Add the following code segment Product class

D. ProductMetaData class
[ScaffoldColumn(false)]
public object DiscontinueDate;


Answer Clike
Which code segment should you use?

You are developing an ASP.NET MVC 2 Web Application.
You need to implement an asynchronous controller named AccountingController, and you must ensure that the export action required proper authorization.
Which code segment should you use?
A. public class AccountingController : Controller
{
public void ExportAsync() {…}
[Authorise]
public void ExportCompleted() {…}
}
B. public class AccountingController : AsyncController
{
[Authorise]
public void ExportAsync() {…}
public void ExportCompleted() {…}
}
C. public class AccountingController : AsyncController
{
[Authorise]
public void Export() {…}
}
D. public class AccountingController : Controller
{
[Authorise]
public void ExportAsync() {…} [Authorise]
public void ExportCompleted() {…}
}


Answer Clike
Which two code segments should you add?

You are developing an ASP.NET Web page that uses jQuery validation.
The user should enter a valid email address in a text box that has ID txtEmail. The page must display "E-Mail address required" when the user does not enter an address and "Invalid e-mail address" when the user enters an address that is not formatted properly.
You need to ensure that the appropriate error message is displayed when the text box does not contain a valid e-mail address. Which two code segments should you add? (Choose 2)
A. txtEmail:
{
messages:
{
required: "E-mail address required",
email: "Invalid e-mail address"
}
}
B.
messages:
{
txtEmail:
{
required: "E-mail address required",
email: "Invalid e-mail address"
}
}
C.
txtEmail:
{
rules:
{
required: true
email: true
}
}
D.
rules:
{
txtEmail:
{
required: true
email: true
}
}


Answer Clike
What should you do?

You are developing an ASP.NET MVC2 view and controller.
The application includes a class names Employee that has a LastName property. The controller requires an action method that will insert an Employee instance into a database.
You need to ensure that the data that is submitted is an Employee instance and that a LastName value is given. What should you do?
A. Add a ValidationMessage helper method immediately after the view’s last name TextBox. Define the action method as follows.
public ActionResult Create(FormCollection employeeToCreate)
{…}
B. Add the Required attribute to the LastName property. Define the action method as follows.
public ActionResult Create(FormCollection employeeToCreate)
{…}
C. Add the Required attribute to the LastName property. Define the action method as follows.
public ActionResult Create(Employee employeeToCreate)
{…}
D. Add the ValidationMessage helper method immediately after the views last name TextBox. Define the action method as follows.
public ActionResult Create(Employee employeeToCreate)
{…}


Answer Clike
What do you do?

You create a Windows Communication Foundation (WCF) service and deploy it with wsHttpBinding and message security enabled. You create an intermediate WCF service for logging messages sent to the primary service. The intermediate service is called via endpoint behaviour. The primary service is receiving malformed data from a client application. You need to enable inspection of the malformed data and prevent message tampering. What do you do?
A. Specify a protection level of None in the contract for the intermediate service. Disable message and transport security from the client application configuration file.
B. Specify a protection level of Sign in the contract for the intermediate service. Disable transport security from the client application configuration file.
C. Modify the binding on the intermediate service to use netNamedPipeBinding
D. Modify the binding on the intermediate service to use webHttpBinding


Answer Clike
What should you do?

You need to ensure that when the button is clicked, both update panels update the tim without generating a postback.
What should you do?
A. Add the following marktip to UpdatePanel1.
<Triggers>
<asp:PostBackTrigger ControlID="btnSave" />
</Triggers>
B. Set the UpdateMode property for the UpdatePanel2 to "Always"
C. Add the following markup to UpdatePanel2
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
</Triggers>
D. Set the UpdateMode property for UpdatePanel2 to "Conditional"


Answer Clike
You have a C# code snippet with 2 classes, one composed by elements of the other.

You have a C# code snippet with 2 classes, one composed by elements of the other.
Something like

And a markup code snippet, with 2 repeaters imbricated + a ObjectDataSource retrieving a list of Supervisors, the top level repeater "rptSupervisors" is bound using ObjectDataSourceID to the ObjectDataSource, and the inside one "rptStudents" is not bound yet.
We understand that we need a list of supervisors and sublists of their relative students.
A. bind rptStudents with the list of current item in SupervisorsList using the ItemDataBound event of the rptStudents repeater
B. bind rptStudents with the list of current item in SupervisorsList using the ItemCommand event of the rptSupervisor repeater
C. databinding directly the rptStudents in the page load or something dummy like that (don’t remember exactly)
D. another dummy solution involving a "supervisors have all the same students" situation


Answer Clike
Wich @ Page directive should you use?

You are implementing an ASP.NET Web page
The page includes several controls, but only a GridView requires view state. You set the GridView…
You need to ensure that the page will omit unneeded view state.
Wich @ Page directive should you use?
A. <% Page EnableViewState="true" ViewStateMode="Enabled" _ %>
B. <% Page EnableViewState="true" ViewStateMode="Disabled" _ %>
C. <% Page EnableViewState="false" ViewStateMode="Disabled" _ %>
D. <% Page EnableViewState="false" ViewStateMode="Enabled" _ %>


Answer Clike
What should you do?

You are debugging an ASP.NET Web application by using the Visual Studio debugger. The application is incorrectly handling a SQL Exception on the login page.
You need to break execution where the exception is thrown . What should you do?
A. Enable the User-unhandled option for SqlException in Visual Studio Exception configuration.
B. Set the value of the customErrors element’s mode attribute to "on" in the web.config file.
C. Manually attach the Visual Studio debugger to Internet Explorer
D. Enable the thrown option for SqlException in Visual Studio exception configuration.


Answer Clike
What should you do?

You develop an ASP.NET Web page that includes multiple WebPartZone controls, an EditorZone. Users report that they cannot customize the layout of the page by moving WebParts from one.
You need to ensure that users can successfully move Web Parts from one zone to another.
What should you do?
A. Configure the Web site to enable session state.
B. Configure the Web site to require authentication and to use personalization.
C. Add a ProxyWebPartManager control to the page.
D. Add a AppearanceEditorPart control to the page.


Answer Clike
When if first moves the mouse over the element

mouseenter jQuery
In a page there is a div (I guess it was a div) and you need to execute a javascript function when if first moves the mouse over the element
<div id="div1"></div>
A. $("#div1").mouseenter(displayname);
B. $(".div1").mouseenter(displayname);
C. $("#div1").mousemove(displayname);
D. $(".div1").mousemove(displayname);


Answer Clike
JQuery CheckBoxes

jQuery CheckBoxes
In a web page with chechboxes you need to write e jquery that retruns the number checked checkboxes
A. var n = $("input:checked").length;
B. var n = $(":input, :checked").length;
C. var n = $("input:selected").length;
D. var n = $(":input, :selected").length;


Answer Clike
Which state management technique to use:

State management
You have to store user data of 200 KB in an object. Which state management technique to use:
A. Server session
B. Cookie
C. ViewState
D. Hidden Field


Answer Clike
Which subfolder within the Views folder should you add the view?

You are developing an ASP.NET MVC 2 application.
You create a view that will be returned by action methods in multiple controllers. You need to place the view in the appropriate folder.
To which subfolder within the Views folder should you add the view?
A. Master
B. Default
C. Shared
D. Common


Answer Clike
Which of the following deployment methods will you select to accomplish this?

You work as an ASP.NET Web Application Developer for SomeCompany.
The company uses Visual Studio .NET 2010 as its application development platform.
You have recently finished the development of an ASP.NET Web application using .NET Framework 4.0.
Now, you are deploying the ASP.NET Web application to a remote server.
You are required to select a deployment method that will make sure that all Internet Information Services (IIS) settings, in addition to the Web content, are deployed to the remote server.
Which of the following deployment methods will you select to accomplish this?
A. Web Setup project
B. Web-based deployment
C. Deployment manifest
D. Web Deployment Tool


Answer Clike
Which class is used to specify a set of features to support on the XmlReader object created by the Create method?

Which class is used to specify a set of features to support on the XmlReader object created by the Create method?
A. XmlReaderSettings
B. XmlSecureResolver
C. XmlValidatingReader
D. XmlTextReaderSelectMany(c => c.CustomerAddresses).Count()


Answer Clike
You work as an ASP.NET Web Application Developer for SomeCompany.

You work as an ASP.NET Web Application Developer for SomeCompany.
The company uses Visual Studio .NET 2010 as its application development platform. You create an ASP.NET Web application using .NET Framework 4.0.
The application has an ASP.NET page.
The page contains a method named GetCustomerOrderData that returns a DataSet.
GetCustomerOrderData contains two DataTable objects named CustomerDetails and OrderDetails, respectively. You are required to display the data in OrderDetails in a DetailsView named ViewDetail.
Choose the appropriate steps in the correct order to accomplish this.
Build List and Reorder:



Answer Clike
What order do events in the master pages and content pages occur?

You have an ASP.NET web application that uses master pages and content pages. You must initialize and close multiple resources from different events.
In what order do events in the master pages and content pages occur?
Build List and Reorder:



Answer Clike
What is the order of precedence that defines how ASP.NET applies themes?

You are developing an ASP.NET website that uses multiple layers of themes.
You want to ensure that attributes will be correctly applied to controls when multiple themes specify the same control attribute. What is the order of precedence that defines how ASP.NET applies themes?
Build List and Reorder:



Answer Clike
What will you do to accomplish this?

You work as an ASP.NET Web Application Developer for SomeCompany.
The company uses Visual Studio .NET 2010 as its application development platform.
You create an ASP.NET Web application using .NET Framework 4.0.
The ASP.NET application is used to track employee performance.
It uses Microsoft Windows authentication.
Employees are members of a group named Employees.
Managers are members of a group named Managers.
The root folder of the application is named Details.
The Details folder displays information about employees’ performance.
The Details folder has a subfolder named MoreDetails.
You need to ensure that employees and managers can access pages stored in the Details folder.
However, only managers can access pages stored in the MoreDetails folder.

You make the following entries in the Web.config file in the MoreDetails folder. (Line numbers are given for reference only.)

When managers try to access pages stored in the MoreDetails folder, they receive the following error message:
"An error occurred during the processing of a configuration file required to service this request."
You must ensure that managers are able to access pages stored in the MoreDetails folder. What will you do to accomplish this?
A. Add the following directive between line 1 and line 2 in the Web.config file in the MoreDetails folder:
<identity impersonate="false" />
B. Modify line 4 in the Web.config file in the MoreDetails folder as follows:
<allow users="*" />
C. Add the following directive between line 1 and line 2 in the Web.config file in the MoreDetails folder:
<identity impersonate="true" />
D. Replace line 1 in the Web.config file in the MoreDetails folder with
<authentication mode="Windows" />
E. Add the following directive between line 1 and line 2 in the Web.config file in the Details folder:
<identity impersonate="true" />


Answer Clike
Which event of the GridView class occurs when the Edit button of a row is clicked, but before the GridView control enters edit mode?

Which event of the GridView class occurs when the Edit button of a row is clicked, but before the GridView control enters edit mode?
A. RowEntered
B. RowEdited
C. RowEntering
D. RowEditing


Answer Clike
What will you do?

You work as an ASP.NET Web Application Developer for SomeCompany.
The company uses Visual Studio .NET 2010 as its application development platform. You create an ASP.NET Web application using .NET Framework 4.0.
You create a Web page in the application.
The Web page will get large sets of data from a data source. You add a DataPager control to the page.
You are required to display navigation controls that enable you to create a custom paging Ul for the DataPager control. What will you do?
A. Use NextPreviousPagerField.
B. Use NumericPagerField.
C. Use PreviousPagerField.
D. Use NextPagerField.
E. Use TemplatePagerField.


Answer Clike
What will you do to accomplish this?

You work as an ASP.NET Web Application Developer for SomeCompany.
The company uses Visual Studio .NET 2010 as its application development platform. You are creating an ASP.NET Web application using .NET Framework 4.0.
The Web application comprises a class named Employee with properties named as First Name, Last Name, and Age. You add a Web page in which you get a list of Employee objects and display those objects in a GridView control.
You are required to add code so that the GridView row is highlighted in red color if the age of the employee is less than 21 years. What will you do to accomplish this?
A. Use the RowCommand event of the GridView control.
B. Use the SelectedlndexChanged event of the GridView control.
C. Use the RowDataBound event of the GridView control.
D. Use the RowEditing event of the GridView control.
E. Use the RowUpdated event of the GridView control.


Answer Clike
Which tool is used to simplify the migration, management and deployment of IIS Web servers, Web applications and Web sites?

Which tool is used to simplify the migration, management and deployment of IIS Web servers, Web applications and Web sites?
A. System Designer
B. XCOPY deployment
C. Deployment Designer
D. Web Deployment


Answer Clike
Which of the following code segments will you use?

You work as an ASP.NET Web Application Developer for SomeCompany.
The company uses Visual Studio .NET 2010 as its application development platform.
You create an ASP.NET Web application using .NET Framework 4.0.
The Web application connects to a SQL Server database.
You use the ADO.NET Entity Framework to handle persistence-ignorant entities.
You create an ObjectContext object named ObjContext.
Subsequently, you change properties on numerous entities.
You are required to save the changed entity values in the SQL Server database.
Which of the following code segments will you use?
A. ObjContext.SaveChanges(SaveOptions.DetectChangesBeforeSave);
B. ObjContext.SaveChanges(SaveOptions.AcceptAllChangesAfterSave);
C. ObjContext.SaveChanges(SaveOptions.All);
D. ObjContext.SaveChanges(SaveOptions.None);


Answer Clike
Which of the following is the correct collection of build events?

Which of the following is the correct collection of build events?
A. Pre-Build, Post-Link, and Pre-Link
B. Pre-Build, Post-Build, and Post-Link
C. Pre-Build, Pre-Link, and Post-Build
D. Post-Link, Pre-Link, and Post-Build


Answer Clike
Which utility allows you to pre-compile and publish your Web site to a new location?

Which utility allows you to pre-compile and publish your Web site to a new location?
A. Publish Web Site
B. Web-based installation
C. Web site project mode
D. Web services directory


Answer Clike
Which method of the ChildActionExtensions class calls a child action method and renders the result inline in the parent view?

Which method of the ChildActionExtensions class calls a child action method and renders the result inline in the parent view?
A. RenderPartial
B. Action
C. Render
D. RenderAction


Answer Clike
Which class defines the contract that ASP.NET implements to provide membership services using custom membership providers?

Which class defines the contract that ASP.NET implements to provide membership services using custom membership providers?
A. FormsAuthentication
B. RoleProvider
C. SqlRoleProvider
D. MembershipProvider


Answer Clike
Which control allows you to bind to data items that are returned from a data source and display them?

Which control allows you to bind to data items that are returned from a data source and display them?
A. ListView Web Server Control
B. DetailsView Web Server Control
C. DataList Web Server Control
D. Data Web Server Control


Answer Clike
What will you do to accomplish this?

You work as an ASP.NET Web Application Developer for SomeCompany.
The company uses Visual Studio .NET 2010 as its application development platform.
You create an ASP.NET Web site using .NET Framework 4.0.
Only registered users of the company will be able to use the application.
The application holds a page named UserAccount.aspx that enables new users to register them to the registered users’ list of the company.
The UserAccount page hold numerous TextBox controls that accept users personal details, such as user name, password, home address, zipcode, phone number, etc.
One of the TextBox controls on the page is named ZipCode in which a user enters a zip code.
You must ensure that when a user submits the UserAccount page, ZipCode must contain five numeric digits. What will you do to accomplish this?
(Each correct answer represents a part of the solution. Choose two.)
A. Use RangeValidator.
B. Use RegularExpressionValidator
C. Use RequiredValidator
D. Use CompareValidator
E. Use RequiredFieldValidator


Answer Clike
What will you do to accomplish this?

You work as an ASP.NET Web Application Developer for SomeCompany.
The company uses Visual Studio .NET 2010 as its application development platform.
You are creating an ASP.NET Web application using .NET Framework 4.0.
The application holds a Web page named MyHome.aspx.
You are creating a button with a rolloverimage on MyHome.aspx.
However, when mouse hovered over the button image, the rolloverimage is retrieved from the server in a separate request.
You need to use an improved rollover button in which the button’s rolloverimage is already downloaded and stored in the browser’s cache, as a result when you hover over the button, it is instantly displayed.
What will you do to accomplish this?
(Each correct answer represents a part of the solution. Choose two.)
A. Use JavaScript Object Notation.
B. Use the RegisterClientScriptBlock method.
C. Use the RegisterClientScriptlnclude method.
D. Build a JavaScript function.
E. Use the RegisterClientScriptResource method.


Answer Clike
What will you do?

You work as an ASP.NET Web Application Developer for SomeCompany.
The company uses Visual Studio .NET 2010 as its application development platform. You create an ASP.NET Web application using .NET Framework 4.0.
You are planning to deploy the ASP.NET Web application to a production server by publishing the Web application in Release configuration. You must ensure that the connection string value in the Web.config file is updated to the connection string value of the production server during publishing.
What will you do?
A. Add the following code to the Web.config file.

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

C. Add the following code to the Web.config file :

D. Add the following code to the Web.release.config file.



Answer Clike
Which property of the Label control getssets the identifer for a server control that the Label control is associated with?

Which property of the Label control getssets the identifer for a server control that the Label control is associated with?
A. ClientID
B. ID
C. AssociatedControlID
D. ControlID


Answer Clike
Which property of the ListView class is used to getset the name of the data field whose value exclusively identifes every data row of a ListView when the ClientIDMode property is set to Predictable?

Which property of the ListView class is used to getset the name of the data field whose value exclusively identifes every data row of a ListView when the ClientIDMode property is set to Predictable?
A. LoadViewStateByID
B. UniqueID
C. ClientIDMode
D. ClientIDRowSuffix


Answer Clike
Which class provides paging functionality for data-bound controls that implement the IPageableItemContainer interface?

Which class provides paging functionality for data-bound controls that implement the IPageableItemContainer interface?
A. DataPagingField
B. DataPagerCollection
C. DataPager
D. DataPaging


Answer Clike
Which method of the Page class searches the page naming container for a server control with a particular identifer?

Which method of the Page class searches the page naming container for a server control with a particular identifer?
A. FindFieldTemplate
B. FindControl
C. FindDataSourceControl
D. FindDataControl


Answer Clike
Which directive defines master page-precise attributes that are used by the ASP.NET page parser and compiler?

Which directive defines master page-precise attributes that are used by the ASP.NET page parser and compiler?
A. @ MasterType
B. @ Master
C. @ PageType
D. @ MasterPage


Answer Clike
Which of the following is the correct syntax to specify the path to a file that generates the strong type?

Which of the following is the correct syntax to specify the path to a file that generates the strong type?
A. <%@ PreviousPageType VirtualPath ="~/MyPage.aspx"% >
B. <%@ PreviousPageType VirtualPath ="/MyPage.aspx/ ~"% >
C. <%@ PreviousPageType VirtualPath ="~/MyPage.master"% >
D. <%@ PreviousPageType VirtualPath ="~/MyPage"% >


Answer Clike
Which of the following code segments will you use?

You work as an ASP.NET Web Application Developer for SomeCompany.
The company uses Visual Studio .NET 2010 as its application development platform.
You create an ASP.NET MVC 2 Web application using .NET Framework 4.0.
You implement a single project area in the MVC 2 Web application.
In the Areas folder, you add a subfolder named MyTest.
You add the following files to the appropriate sub-folders:
. MyController.cs
. MyHome.aspx
You register a route of the area, setting the route name to MyTest_default and the area name to test. You create a view named MyViews.aspx that is outside the test area.
You need to add a link to MyViews.aspx that points to MyHome.aspx. Which of the following code segments will you use?
A. <%= Html.ActionLink("MyTest", "MyHome", new {area = "test"}, null)%>
B. <%= Html.RouteLink("MyHome", "MyTest", new {area = "test"}, null)%>
C. <%= Html.RouteLink("MyTest", "MyHome", "MyTest", new {area = "test"}, null)%>
D. <%= Html.ActionLink("MyTest", "MyHome", "MyTest", new {area = "test"}, null)%>


Answer Clike
Which control markup will you use?

You work as an ASP.NET Web Application Developer for SomeCompany.
The company uses Visual Studio .NET 2010 as its application development platform.
You are creating an ASP.NET Web application using .NET Framework 4.0.
The Web application will be accessed by international audience.
The Web application holds global and local resources for display elements that must be translated into the language that is preferred by the user. You are required to ensure that a Label control named CompanyLabel displays text in the user’s preferred language from the global resource file. Which control markup will you use?
A. <asp:Label lD="CompanyLabel" runat="server" Text="<%$ Resources:WebResources, Text %>" />
B. <asp:Label lD="CompanyLabel" runat="server" Text="<% Resources:WebResources %>" />
C. <asp:Label lD="CompanyLabel" runat="server" Text="<%$ Resources:WebResources, CompanyLabelText %>" />
D. <asp:Label lD="CompanyLabel" runat="server" Text="CompanyLabel" meta:resourcekey="CompanyLabel.Text" />


Answer Clike
What will you do?

You work as an ASP.NET Web Application Developer for SomeCompany.
The company uses Visual Studio .NET 2010 as its application development platform.
You are creating an ASP.NET Web application using .NET Framework 4.0.
The Web application makes use of SqlMembershipProvider.
You need to test the application locally and then deploy it to numerous production servers.
You must ensure that each and every deployed application accesses the identical production database in a Microsoft SQL Server. What will you do?
(Each correct answer represents a part of the solution. Choose two.)
A. Execute the Aspnet_regsql.exe tool to create the database on the correct Microsoft SQL Server.
B. Run the Aspnet_compiler.exe tool to create the database on the correct Microsoft SQL Server.
C. Alter the Web.Release.config file to transform the connection string to provide the names of the database and production server.
D. Alter the Web.Debug.config file to transform the connection string to provide the names of the database and production server.
E. Alter the connection string in the Web.config file to provide the names of the production server.


Answer Clike
What will you do to accomplish these tasks?

You work as an ASP.NET Web Application Developer for SomeCompany.
The company uses Visual Studio .NET 2010 as its application development platform.
You are creating an ASP.NET Web application using .NET Framework 4.0.
The application will provide information about products manufactured by the company.
The company has a branch office in Saudi Arabia.
The Sales department employees of the branch office in Saudi Arabia will use the application.
You are required to accomplish the following tasks:
. The application displays contents in the correct format for the employees of the Saudi Arabia office.
. Each page in the application is displayed in the right-to-left format.
What will you do to accomplish these tasks?
(Each correct answer represents a part of the solution. Choose two.)
A. In the Web.config file of the Web application, set the culture attribute of the <globalization> element to "ar-SA".
B. In the Web.config file of the Web application, set the uiCulture attribute to "ar-SA".
C. In the Web.config file of the Web application, set the culture attribute to "SA".
D. In the Web.config file of the Web application, set the culture attribute of the <globalization> element to "ar".
E. Set the HTML dir attribute for the <body> element of each page to "rtl".


Answer Clike
What should you do?

You are developing an ASP.NET Web page that contains input controls, validation controls, and a button named btnSubmit. The page has the following code-behind. (Line numbers are included for reference only.)

You need to ensure that all data that is submitted passes validation before the data is saved in a database. What should you do?
A. Add the following method override.

B. Add the following method override.

C. Add the following method override.

D. Add the following code segment at line 10.
if (Page.IsValid) this.SaveToDatabase();


Answer Clike
What should you do?

You are developing an ASP.NET Web application.
Application data is stored in a Microsoft SQL Server 2008 database.
You configure a connection string named cnnContoso.
The application must cache the data that is returned from the database by using this connection string.
You need to ensure that the application checks the database every 10 seconds.
What should you do?
A. Add the following configuration to the <system.web> section of the web.config file.

B. Add the following configuration to the <system.web> section of the web.config file.

C. Add the following @ Page directive to pages that query the database.
<%@ OutputCache Duration="10" VaryByParam="cnnContoso" %>
D. Add the following @ Page directive to pages that query the database.
<%@ OutputCache Duration="10000" VaryByParam="cnnContoso" %>


Answer Clike
Which type should you return from the action method?

You are developing an ASP.NET MVC 2 Web application.
A page makes an AJAX request and expects a list of company names in the following format.
["Adventure Works","Contoso"]
You need to write an action method that returns the response in the correct format. Which type should you return from the action method?
A. AjaxHelper
B. XDocument
C. JsonResult
D. DataContractJsonSerializer


Answer Clike
Which method of the FieldTemplateUserControl class should you override in the BooleanField class?

You are developing an ASP.NET Dynamic Data Web application.
Boolean fields must display as Yes or No instead of as a check box.
You replace the markup in the default Boolean field template with the following markup.
<asp:Label runat="server" ID="label" />
You need to implement the code that displays Yes or No.
Which method of the FieldTemplateUserControl class should you override in the BooleanField class?
A. OnLoad
B. Construct
C. OnDataBinding
D. SaveControlState


Answer Clike
Which two actions should you perform?

You are developing an ASP.NET Web service.
The following code segment implements the service. (Line numbers are included for reference only.)

You need to ensure that both GetProduct methods can be called from a Web client.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Remove line 01.
B. Add the static modifier on lines 05 and 11.
C. Add the following attribute before line 10.
[SoapDocumentMethod(Action="GetProductById")]
D. Modify the attribute on line 10 as follows.
[WebMethod(MessageName="GetProductById")]


Answer Clike
Which configuration should you add to the web.config file?

You are implementing an ASP.NET Web site that uses a custom server control named Task. Task is defined as shown in the following list.
Class name: Task
Namespace: DevControls
Assembly: TestServerControl.dll
Base class: System.Web.UI.WebControls.WebControl
You copy TestServerControl.dll to the Web site’s Bin folder.
You need to allow the Task control to be declaratively used on site pages that do not contain an explicit @ Register directive. Which configuration should you add to the web.config file?
A.

B.

C.

D.



Answer Clike
Which attribute should you add to the OutputCache directive?

You are developing an ASP.NET web application.
The application will contain a page that is customized for various browsers. The application will use output caching to optimize performance. You need to ensure that the page is cached by browser type and major version only.
Which attribute should you add to the OutputCache directive?
A. VaryByCustom="browser"
B. VaryByCustom="User-Agent"
C. VaryByHeader="browser"
D. VaryByHeader="User-Agent"


Answer Clike
Which two actions should you perform?

You are developing an ASP.NET web page named WebPage.aspx. The page includes a user control named UserInfoControl.ascx.
You need to expose a control property named FirstName and read its value from the page.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Add the following code segment to UserInfoControl.ascx.cs:
protected string FirstName { get; set; }
B. Add the following code segment to UserInfoControl.ascx.cs:
public string FirstName { get; set; }
C. Add the following code segment to WebPage.aspx.cs:
var firstName = UserInfoControl1.Attributes["FirstName"];
D. Add the following code segment to WebPage.aspx.cs:
var firstName = UserInfoControl1.FirstName;


Answer Clike
Which code segment should you add at line 06?

You are developing an ASP.NET Web page. The page contains the following markup.

The pages code-behind file includes the following code segment. (Line numbers are included for reference only.)

You need to get a reference to the Image named img. Which code segment should you add at line 06?
A. Image img = (Image)Page.FindControl("img");
B. Image img = (Image)e.Row.FindControl("img");
C. Image img = (Image)gvModels.FindControl("img");
D. Image img = (Image)Page.Form.FindControl("img");


Answer Clike
Which two actions should you perform?

You are developing an ASP.NET web page that includes a text box control. The page includes a server-side method named ValidateValue.
You need to configure the page so that the text box value is validated by using the ValidateValue method.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Use the CompareValidator control.
B. Use the CustomValidator control.
C. Set ValidationGroup on the control to ValidateValue.
D. Set OnServerValidate on the control to ValidateValue.


Answer Clike
What should you set the ClientIDMode property of the DropDownList to?

You are developing an ASP.NET Web page.
You add a data-bound GridView control.
The GridView contains a TemplateField that includes a DropDownList.
You set the GridViews ClientIDMode property to Static, and you set the ClientIDRowSuffix property to ProductID.
You need to be able to reference individual DropDownList controls from client-side script by using the ProductID. What should you set the ClientIDMode property of the DropDownList to?
A. AutoID
B. Static
C. Inherit
D. Predictable


Answer Clike
How to change the image of an image control place in each row in a gridview:

Gridview: How to change the image of an image control place in each row in a gridview:
A. ItemDataBound
B. Init
C. Prerender
D. Render


Answer Clike
Which FormView property should you set in the code-behind file?

You are developing an ASP.NET Web page.
The page includes a List<Product> instance.
You add a FormView control to display a single Product from this list.
You need to bind the list to the FormView control.
Which FormView property should you set in the code-behind file?
A. DataSource
B. DataSourceID
C. DataKeyNames
D. DataMember


Answer Clike
Which ActionLink should you use?

You are developing an ASP.NET MVC 2 Web application.
The application contains a controller named HomeController, which has an action named Index.
The application also contains a separate area named Blog.
A view within the Blog area must contain an ActionLink that will link to the Index action of the HomeController.
You need to ensure that the ActionLink in the Blog area links to the Index action of the HomeController.
Which ActionLink should you use?
A. Html.ActionLink("Home", "Index", "Home")
B. Html.ActionLink("Home", "Index", "Home", new {area = ""}, null)
C. Html.ActionLink("Home", "Index", "Home", new {area = "Blog"}, null)
D. Html.ActionLink("Home", "Index", "Home", new {area = "Home"}, null)


Answer Clike
Which code segment should you use?

You are developing an ASP.NET MVC 2 application.
A view contains a form that allows users to submit their first name.
You need to display the value that is submitted, and you must ensure that your code avoids cross-site scripting. Which code segment should you use?
A. <%: Model.FirstName %>
B. <%= Model.FirstName %>
C. <% Response.Write(Model.FirstName) %>
D. <% Response.Write(HttpUtility.HtmlDecode(Model.FirstName)) %>


Answer Clike
Which interface should you add the extension method to?

You are developing an ASP.NET Web page that will display the median value from a sequence of integer values. You need to create an extension method to compute the median value.
Which interface should you add the extension method to?
A. IComparer<T>
B. IEnumerable<T>
C. IEnumerator<T>
D. IEqualityComparer<T>


Answer Clike
What should you do?

You are creating an ASP.NET Web application.
The application must call a WCF service by using a WCF routing service.
You need to ensure that the application can invoke the target service by using the router endpoint. What should you do?
A. Add a service reference to the router service. In the client binding configuration, specify the address of the router service.
B. Add a service reference to the target service. In the client binding configuration, specify the address of the target service.
C. Add a service reference to the router service. In the client binding configuration, specify the address of the target service.
D. Add a service reference to the target service. In the client binding configuration, specify the address of the router service.


Answer Clike
What are two possible ways to achieve this goal?

You create a page in an ASP.NET Web application.
The page retrieves and displays data from a Microsoft SQL Server database.
You need to create a data source that can connect to the database.
What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)
A. Use an ObjectDataSource control and set its TypeName property to System.Data.SqlClient.SqlConnection.
B. Use a SqlDataSource control and configure its ConnectionString in the web.config file.
C. Use an XmlDataSource control together with an Xml control that represents the database.
D. Use a LinqDataSource control with entity classes that represent the elements in the database.


Answer Clike
Which control should you add?

You are developing an ASP.NET Web application. You create a master page.
The master page requires a region where you can add page-specific content by using the ASP.NET page designer.
You need to add a control to the master page to define the region.
Which control should you add?
A. PlaceHolder
B. ContentPlaceHolder
C. Content
D. Substituition


Answer Clike
Which two actions should you perform?

You are developing an ASP.NET Web page. You add the following markup to the page.
<asp:FileUpload id="FileUpload1" runat="server" />
<asp:Button id="btnUpload" Text="Upload selected file" OnClick="btnUpload_Click" runat="server" />
<asp:Label id="lblFeedback" runat="server" />
You add the following code segment to the code-behind. (Line numbers are included for reference only.)

You need to save the uploaded file and display a message to the user that indicates that the upload either succeeded or failed. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Replace line 3 with the following code segment.
if (FileUpload1.HasFile)
B. Replace line 3 with the following code segment.
if (FileUpload1.FileContent.Length > 0)
C. Insert the following code segment at line 6.
FileUpload1.SaveAs(saveName);
D. Insert the following code segment at line 6.
FileUpload1.FileContent.CopyTo(new FileStream(saveName, FileMode.Open);


Answer Clike
Which GridView event should you handle?

You are implementing an ASP.NET application.
The application includes a Person class with property Age.
You add a page in which you get a list of Person objects and display the objects in a GridView control.
You need to add code so that the GridView row is highlighted in red if the age of the person is less than 18. Which GridView event should you handle?
A. RowDataBound
B. RowCommand
C. RowUpdated
D. RowEditing


Answer Clike
What should you do?

You are implementing an ASP.NET page that will retrieve large sets of data from a data source. You add a ListView control and a DataPager control to the page.
You need to ensure that the data can be viewed one page at a time. What should you do?
A. Set the DataPager control’s PageSize property to the number of rows to view at one time.
B. Set the DataPager control’s PagedControlID property to the ID of the ListView control.
C. In the codebehind file, set the DataPager control’s Parent property to the ListView control.
D. In the codebehind file, set the ListView control’s Parent property to the DataPager control.


Answer Clike
Which deployment method should you choose?

You are deploying an ASP.NET Web application to a remote server.
You need to choose a deployment method that will ensure that all IIS settings, in addition to the Web content, will deploy to the remote server. Which deployment method should you choose?
A. the XCOPY command-line tool
B. the Copy Web Site tool
C. the Web Deployment tool
D. the Publish Web Site utility


Answer Clike
What should you do?

You are preparing to deploy an ASP.NET application to a production server by publishing the application in Release configuration.
You need to ensure that the connection string value that is stored in the web.config file is updated to the production server’s connection string value during publishing.
What should you do?
A. Add the following code to the web.config file.

B. Add the following code to the web.config file.

C. Add the following code to the web.release.config file.

D. Add the following code to the web.release.config file.



Answer Clike
Which two actions should you perform?

You are developing an ASP.NET application by using Visual Studio 2010.
You need to interactively debug the entire application.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Set the Debug attribute of the compilation node of the web.config file to true.
B. Add a DebuggerDisplay attribute to the code-behind file of the page that you want to debug.
C. Select the ASP.NET debugger option in the project properties.
D. Define the DEBUG constant in the project settings.


Answer Clike
What should you do?

You use the ASP.NET Web Application template to create an application in a new Visual Studio solution.
The project uses types that are defined in a class library project.
Source code for the class library is frequently modified.
You need to ensure that classes in the Web application project always reference the most recent version of the class library types. What should you do?
A. Add the class library project to the solution. Modify the class library project to add a reference to the Web application project.
B. Add the class library project to the solution. Modify the Web application project to add a reference to the class library project.
C. Add a post-build step to the Web application project that copies the most recent version of the class library assembly to the bin folder of the Web application.
D. Add a post-build step to the class library project that copies the most recent version of the class library assembly to the App_Code folder of the Web application. In the <compilation /> section of the web.config file,
add an <assembly /> entry that specifies the location of the class library assembly.


Answer Clike
Which code segment should you use?

You create a Web page that contains the span shown in the following line of code.
<span id="span1">Text</span>
You need replace the contents of the span with HTML that you download from a URL specified by a global variable named localURL.
Which code segment should you use?
A.

B.

C.

D.



Answer Clike
Which code segment should you use?

A Web service returns a list of system users in the following format.

You need to populate a drop-down menu with the IDs and names of the users from the Web service, in the order provided by the service. Which code segment should you use?
A.

B.

C.

D.



Answer Clike
Which configuration should you use?

You are creating an ASP.NET Web site.
The site contains pages that are available to anonymous users.
The site also contains a page named Premium.aspx that provides premium content to only members of a group named Subscribers.
You need to modify the web.config file to ensure that Premium.aspx can be accessed by only members of the Subscribers group.
Which configuration should you use?
A.

B.

C.

D.



Answer Clike
Which two actions should you perform?

You are creating an ASP.NET Web application that uses the SqlMembershipProvider. You plan to test locally and deploy to multiple production servers.
You need to ensure that each deployed application accesses the same production database in Microsoft SQL Server. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Run the aspnet_regsql command to create the database on the appropriate SQL Server computer.
B. Right-click App_Data in your Visual Studio 2010 project, click Add, and select New Item to create the SQL Server database on the appropriate SQL Server computer.
C. Modify the connection string in the web.config file to specify the names of the production server and database.
D. Modify the web.release.config file to transform the connection string to specify the names of the production server and database.


Answer Clike
Which two actions should you perform?

You are implementing an ASP.NET Web application.
Users will authenticate to the application with an ID.
The application will allow new users to register for an account.
The application will generate an ID for the user based on the user’s full name. You need to implement this registration functionality.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Configure the SqlMembershipProvider in the web.config file.
B. Configure the SqlProfileProvider in the web.config file. (New answer from TestKiller, SqlMembershipProvider is not changed)
C. Create an ASP.NET page that contains a default CreateUserWizard control to create a new user account.
D. Create an ASP.NET page that contains a custom form that collects the user information and then uses the Membership.CreateUser method to create a new user account.


Answer Clike
What should you do?

You create an ASP.NET page.
The page uses the jQuery $.ajax function to make calls back to the server in several places. You add the following div element to the page.
<div id="errorInfo">
</div>
You need to implement a single error handler that will add error information from all page $.ajax calls to the div named errorInfo. What should you do?
A. Add the following options to each $.ajax function call:
global: true,
error: function (XMLHttpRequest, textStatus, errorThrown){ $("#errorInfo").text("<li>Error information is: " + textStatus + "</li>");
B. Add the following code to the $(document).ready function on the page:
$("#errorInfo").ajaxError(function(event, request, settings){ $(this).append("<li>Error requesting page " + settings.url + "</li>"); });
C. Add the following option to each $.ajax function call:
error: function (XMLHttpRequest, textStatus, errorThrown){ $("#errorInfo").text("<li>Error information is: " + textStatus + "</li>");
}
D. Add the following code to the $(document).ready function on the page:
$.ajaxError(function(event, request, settings){
$(this).append("<li>Error requesting page " + settings.url + "</li>");});
Add the following option to each $.ajax function call:
global: true


Answer Clike
What should you do?

You are implementing an ASP.NET AJAX page that contains two div elements.
You need to ensure that the content of each div element can be refreshed individually, without requiring a page refresh. What should you do?
A. Add two forms to the page.
Add a script manager and an update panel to each form.
Add a content template to each update panel, and move each div element into a content template.
B. Add two forms to the page.
Add a script manager and an update panel to each form.
Add a content template to each update panel, and move each div element into a content template.
C. Add a form and two update panels to the page.
Add a script manager to the form.
Add a content template to each update panel, and move a div element into each content template.
D. Add a form and two update panels to the page.
Add two script managers to the form, one for each update panel.
Add a content template to each update panel, and move each div element into a content template.


Answer Clike
What should you do?

You are implementing an ASP.NET AJAX page.
You add two UpdatePanel controls named pnlA and pnlB. pnlA contains an UpdatePanel control named pnlAInner in its content template. You have the following requirements.
. Update panels pnlA and pnlB must refresh their content only when controls that they contain cause a postback.
. Update panel pnlAInner must refresh its content when controls in either pnlA or pnlB or pnlAInner cause a postback.
You need to configure the panels to meet the requirements. What should you do?
A. Set the UpdateMode of pnlA and pnlB to Conditional. Set the UpdateMode of pnlAInner to Always.
B. Set the UpdateMode of pnlA and pnlB to Conditional. Set the UpdateMode of pnlAInner to Conditional, and add AsyncPostBackTrigger elements to its Triggers element for every control in pnlA.
C. Set the UpdateMode of pnlA and pnlB to Always. Set the UpdateMode of pnlAInner to Conditional.
D. Set the UpdateMode of pnlA and pnlB to Always. Set the UpdateMode of pnlAInner to Always, and add AsyncPostBackTrigger elements to its Triggers element for every control in pnlB.


Answer Clike
Which declaration should you use?

You create a Web page that contains the following code. (Line numbers are included for reference only.)

You need to ensure that when the user clicks an item in the list, the text color of the "Welcome!" message will change. Which declaration should you use?
A.

B.

C.

D.



Answer Clike
Which two actions should you perform?

Corrected : Question No: 44
You are implementing an ASP.NET AJAX page.
You add the following control to the page.

You need update the contents of the UpdatePanel without causing a full reload of the page.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Add the following control before the UpdatePanel.
<asp:Timer ID="Timer1" OnLoad="Timer1_Tick" runat="server" Interval="3000" />
B. Add the following control within the UpdatePanel.
<asp:Timer ID="Timer1" OnLoad="Timer1_Tick" runat="server" Interval="3000" />
C. Add an AsyncPostBackTrigger that references Timer1.
D. Add a PostBackTrigger that references Timer1.


Answer Clike
What should you do?

You are building an ASP.NET control.
The control displays data by using a table element with a class attribute value of Results.
The control should expose a client-side event named onrowselected that fires when a check box in a table row is selected.
You need to implement this client-side event.
What should you do?
A. $(‘.Results input:checked’).onrowselected = function (e, sender) {

};
B. $(‘.Results input:checked’).bind(‘onrowselected’, function (e, sender) {

});
C.

D. $(‘.Results’).onrowselected($.proxy($(this).find(‘input:checked’), function (e, sender) {

}));


Answer Clike
Which code segment should you use?

You create a Web page that contains the following div.
<div id="target">
</div>
You have a JavaScript array named imageurls that contains a list of image URLs.
You need to write a JavaScript function that will insert images from the URLs into target. Which code segment should you use?
A.

B.

C.

D.



Answer Clike
Which code segment should you use?

You create a Web page that contains the following code.

You need to provide the following implementation.
. Each time the AddFile button is clicked, a new div element is created.
. The new div element is appended after the other file upload div elements and before the AddFile span.
. Each new element has a unique identifier.
Which code segment should you use?
A.

B.

C.

D.



Answer Clike
Which code segment should you use?

You create a Web page that contains the following image element.
<img id="myImage" src="/image1.png" />
You need to write a JavaScript function that will dynamically change which image is displayed. Which code segment should you use?
A.

B.

C.

D.



Answer Clike
Which code segment should you use?

A Web page includes the HTML shown in the following code segment.

You need to write a JavaScript function that will dynamically format in boldface all of the hyperlinks in the ref span. Which code segment should you use?
A. $("#ref").filter("a[href]").bold();
B. $("ref").filter("a").css("bold");
C. $("a").css({fontWeight:"bold"});
D. $("#ref a[href]").css({fontWeight:"bold"});


Answer Clike
Which code segment should you use?

You create a Web page that contains drop-down menus that are defined by using div tags in the following code.

You need to write a JavaScript function that will enable the drop-down menus to activate when the user positions the mouse over the menu title. Which code segment should you use?
A.

B.

C.

D.



Answer Clike
Which two actions should you perform?

You are implementing an ASP.NET application that makes extensive use of JavaScript libraries. Not all pages use all scripts, and some scripts depend on other scripts.
When these libraries load sequentially, some of your pages load too slowly.
You need to use the ASP.NET Ajax Library Script Loader to load these scripts in parallel.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. In your site’s master page, add a call to Sys.loader.defineScripts to define each of the scripts that are used in the site.
B. In your site’s master page, add a call to Sys.loader.registerScript to define each of the scripts that are used in the site.
C. In each page that uses scripts, add a call to Sys.get for each script that is needed in that page.
D. In each page that uses scripts, add a call to Sys.require for each script that is needed in that page.


Answer Clike
What should you do?

You are implementing a Web page that displays text that was typed by a user.
You need to display the user input in the Web page so that a cross-site scripting attack will be prevented. What should you do?
A. Call document.write.
B. Call Response.Write.
C. Call HttpUtility.UrlEncode.
D. Call HttpUtility.HtmlEncode.


Answer Clike
What should you do?

You create a Web page that has an ASP.NET menu.
You need to ensure that the menu items are populated from an array of strings in your code-behind file. What should you do?
A. Write a JavaScript function that uses document.write to write out an asp:MenuItem for each string array element.
B. In the Page_Render handler, use Response.Write to write out an asp:MenuItem for each string array element.
C. Set the DataSource attribute of asp:Menu to the name of the array.
D. In the Page_Load handler, create an instance of asp:MenuItem for each string array element, and add each of these instances to the menu’s Items collection.


Answer Clike
What should you do?

You are dynamically adding controls to an ASP.NET page in the Page_Load event handler.
The page will have text boxes that correspond to the columns in a database table.
Each text box will be preceded by a label that displays the name of the corresponding column.
You need to create the form so that when the user clicks the label, the corresponding text box is selected for input. What should you do?
A. For each column, output the following HTML, where COL is replaced by the name of the column.
<label>COL</label>
<input name="COL" type="text" id="COL" />
B. For each column, output the following HTML, where COL is replaced by the name of the column.
<label AssociatedControlID="COL">COL</label>
<input name="COL" type="text" id="COL" />
C. For each column, create an asp:Label control and a corresponding asp:TextBox that have the same ID.
D. For each column, create an asp:Label control and set the AssociatedControlID to the ID of the corresponding asp:Textbox control.


Answer Clike
Which two code segments should you use?

You are implementing an ASP.NET Web page.
You need to add a text box that allows only values between 1 and 10, inclusive, to be submitted.
Which two code segments should you use? (Each correct answer presents part of the solution. Choose two.)
A.

B.

C. <asp:TextBox ID=”txt1″ runat=”server” />
<asp:CustomValidator ID=”val1″ runat=”server” ControlToValidate=”txt1″
ClientValidationFunction=”validate_value” ErrorMessage=”Value invalid” />
D. <asp:TextBox ID=”txt1″ runat=”server” onChange=”validate_value(this, args)” />


Answer Clike
What should you do?

You are implementing a Web page that allows users to upload files to a Web server. The page includes a form that has a Submit button.
You want to restrict uploads so that only files smaller than 1 MB can be uploaded. What should you do?
A. Add an HTML input type="file" control.
Add an onSubmit handler to the form to check the file size and cancel the form submission if the file size is too large.
B. Add an HTML input type="file" control.
Add an onChange handler to the input control to check the file size and cancel the upload if the file size is too large.
C. Add an ASP.NET FileUpload control and configure it to run on the server.
Add a server-side OnClick handler to the form’s Submit button to save the file only if the file size is allowed
D. Add an ASP.NET FileUpload control and configure it to run on the server.
Add a server-side OnDataBinding handler that saves the file only if the file size is allowed.


Answer Clike
What should you do?

You are developing a Web page.
The user types a credit card number into an input control named cc and clicks a button named submit. The submit button sends the credit card number to the server.
A JavaScript library includes a CheckCreditCard function that returns a value of true if the credit card appears to be valid, based on its checksum.
You need to ensure that the form cannot be used to submit invalid credit card numbers to the server.
What should you do?
A. Configure the input control to run on the server. On the submit button, add a server-side OnClick handler that calls CheckCreditCard and rejects the form submission if the input is invalid.
B. On the input control, add an onChange handler that calls CheckCreditCard and cancels the form submission when the input is invalid.
C. Configure the input control and the submit button to run on the server. Add a submit_OnClick handler that calls CheckCreditCard and rejects the form submission if the input is invalid.
D. On the form, add an onSubmit handler that calls CheckCreditCard and cancels the form submission if the input is invalid.


Answer Clike
What should you do?

You are troubleshooting an ASP.NET Web application.
System administrators have recently expanded your web farm from one to two servers.
Users are periodically reporting an error message about invalid view state.
You need to fix the problem.
What should you do?
A. Set viewStateEncryptionMode to Auto in web.config on both servers.
B. Set the machineKey in machine.config to the same value on both servers.
C. Change the session state mode to SQL Server on both servers and ensure both servers use the same connection string.
D. Override the SavePageStateToPersistenceMedium and LoadPageStateFromPersistenceMedium methods in the page base class to serialize the view state to a local web server file.


Answer Clike
Which page event should add an event handler to?

You create an ASP.NET page named TestPage.aspx that contains validation controls.
You need to verify that all input values submitted by the user have been validated by testing thePage.IsValid property. Which page event should add an event handler to?
A. Init
B. Load
C. PreInit
D. PreLoad


Answer Clike
Which two actions should you perform?

You are implementing an ASP.NET page that hosts a user control named CachedControl.
You need to ensure that the content of the user control is cached for 10 seconds and that it is regenerated when fetched after the 10 seconds elapse. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Modify the hosting page’s caching directive as follows.
<%@ OutputCache Duration="10" VaryByParam="None" %>
B. Add the following meta tag to the Head section of the hosting page.
<meta http-equiv="refresh" content="10">
C. Add the following caching directive to the hosted control.
<%@ OutputCache Duration="10" VaryByParam="None" %>
D. Add the following caching directive to the hosted control.
<%@ OutputCache Duration="10" VaryByControl="None" %>


Answer Clike
What should you do?

You have created an ASP.NET server control named ShoppingCart for use by other developers.
Some developers report that the ShoppingCart control does not function properly with ViewState disabled.
You want to ensure that all instances of the ShoppingCart control work even if ViewState is disabled.
What should you do?
A. Require developers to set EnableViewStateMac to true.
B. Store state in ControlState instead of ViewState.
C. Serialize the state into an Application state entry called "MyControl"
D. Require developers to change the session state mode to SQL Server.


Answer Clike
Which attribute should you set to true?

You are testing an existing ASP.NET page.
The page includes a text box.
You are able to execute malicious JavaScript code by typing it in the text box and submitting.
You need to configure the page to prevent JavaScript code from being submitted by the text box.
In the @ Page directive, which attribute should you set to true?
A. the EnableEventValidation attribute
B. the ResponseEncoding attribute
C. the ValidateRequest attribute
D. the Strict attribute


Answer Clike
Which event handler should you add?

You are implementing an ASP.NET page in an e-commerce application.
Code in a btnAddToCart_Click event handler adds a product to the shopping cart.
The page should check the status of the shopping cart and always show a cart icon when one or more items are in the shopping cart.
The page should hide the icon when the shopping cart has no items.
You need to add an event handler to implement this requirement.
Which event handler should you add?
A. btnAddToCart_Click
B. Page_Load
C. Page_PreRender
D. Page_PreInit


Answer Clike
Which code segment should you use?

You are implementing a read-only page that includes the following controls.
<asp:Button ID="btnRefresh" runat="server" Text="Button" />
<asp:GridView ID="gvCustomers" runat="server" EnableViewState="False"
OnDataBinding="gvCustomers_DataBinding"></asp:GridView>
You disable view state to improve performance.
You need to ensure that the page is updated to display the latest data when the user clicks the refresh button. Which code segment should you use?
A.

B.

C.

D.



Answer Clike
Which code segment should you use?

You are implementing an ASP.NET MVC 2 Web application that contains the following class.

You create a strongly typed view that displays details for a Department instance.
You want the view to also include a listing of department employees.
You need to write a code segment that will call the ListEmployees action method and output the results in place. Which code segment should you use?
A. <%= Html.Action("ListEmployees", Model) %>
B. <%= Html.ActionLink("ListEmployees", "Department", "DepartmentController") %>
C. <% Html.RenderPartial("ListEmployees", Model); %>
D. <%= Html.DisplayForModel("ListEmployees") %>


Answer Clike
What should you do?

You create an ASP.NET MVC 2 Web application that contains the following controller class.

In the Views folder of your application, you add a view page named Index.aspx that includes the following @ Page directive.
<%@ Page Inherits="System.Web.Mvc.ViewPage" %>
You test the application with a browser.
You receive the following error message when the Index method is invoked: "The view ‘Index’ or its master was not found."
You need to resolve the error so that the new view is displayed when the Index method is invoked. What should you do?
A. Change the name of the Index.aspx file to Product.aspx.
B. Create a folder named Product inside the Views folder. Move Index.aspx to the Product folder.
C. Replace the @ Page directive in Index.aspx with the following value.
<%@ Page Inherits="System.Web.Mvc.ViewPage<Product>" %>
D. Modify the Index method by changing its signature to the following:
public ActionResult Index(Product p)


Answer Clike
What should you do?

You are implementing an ASP.NET MVC 2 Web application that contains several folders.
The Views/Shared/DisplayTemplates folder contains a templated helper named Score.ascx that performs custom formatting of integer values. The Models folder contains a class named Player with the following definition.

You need to ensure that the custom formatting is applied to LastScore values when the HtmlHelper.DisplayForModel method is called for any view in the application that has a model of type Player.
What should you do?
A. Rename Score.ascx to LastScore.ascx.
B. Move Score.ascx from the Views/Shared/DisplayTemplates folder to the Views/Player/DisplayTemplates folder.
C. Add the following attribute to the LastScore property.
[UIHint("Score")]
D. Add the following attribute to the LastScore property.
[Display(Name="LastScore", ShortName="Score")]


Answer Clike
What should you do?

You are implementing an ASP.NET MVC 2 Web application.
You create a shared user control named MenuBar.ascx that contains the application’s menu.
You need to use the menu bar in all application views.
What should you do?
A. In the site’s master page, create a div element with an ID of Navigation.
Add the following code segment inside this div element.
<% Html.RenderPartial("~/Views/Shared/MenuBar.ascx"); %>
B. In the site’s master page, create a div element with an ID of Navigation.
Add the following code segment inside this div element.
<%= Url.Content("~/Views/Shared/MenuBar.ascx") %>
C. In each of the controller’s action methods, add an entry to the ViewData collection with a key of Navigation and a value of ~/Views/Shared/ MenuBar.ascx.
D. In the site’s Global.asax.cs file, register a route named Navigation that points to the ~/Views/Shared/MenuBar.ascx file.


Answer Clike
Which code segment should you use?

You create an ASP.NET MVC 2 Web application.
You implement a single project area in the application. In the Areas folder, you add a subfolder named Test.
You add files named TestController.cs and Details.aspx to the appropriate subfolders.
You register the area’s route, setting the route name to test_default and the area name to test. You create a view named Info.aspx that is outside the test area.
You need to add a link to Info.aspx that points to Details.aspx.
Which code segment should you use?
A. <%= Html.RouteLink("Test", "test_default", new {area = "test"}, null) %>
B. <%= Html.ActionLink("Test", "Details", "Test", new {area = "test"}, null) %>
C. <a href="<%= Html.RouteLink("Test", "test_default", new {area = "test"}, null) %>">Test</a>
D. <a href="<%= Html.ActionLink("Test", "Details", "Test", new {area = "test"}, null) %>">Test</a>


Answer Clike
What should you do?

You are implementing an ASP.NET MVC 2 application.
In the Areas folder, you add a subfolder named Product to create a single project area.
You add files named ProductController.cs and Index.aspx to the appropriate subfolders.
You then add a file named Route.cs to the Product folder that contains the following code. (Line numbers are included for reference only.)

When you load the URL http://<applicationname>/product, you discover that the correct page is not returned.
You need to ensure that the correct page is returned.
What should you do?
A. Replace line 10 with the following code segment.
context.MapRoute("product_default", "{area}/{controller}/{action}/{id}", new {area = "product", controller = "Product", action = "Index", id = ""});
B. Replace line 10 with the following code segment.
context.MapRoute("product_default", "area}",
C. Add the following code segment at line 11
AreaRegistration.RegisterAllAreas();
D. Add the following Code segment to the Register Routes in Global.asax.cs file.
AreaRegistration.RegisterAllAreas();


Answer Clike
What are two possible attributes that you can add to the Edit action to achieve this goal?

You are implementing an ASP.NET MVC 2 Web application that allows users to view and edit data. You need to ensure that only logged-in users can access the Edit action of the controller.
What are two possible attributes that you can add to the Edit action to achieve this goal? (Each correct answer presents a complete solution. Choose two.)
A. [Authorize(Users = "")]
B. [Authorize(Roles = "")]
C. [Authorize(Users = "*")]
D. [Authorize(Roles = "*")]


Answer Clike
What are two possible ways to achieve this goal?

You are implementing an ASP.NET MVC 2 Web application.
A controller contains the following code.

The first Edit action displays the user whose details are to be edited, and the second Edit action is called when the Save button on the editing form is clicked to update the user details.
An exception is thrown at run time stating that the request for action Edit is ambiguous. You need to correct this error and ensure that the controller functions as expected.
What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)
A. Add the following attribute to the first Edit action.
[AcceptVerbs(HttpVerbs.Head)]
B. Add the following attribute to the first Edit action.
[HttpGet]
C. Add the following attribute to the second Edit action.
[HttpPost]
D. Add the following attribute to the second Edit action.
[HttpPut]


Answer Clike
Which two actions should you perform?

You are implementing an ASP. NET MVC 2 Web application. You add a controller named CompanyController.
You need to modify the application to handle the URL path /company/info.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Add the following method to the CompanyController class.

B. Add the following method to the CompanyController class.

C. Right-click the Views folder, and select View from the Add submenu to create the view for the action.
D. Right-click inside the action method in the CompanyController class, and select Add View to create a view for the action.


Answer Clike
What should you do?

You are implementing an ASP.NET MVC 2 Web application.
The URL with path /Home/Details/{country} will return a page that provides information about the named country.
You need to ensure that requests for this URL that contain an unrecognized country value will not be processed by the Details action of HomeController. What should you do?
A. Add the ValidateAntiForgeryToken attribute to the Details action method.
B. Add the Bind attribute to the country parameter of the Details action method.
Set the attribute’s Prefix property to Country.
C. Create a class that implements the IRouteConstraint interface.
Configure the default route to use this class.
D. Create a class that implements the IRouteHandler interface.
Configure the default route to use this class.


Answer Clike
What should you do?

You create a new ASP.NET MVC 2 Web application.
The following default routes are created in the Global.asax.cs file. (Line numbers are included for reference only.)

You implement a controller named HomeController that includes methods with the following signatures.
public ActionResult Index()
public ActionResult Details(int id)
public ActionResult DetailsByUsername(string username)
You need to add a route to meet the following requirements.
. The details for a user must to be displayed when a user name is entered as the path by invoking the DetailsByUsername action.
. User names can contain alphanumeric characters and underscores, and can be between 3 and 20 characters long.
What should you do?
A. Replace line 05 with the following code segment.
routes.MapRoute("Default", "{controller}/{action}/{id}", new {controller = "Home", action = "DetailsByUsername", id = ""});
B. Replace line 05 with the following code segment.
routes.MapRoute("Default", "{controller}/{action}/{username}", new {controller = "Home", action = "DetailsByUsername", username = ""}, new {username = @"w{3,20}"});
C. At line 04, add the following code segment.
routes.MapRoute("Details by Username", "{username}", new {controller = "Home", action = "DetailsByUsername"}, new {username = @"w{3,20}"});
D. At line 04, add the following code segment.
routes.MapRoute("Details by Username", "{id}", new {controller = "Home", action = "DetailsByUsername"}, new {id = @"w{3,20}"});


Answer Clike
What should you do?

You create a new ASP.NET MVC 2 Web application.
The following default routes are created in the Global.asax.cs file. (Line numbers are included for reference only.)

You implement a controller named HomeController that includes methods with the following signatures.
public ActionResult About()
public ActionResult Index()
public ActionResult Details(int id)
You need to ensure that the About action is invoked when the root URL of the site is accessed. What should you do?
A. At line 04 in the Global.asax.cs file, add the following line of code.
routes.MapRoute("Default4Empty", "/", new {controller = "Home", action = "About"});
B. At line 04 in the Global.asax.cs file, add the following line of code.
routes.MapRoute("Default", "", new {controller = "Home", action = "About"});
C. Replace line 05 in the Global.asax.cs file with the following line of code.
routes.MapRoute("Default4Empty", "{controller}/{action}/{id}", new {controller = "Home", action = "About", id = ""});
D. Replace line 05 in the Global.asax.cs file with the following line of code.
routes.MapRoute("Default", "{controller}/{action}", new {controller = "Home", action = "About"});


Answer Clike
Which two actions should you perform?

You are implementing a new Dynamic Data Web site.
The Web site includes a Web page that has an ObjectDataSource control named ObjectDataSource1.
ObjectDataSource1 interacts with a Web service that exposes methods for listing and editing instances of a class named Product.
You add a GridView control named GridView1 to the page, and you specify that GridView1 should use ObjectDataSource1 as its data source.
You then configure GridView1 to auto-generate fields and to enable editing.
You need to add Dynamic Data behavior to GridView1.
You also must ensure that users can use GridView1 to update Product instances.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Add a DynamicDataManager control to the Web page.
B. Disable the auto-generated fields on GridView1. Add a DynamicField control for each field of the Product class.
C. Add the following code segment to the Application_Start method in the Global.asax.cs file.
DefaultModel.RegisterContext(typeof(System.Web.UI.WebControls.ObjectDataSource), new ContextConfiguration()
{ScaffoldAllTables = true});
D. Add the following code segment to the Page_Init method of the Web page.
GridView1.EnableDynamicData(typeof(Product));


Answer Clike
Which two actions should you perform

You are implementing an ASP.NET Web site. The site contains the following class.

The Web site interacts with an external data service that requires Address instances to be given in the following XML format.

You need to ensure that Address instances that are serialized by the XmlSerializer class meet the XML format requirements of the external data service.
Which two actions should you perform (Each correct answer presents part of the solution. Choose two.)
A. Add the following attribute to the AddressType field.
[XmlAttribute]
B. Add the following attribute to the Line2 field.
[XmlElement(IsNullable=true)]
C. Add the following attribute to the ZipPostalCode field.
[XmlAttribute("ZipCode")]
D. Add the following attribute to the ZipPostalCode field.
[XmlElement("ZipCode")]


Answer Clike
What should you do?

You are implementing an ASP.NET Dynamic Data Web site.
The Web site includes a data context that enables automatic scaffolding for all tables in the data model. The Global.asax.cs file contains the following code segment.

You need to display the items in a table named Products by using a custom layout. What should you do?
A. Add a new Web page named Products.aspx to the Dynamic DataPageTemplates folder of the Web site.
B. Add a new folder named Products to the Dynamic DataCustomPages folder of the Web site.
Add a new Web page named ListDetails.aspx to the Products folder.
C. Add a new Web user control named Products.ascx to the Dynamic DataFilters folder of the Web site.
In the code-behind file for the control, change the base class from UserControl to System.Web.DynamicData.QueryableFilterUserControl.
D. Add a new Web user control named Products_ListDetails.ascx to the Dynamic DataEntityTemplates folder of the Web site.
In the code-behind file for the control, change the base class from UserControl to System.Web.DynamicData.EntityTemplateUserControl.


Answer Clike
Which two actions should you perform?

You are implementing an ASP.NET Web site.
The Web site contains a Web service named CustomerService.
The code-behind file for the CustomerService class contains the following code segment.

You need to ensure that the GetProducts method can be called by using AJAX.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Apply the WebService attribute to the ProductService class.
B. Apply the ScriptService attribute to the ProductService class.
C. Apply the WebMethod attribute to the GetProducts method.
D. Apply the ScriptMethod attribute to the GetProducts method.


Answer Clike
What should you do?

You are implementing a WCF service library.
You add a new code file that contains the following code segment.

You build the service library and deploy its assembly to an IIS application.
You need to ensure that the GetCurrentRate method can be called from JavaScript. What should you do?
A. Add a file named Service.svc to the IIS application.
Add the following code segment to the file.
<%@ ServiceHost Service="ContosoWCF.IRateService"
Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" %>
B. Add a file named Service.svc to the IIS application.
Add the following code segment to the file.
<%@ ServiceHost Service="ContosoWCF.RateService"
Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" %>
C. Apply the script service attribute to rate serice class Rebulid the WCF servicelibrary, and redploy the assembly to the IIS application.
D. Apply the Web get attibute to the Get Currant rate interface Method.Rebuild the WCF servicelibrary, and redploy the assembly to the IIS application.


Answer Clike
Which code segment should you use?

You are implementing an ASP.NET page. Client-side script requires data.
Your application includes a class named Person with a Name property of type string. The code-behind file of the page includes the following code segment.
public string JsonValue;
List<Person> people = GetPeopleList();
JavaScriptSerializer json = new JavaScriptSerializer();
You need to use the JavaScriptSerializer class to serialize only the Name property of each item in the people list. Which code segment should you use?
A. JsonValue = json.Serialize(people.Select(p => p.Name));
B.

C. JsonValue = json.Serialize(people.SelectMany( p =>Name.AsEnumerable()));
D.



Answer Clike
Which code segment should you use?

You are implementing an ASP.NET application that uses LINQ to Entities to access and update the database.
The application includes the following method to update a detached entity of type Person.
private NorthwindContext _entities;
public void UpdatePerson(Person personToEdit)
{
}
You need to implement the UpdatePerson method to update the database row that corresponds to the personToEdit object. Which code segment should you use?
A. _entities.People.Attach(personToEdit);
_entities.ObjectStateManager.ChangeObjectState(personToEdit, EntityState.Modified);
_entities.SaveChanges();
B. _entities.ObjectStateManager.ChangeObjectState(personToEdit, EntityState.Added);
_entities.SaveChanges();
C. _entities.People.ApplyCurrentValues(personToEdit);
_entities.SaveChanges();
D. _entities.People.Attach(new Person() { Id = personToEdit.Id });
_entities.ObjectStateManager.ChangeObjectState(personToEdit, EntityState.Modified);
_entities.SaveChanges();


Answer Clike
Which code segment should you use?

You are implementing an ASP.NET application. You add the following code segment.

You need to add code to return a list of all Person objects except those with a UserId that is contained in the secretUsers list. The resulting list must not contain duplicates.
Which code segment should you use?
A.

B.

C.

D.



Answer Clike
What should you do?

You are implementing an ASP.NET Web application that retrieves data from a Microsoft SQL Server database. You add a page that includes the following data source control.
<asp:SqlDataSource id="sqlds" runat="server" ConnectionString="<%$ ConnectionStrings:MyDB %>"
SelectCommand="SELECT * FROM Companies" />
The page is accessed frequently, but the data in the database rarely changes.
You need to cache the retrieved data so that the database is not queried each time the Web page is accessed. What should you do?
A. Add the following attributes to the SqlDataSource control.
DataSourceMode=”DataSet”
EnableCaching=”True”
CacheDuration=”120″
B. Add the following attributes to the SqlDataSource control.
DataSourceMode=”DataReader”
EnableCaching=”True”
CacheDuration=”120″
C. Add the following configuration to the <system.web/> section of the web.config file.

D. Add the following configuration to the <system.web/> section of the web.config file.



Answer Clike
What should you do?

You are implementing an ASP.NET page.
You add and configure the following ObjectDataSource.

The page will be called with a query string field named pid.
You need to configure the ObjectDataSource control to pass the value of the pid field to GetProductsByProductId method. What should you do?
A. Replace the asp:QueryStringParameter with the following declaration.
<asp:QueryStringParameter DefaultValue="pid" Name="productId" Type="Int32" />
B. Replace the asp:QueryStringParameter with the following declaration.
<asp:QueryStringParameter QueryStringField="pid" Name="productId" Type="Int32" />
C. Add the following event handler to the Selecting event of the ObjectDataSource control.

D. Add the following code segment to the page’s code-behind.



Answer Clike
Which code segment should you use?

You are implementing an ASP.NET page.
The page includes a method named GetCustomerOrderDataSet that returns a DataSet.
The DataSet includes a DataTable named CustomerDetailsTable and a DataTable named OrderDetailsTable.
You need to display the data in OrderDetailsTable in a DetailsView control named dtlView.
Which code segment should you use?
A. dtlView.DataSource = GetCustomerOrderDataSet();
dtlView.DataMember = “OrderDetailsTable”;
dtlView.DataBind();
B. dtlView.DataSource = GetCustomerOrderDataSet();
dtlView.DataSourceID = “OrderDetailsTable”;
dtlView.DataBind();
C. dtlView.DataSource = GetCustomerOrderDataSet();
dtlView.DataKeyNames = new string [] { “OrderDetailsTable”};
dtlView.DataBind();
D. DataSet dataSet = GetCustomerOrderDataSet();
dtlView.DataSource = new DataTable(“dataSet”, “OrderDetailsTable”);
dtlView.DataBind();


Answer Clike
What should you do?

You deploy an ASP.NET application to an IIS server.
You need to log health-monitoring events with severity level of error to the Windows application event log. What should you do?
A. Run the aspnet_regiis.exe command.
B. Set the Treat warnings as errors option to All in the project properties and recompile.
C. Add the following rule to the <healthMonitoring/> section of the web.config file.

D. Add the following rule to the <healthMonitoring/> section of the web.config file.



Answer Clike
Which code segment should you use?

You are implementing an ASP.NET Web site.
The site uses a component that must be dynamically configured before it can be used within site pages. You create a static method named SiteHelper.Configure that configures the component.
You need to add a code segment to the Global.asax file that invokes the SiteHelper.Configure method the first time, and only the first time, that any page in the site is requested.
Which code segment should you use?
A. void Application_Start(object sender, EventArgs e)

B. void Application_Init(object sender, EventArgs e)

C. void Application_BeginRequest(object sender, EventArgs e)

D. Object lockObject = new Object();



Answer Clike
Which two actions should you perform?

You create a Visual Studio 2010 solution that includes a WCF service project and an ASP.NET project.
The service includes a method named GetPeople that takes no arguments and returns an array of Person objects.
The ASP.NET application uses a proxy class to access the service.
You use the Add Service Reference wizard to generate the class.
After you create the proxy, you move the service endpoint to a different port.
You need to configure the client to use the new service address.
In addition, you must change the implementation so that calls to the client proxy will return a List<Person> instead of an array. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. In the context menu for the service reference in the ASP.NET project, select the Configure Service Reference command, and set the collection type to System.Collections.Generic.List.
B. In the context menu for the service reference in the ASP.NET project, select the Update Service Reference command to retrieve the new service configuration.
C. Change the service interface and implementation to return a List<Person>
D. Edit the address property of the endpoint element in the web.config file to use the new service address.


Answer Clike
Which configuration should you use in web.config?

You use the ASP.NET Web Site template to create a Web site that will be deployed to multiple locations.
Each location will specify its SMTP configuration settings in a separate file named smtp.config in the root folder of the Web site.
You need to ensure that the configuration settings that are specified in the smtp.config file will be applied to the Web site.
Which configuration should you use in web.config?
A.

B.

C.

D.



Answer Clike
Which code segment should you use?

You are creating an ASP.NET Web site. You create a HTTP module named CustomModule, and you register the module in the web.config file. The CustomModule class contains the following code.

You need to add code to CustomModule to append the footer content to each processed ASP.NET page. Which code segment should you use?
A.

B.

C.

D.



Answer Clike
What should you do?

You are implementing an ASP.NET Web site.
The root directory of the site contains a page named Error.aspx.
You need to display the Error.aspx page if an unhandled error occurs on any page within the site. You also must ensure that the original URL in the browser is not changed.
What should you do?
A. Add the following configuration to the web.config file.

B. Add the following configuration to the web.config file.

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

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



Answer Clike
Which code segment should you use?

You are creating an ASP.NET Web site.
The site is configured to use Membership and Role management providers.
You need to check whether the currently logged-on user is a member of a role named Administrators. Which code segment should you use?
A. bool isMember = Roles.GetUsersInRole("Administrators").Any();
B. bool isMember = Membership.ValidateUser(User.Identity.Name, "Administrators");
C. bool isMember = Roles.GetRolesForUser("Administrators").Any();
D. bool isMember = User.IsInRole("Administrators");


Answer Clike
What should you do?

You are implementing custom ASP.NET server controls.
You have a base class named RotaryGaugeControl and two subclasses named CompassGaugeControl and SpeedGaugeControl. Each control requires its own client JavaScript code in order to function properly.
The JavaScript includes functions that are used to create the proper HTML elements for the control.
You need to ensure that the JavaScript for each of these controls that is used in an ASP.NET page is included in the generated HTML page only once, even if the ASP.NET page uses multiple instances of the given control.
What should you do?
A. Place the JavaScript in a file named controls.js and add the following code line to the Page_Load method of each control.
Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "script", "controls.js");
B. Add the following code line to the Page_Load method of each control, where strJavascript contains the JavaScript code for the control.
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "script", strJavascript);
C. Add the following code line to the Page_Load method of each control, where CLASSNAME is the name of the control class and strJavascript contains the JavaScript code for the control.
Page.ClientScript.RegisterStartupScript(typeof(CLASSNAME), "script", strJavascript);
D. Add the following code line to the Page_Load method of each control, where CLASSNAME is the name of the control class and strJavascript contains the JavaScript code for the control.
Page.ClientScript.RegisterClientScriptBlock(typeof(CLASSNAME), "script", strJavascript);


Answer Clike
What are two possible ways to achieve this goal?

You create an ASP.NET page that contains the following tag.
<h1 id="hdr1" runat="server">Page Name</h1>
You need to write code that will change the contents of the tag dynamically when the page is loaded.
What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)
A. this.hdr1.InnerHtml = "Text";
B. (hdr1.Parent as HtmlGenericControl).InnerText = "Text";
C. HtmlGenericControl h1 = this.FindControl("hdr1") as HtmlGenericControl;
h1.InnerText = "Text";
D. HtmlGenericControl h1 = Parent.FindControl("hdr1") as HtmlGenericControl;
h1.InnerText = "Text";


Answer Clike
Which two actions should you perform?

You create a custom server control named Task that contains the following code segment. (Line numbers are included for reference only.)

You need to ensure that adding a Task control from the Toolbox creates markup in the following format.
<Dev:Task ID="Task1" runat="server" Title="New Task" />
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Add the following code segment to the project’s AssemblyInfo.cs file.
[assembly: TagPrefix("DevControls", "Dev")]
B. Replace line 05 with the following code segment.
[DefaultValue("New Task")]
C. Insert the following code segment immediately before line 03.
[ToolboxData("<{0}:Task runat="server" Title="New Task" />")]
D. Replace line 10 with the following code segment.
output.Write("<Dev:Task runat="server" Title="New Task" />");


Answer Clike
What should you do?

You are implementing an ASP.NET page that includes the following drop-down list.

You need to dynamically add values to the end of the drop-down list. What should you do?
A. Add the following OnPreRender event handler to the asp:DropDownList

B. Add the following OnPreRender event handler to the asp:DropDownList

C. Add the following event handler to the page code-behind.

D. Add the following event handler to the page code-behind.



Answer Clike
Which code segment should you use?

You create a Web page named TestPage.aspx and a user control named contained in a file named TestUserControl.ascx. You need to dynamically add TestUserControl.ascx to TestPage.aspx.
Which code segment should you use?
A.

B.

C.

D.



Answer Clike
Which two actions should you perform?

You create a Web page named TestPage.aspx and a user control named TestUserControl.ascx. TestPage.aspx uses TestUserControl.ascx as shown in the following line of code.
<uc:TestUserControl ID="testControl" runat="server"/>
On TestUserControl.ascx, you need to add a read-only member named CityName to return the value "New York". You also must add code to TestPage.aspx to read this value.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Add the following line of code to the TestUserControl.ascx.cs code-behind file.

B. Add the following line of code to the TestUserControl.ascx.cs code-behind file.
protected readonly string CityName = "New York";
C. Add the following code segment to the TestPage.aspx.cs code-behind file.

D. Add the following code segment to the TestPage.aspx.cs code-behind file.



Answer Clike
Which two actions should you perform?

You use the following declaration to add a Web user control named TestUserControl.ascx to an ASP.NET page named TestPage.aspx.
<uc:TestUserControl ID="testControl" runat="server"/>
You add the following code to the code-behind file of TestPage.aspx.
private void TestMethod()
{

}
You define the following delegate.
public delegate void MyEventHandler();
You need to add an event of type MyEventHandler named MyEvent to TestUserControl.ascx and attach the page’s TestMethod method to the event. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Add the following line of code to TestUserControl.ascx.cs.
public event MyEventHandler MyEvent;
B. Add the following line of code to TestUserControl.ascx.cs.
public MyEventHandler MyEvent;
C. Replace the TestUserControl.ascx reference in TestPage.aspx with the following declaration.
<uc:TestUserControl ID="testControl" runat="server" OnMyEvent="TestMethod"/>
D. Replace the TestUserControl.ascx reference in TestPage.aspx with the following declaration.
<uc:TestUserControl ID="testControl" runat="server" MyEvent="TestMethod"/>


Answer Clike
Which code segment should you use?

You are implementing an ASP.NET Web site.
The site allows users to explicitly choose the display language for the site’s Web pages.
You create a Web page that contains a DropDownList named ddlLanguage, as shown in the following code segment.

The site contains localized resources for all page content that must be translated into the language that is selected by the user.
You need to add code to ensure that the page displays content in the selected language if the user selects a language in the drop-down list. Which code segment should you use?
A.

B.

C.

D.



Answer Clike
Which code segment should you add?

You are implementing an ASP.NET application that includes the following requirements. Retrieve the number of active bugs from the cache, if the number is present.
If the number is not found in the cache, call a method named GetActiveBugs, and save the result under the ActiveBugs cache key. Ensure that cached data expires after 30 seconds.
You need to add code to fulfill the requirements. Which code segment should you add?
A.

B.

C.

D.



Answer Clike
Which code segment should you add?

You are implementing a method in an ASP.NET application that includes the following requirements.
. Store the number of active bugs in the cache.
. The value should remain in the cache when there are calls more often than every 15 seconds.
. The value should be removed from the cache after 60 seconds.
You need to add code to meet the requirements. Which code segment should you add?
A. Cache.Insert("ActiveBugs", result, null, DateTime.Now.AddSeconds(60), TimeSpan.FromSeconds(15));
B. Cache.Insert(“Trigger”, DateTime.Now, null, DateTime.Now.AddSeconds(60), Cache.NoSlidingExpiration);
CacheDependency cd = new CacheDependency(null, new string[] { “Trigger” });
Cache.Insert(“ActiveBugs”, result, cd, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(15));
C. Cache.Insert(“ActiveBugs”, result, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(15));
CacheDependency cd = new CacheDependency(null, new string[] { “ActiveBugs” });
Cache.Insert(“Trigger”, DateTime.Now, cd, DateTime.Now.AddSeconds(60), Cache.NoSlidingExpiration);
D. CacheDependency cd = new CacheDependency(null, new string[] { “Trigger” });
Cache.Insert(“Trigger”, DateTime.Now, null, DateTime.Now.AddSeconds(60), Cache.NoSlidingExpiration);
Cache.Insert(“ActiveBugs”, result, cd, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(15));


Answer Clike
Which attribute should you use?

You are implementing an ASP.NET application that will use session state in out-of-proc mode. You add the following code.

You need to add an attribute to the Person class to ensure that you can save an instance to session state. Which attribute should you use?
A. Bindable
B. DataObject
C. Serializable
D. DataContract


Answer Clike
What should you do?

You are creating an ASP.NET Web site.
The site has a master page named Custom.master.
The code-behind file for Custom.master contains the following code segment.

You create a new ASP.NET page and specify Custom.master as its master page. You add a Label control named lblRegion to the new page.
You need to display the value of the master page’s Region property in lblRegion. What should you do?
A. Add the following code segment to the Page_Load method of the page code-behind file.
CustomMaster custom = this.Parent as CustomMaster;
lblRegion.Text = custom.Region;
B. Add the following code segment to the Page_Load method of the page code-behind file.
CustomMaster custom = this.Master as CustomMaster;
lblRegion.Text = custom.Region;
C. Add the following code segment to the Page_Load method of the Custom.Master.cs code-behind file.
Label lblRegion = Page.FindControl(“lblRegion”) as Label;
lblRegion.Text = this.Region;
D. Add the following code segment to the Page_Load method of the Custom.Master.cs code-behind file.
Label lblRegion = Master.FindControl(“lblRegion”) as Label;
lblRegion.Text = this.Region;


Answer Clike
What should you do?

You are implementing an ASP.NET page.
You add asp:Button controls for Help and for Detail.
You add an ASP.NET skin file named default.skin to a theme.
You need to create and use a separate style for the Help button, and you must use the default style for the Detail button. What should you do?
A. Add the following markup to the default.skin file.
<asp:Button ID="Help"></asp:Button>
<asp:Button ID="Default"></asp:Button>
Use the following markup for the buttons in the ASP.NET page.
<asp:Button SkinID="Help">Help</asp:Button>
<asp:Button SkinID="Default">Detail</asp:Button>
B. Add the following markup to the default.skin file.
<asp:Button SkinID="Help"></asp:Button>
<asp:Button ID="Default"></asp:Button>
Use the following markup for the buttons in the ASP.NET page.
<asp:Button SkinID="Help">Help</asp:Button>
<asp:Button SkinID="Default">Detail</asp:Button>
C. Add the following code segment to default.skin.
<asp:Button SkinID="Help"></asp:Button>
<asp:Button></asp:Button>
Use the following markup for the buttons in the ASP.NET page.
<asp:Button SkinID="Help"></asp:Button>
<asp:Button SkinID="Default">Detail</asp:Button>
D. Add the following markup to default.skin.
<asp:Button SkinID="Help"></asp:Button>
<asp:Button></asp:Button>
Use the following markup for the buttons in the ASP.NET page.
<asp:Button SkinID="Help">Help</asp:Button>
<asp:Button>Detail</asp:Button>


Answer Clike
What should you do?

You are implementing an ASP.NET application that includes a page named TestPage.aspx.
TestPage.aspx uses a master page named TestMaster.master.
You add the following code to the TestPage.aspx code-behind file to read a TestMaster.master public property named CityName.

You need to ensure that TestPage.aspx can access the CityName property. What should you do?
A. Add the following directive to TestPage.aspx.
<%@ MasterType VirtualPath="~/TestMaster.master" %>
B. Add the following directive to TestPage.aspx.
<%@ PreviousPageType VirtualPath="~/TestMaster.master" %>
C. Set the Strict attribute in the @ Master directive of the TestMaster.master page to true.
D. Set the Explicit attribute in the @ Master directive of the TestMaster.master page to true.


Answer Clike
What should you do?

You are implementing an ASP.NET application that uses data-bound GridView controls in multiple pages.
You add JavaScript code to periodically update specific types of data items in these GridView controls.
You need to ensure that the JavaScript code can locate the HTML elements created for each row in these GridView controls, without needing to be changed if the controls are moved from one page to another.
What should you do?
A. Replace the GridView control with a ListView control.
B. Set the ClientIDMode attribute to Predictable in the web.config file.
C. Set the ClientIDRowSuffix attribute of each unique GridView control to a different value.
D. Set the @ OutputCache directive’s VaryByControl attribute to the ID of the GridView control.


Answer Clike