32916

723 views

Published on

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

  • Be the first to like this

No Downloads
Views
Total views
723
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

32916

  1. 1. 83. You create a Microsoft ASP.NET Web application by using the Microsoft .NETFramework version 3.5.You use Windows Authentication for the application. You set up NTFS file systempermissions for theSales group to access a particular file. You discover that all the users are able to accessthe file.You need to ensure that only the Sales group users can access the file.What additional step should you perform?A. Remove the rights from the ASP.NET user to the file.B. Remove the rights from the application pool identity to the file.C. Add the <identity impersonate="true"/> section to the Web.config file.D. Add the <authentication mode="[None]"> section to the Web.config file.
  2. 2. Answer: C85. You create a Microsoft ASP.NET Web application by using the Microsoft .NETFramework version 3.5.You plan to set up authentication for the Web application. The application must supportusers fromuntrusted domains.You need to ensure that anonymous users cannot access the application.Which code fragment should you add to the Web.config file?A. <system.web><authentication mode="Forms"><forms loginUrl="login.aspx" /></authentication><authorization><deny users="?" /></authorization></system.web>B. <system.web><authentication mode="Forms"><forms loginUrl="login.aspx" /></authentication><authorization><deny users="*" /></authorization></system.web>C. <system.web><authentication mode="Windows"></authentication><authorization><deny users="?" /></authorization></system.web>| English | Chinese | Japan | Korean | - 103 - Test Information Co., Ltd. All rights reserved.D. <system.web><authentication mode="Windows"></authentication><authorization><deny users="*" /></authorization></system.web>
  3. 3. Answer: A87. You are maintaining a Microsoft ASP.NET Web Application that was created by usingtheMicrosoft .NET Framework version 3.5.You obtain the latest version of the project from the source control repository. Youdiscover that anassembly reference is missing when you attempt to compile the project on your computer.You need to compile the project on your computer.What should you do?A. Add a reference path in the property pages of the project to the location of the missingassembly.B. Add a working directory in the property pages of the project to the location of themissing assembly.C. Change the output path in the property pages of the project to the location of themissing assembly.D. Delete the assembly reference. Add a reference to the missing assembly by browsingfor it on yourcomputer.
  4. 4. Answer: A89. You have a Microsoft ASP.NET Framework version 1.0 application. The applicationdoes not use anyfeatures that are deprecated in the Microsoft .NET Framework version 3.5. Theapplication runs onMicrosoft IIS 6.0.You need to configure the application to use the ASP.NET Framework version 3.5 withoutrecompiling theapplication.What should you do?A. Edit the ASP.NET runtime version in IIS 6.0.B. Edit the System.Web section handler version number in the machine.config file.C. Add the requiredRuntime configuration element to the Web.config file and set theversion attribute tov3.5.D. Add the supportedRuntime configuration element in the Web.config file and set theversion attribute tov3.5.
  5. 5. Answer: A91. You create a Microsoft ASP.NET Web application by using the Microsoft .NETFramework version 3.5.The application uses ASP.NET AJAX, and you plan to deploy it in a Web farmenvironment.You need to configure SessionState for the application.Which code fragment should you use?A. <sessionState mode="InProc"cookieless="UseCookies"/>B. <sessionState mode="InProc"cookieless="UseDeviceProfile"/>C. <sessionState mode="SQLServer"cookieless="false"sqlConnectionString="IntegratedSecurity=SSPI;data source=MySqlServer;"/>D. <sessionStatemode="SQLServer"cookieless="UseUri"sqlConnectionString="IntegratedSecurity=SSPI;data source=MySqlServer;"/>
  6. 6. Answer: C93. You create a Microsoft ASP.NET Web application by using the Microsoft .NETFramework version 3.5.You deploy the application on a Microsoft IIS 6.0 Web server. The server runs on a workerprocessisolation mode, and it hosts the .NET Framework version 1.1 Web applications.When you attempt to browse the application, the following error message is received:"It is not possible to run different versions of ASP.NET in the same IIS process. Pleaseuse the IISAdministration Tool to reconfigure your server to run the application in a separateprocess."You need to ensure that the following requirements are met:¡¤All the applications run on the server¡¤All the applications remain in process isolation mode¡¤All the applications do not change their configuration.Which two actions should you perform? (Each correct answer presents part of the solution.Choose two.)A. Create a new application pool and add the new application to the pool.B. Configure the IIS 6.0 to run the WWW service in the IIS 5.0 isolation mode.C. Configure the new application to use the .NET Framework version 2.0 in the IIS 6.0Manager.D. Set autoConfig="false" on the <processModel> property in the machine.config file.E. Disable the Recycle worker processes option in the Application Pool Properties dialogbox.
  7. 7. Answer: AC95. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.The application has a Web form file named MovieReviews.aspx.The MovieReviews.aspx file connects to a LinqDataSource DataSource namedLinqDataSource1 thathas a primary key named MovieID.The application has a DetailsView control named DetailsView1.The MovieReviews.aspx file contains the following code fragment. (Line numbers areincluded forreference only.)01 <asp:DetailsView ID="DetailsView1" runat="server"02 DataSourceID="LinqDataSource1"0304 />05 <Fields>06 <asp:BoundField DataField="MovieID" HeaderText="MovieID"07 InsertVisible="False"| English | Chinese | Japan | Korean | - 109 - Test Information Co., Ltd. All rights reserved.08 ReadOnly="True" SortExpression="MovieID" />09 <asp:BoundField DataField="Title" HeaderText="Title"10 SortExpression="Title" />11 <asp:BoundField DataField="Theater" HeaderText="Theater"12 SortExpression="Theater" />13 <asp:CommandField ShowDeleteButton="false"14 ShowEditButton="True" ShowInsertButton="True" />15 </Fields>16 </asp:DetailsView>You need to ensure that the users can insert and update content in the DetailsView1control. You alsoneed to prevent duplication of the link button controls for the Edit and New operations.Which code segment should you insert at line 03?A. AllowPaging="false"AutoGenerateRows="false"B. AllowPaging="true"AutoGenerateRows="false"DataKeyNames="MovieID"C. AllowPaging="true"AutoGenerateDeleteButton="false"AutoGenerateEditButton="true"AutoGenerateInsertButton="true"AutoGenerateRows="false"
  8. 8. D. AllowPaging="false"AutoGenerateDeleteButton="false"AutoGenerateEditButton="true"AutoGenerateInsertButton="true"AutoGenerateRows="false"DataKeyNames="MovieID"
  9. 9. Answer: B97. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You create a custom-templated server control.You need to ensure that the child controls of the server control are uniquely identifiedwithin the controlhierarchy of the page.Which interface should you implement?A. the ITemplatable interfaceB. the INamingContainer interfaceC. the IRequiresSessionState interfaceD. the IPostBackDataHandler interface
  10. 10. Answer: B99. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You write the following code fragment. (Line numbers are included for reference only.)01 <asp:RequiredFieldValidator02 ID="rfValidator1" runat="server"03 Display="Dynamic" ControlToValidate="TextBox1"0405 >0607 </asp:RequiredFieldValidator>0809 <asp:ValidationSummary DisplayMode="List"10 ID="ValidationSummary1" runat="server" />You need to ensure that the error message displayed in the validation control is alsodisplayed in thevalidation summary list.What should you do?A. Add the following code segment to line 06.Required text in TextBox1B. Add the following code segment to line 04.Text="Required text in TextBox1"C. Add the following code segment to line 04.| English | Chinese | Japan | Korean | - 113 - Test Information Co., Ltd. All rights reserved.ErrorMessage="Required text in TextBox1"D. Add the following code segment to line 04.Text="Required text in TextBox1" ErrorMessage="ValidationSummary1"
  11. 11. Answer: C101. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You plan to submit text that contains HTML code to a page in the application.You need to ensure that the HTML code can be submitted successfully without affectingother applicationsthat run on the Web server.What should you do?A. Add the following attribute to the @Page directive.EnableEventValidation="true"B. Add the following attribute to the @Page directive.ValidateRequest="true"C. Set the following value in the Web.config file.<system.web><pages validateRequest="false"/></system.web>D. Set the following value in the Machine.config file.<system.web><pages validateRequest="false"/></system.web>
  12. 12. Answer: C103. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5. Theapplication consumes an ASMX Web service.The Web service is hosted at the following URL.http://www.contoso.com/TemperatureService/Convert.asmxYou need to ensure that the client computers can communicate with the service as part ofthe<system.serviceModel> configuration.Which code fragment should you use?A. <client><endpointaddress="http: //www.contoso.com/TemperatureService/Convert.asmx"binding="wsHttpBinding" /</client>B. <client><endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx"binding="basicHttpBinding" /</client>C. <client><endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx"binding="ws2007HttpBinding" /| English | Chinese | Japan | Korean | - 116 - Test Information Co., Ltd. All rights reserved.</client>D. <client><endpoint address="http: //www.contoso.com/TemperatureService/Convert.asmx"binding="wsDualHttpBinding" /</client>
  13. 13. Answer: B105. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You create a file named movies.xml that contains the following code fragment.<Movies><Movie ID="1" Name="Movie1" Year="2006"><Desc Value="Movie desc"/></Movie><Movie ID="2" Name="Movie2" Year="2007"><Desc Value="Movie desc"/></Movie><Movie ID="3" Name="Movie3" Year="2008"><Desc Value="Movie desc"/></Movie></Movies>You add a Web form to the application.You write the following code segment in the Web form. (Line numbers are included forreference only.)01 <form runat="server">02 <asp:xmldatasource03 id="XmlDataSource1"04 runat="server"05 datafile="movies.xml" />0607 </form>You need to implement the XmlDataSource control to display the XML data in a TreeViewcontrol.Which code segment should you insert at line 06?A. <asp:TreeView ID="TreeView1" runat="server"DataSourceID="XmlDataSource1"><DataBindings><asp:TreeNodeBinding DataMember="Movie" Text="Name" /></DataBindings></asp:TreeView>B. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1"><DataBindings><asp:TreeNodeBinding DataMember="Movies" Text="Desc" /></DataBindings></asp:TreeView>C. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="MovDataSource1"><DataBindings><asp:TreeNodeBinding DataMember="Movie" Text="Name" /></DataBindings>
  14. 14. </asp:TreeView>D. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="MovDataSource1"><DataBindings><asp:TreeNodeBinding DataMember="Movies" Text="Desc" /></DataBindings></asp:TreeView>
  15. 15. Answer: A107. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You create a FormView control to access the results of a query. The query contains thefollowing fields:¡¤EmployeeI¡¤FirstNam¡¤LastNamThe user must be able to view and update the FirstName field.You need to define the control definition for the FirstName field in the FormView control.Which code fragment should you use?A. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text="<%#Bind("FirstName") %>" />B. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text="<%#Eval("FirstName") %>" />C. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text=<%#Bind("FirstName") %> />D. <asp:TextBox ID="EditFirstNameTextBox" RunAt="Server" Text=<%#Eval("FirstName") %> />
  16. 16. Answer: C109. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.The application contains a DataSourceControl named CategoriesDataSource that isbound to a MicrosoftSQL Server 2005 table. The CategoryName column is the primary key of the table.You write the following code fragment in a FormView control. (Line numbers are includedfor referenceonly.)01 <tr>02 <td align="right"><b>Category:</b></td>03 <td><asp:DropDownList ID="InsertCategoryDropDownList"0405 DataSourceID="CategoriesDataSource"06 DataTextField="CategoryName"07 DataValueField="CategoryID"08 RunAt="Server" />09 </td>10 </tr>You need to ensure that the changes made to the CategoryID field can be written to thedatabase.Which code fragment should you insert at line 04?A. SelectedValue=<%# Eval("CategoryID") %>B. SelectedValue=<%# Bind("CategoryID") %>C. SelectedValue=<%# Eval("CategoryName") %>D. SelectedValue=<%# Bind("CategoryName") %>
  17. 17. Answer: B111. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You create a Web page to display photos and captions. The caption of each photo in thedatabase can bemodified by using the application.You write the following code fragment.<asp:FormView DataSourceID="ObjectDataSource1" DataKeyNames="PhotoID"runat="server"><EditItemTemplate><asp:TextBox Text=<%# Bind("Caption") %> runat="server"/><asp:Button Text="Update" CommandName="Update"runat="server"/><asp:Button Text="Cancel" CommandName="Cancel"runat="server"/></EditItemTemplate><ItemTemplate><asp:Label Text=<%# Eval("Caption") %> runat="server" /><asp:Button Text="Edit" CommandName="Edit" runat="server"/></ItemTemplate></asp:FormView>When you access the Web page, the application throws an error.You need to ensure that the application successfully updates each caption and stores it inthe database.What should you do?A. Add the ID attribute to the Label control.B. Add the ID attribute to the TextBox control.C. Use the Bind function for the Label control instead of the Eval function.D. Use the Eval function for the TextBox control instead of the Bind function.
  18. 18. Answer: B113. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5. Theapplication contains two HTML pages named ErrorPage.htm and PageNotFound.htm.You need to ensure that the following requirements are met:¡¤When the userrequests a page that does not exist, the PageNotFound.htm page isdisplayed.¡¤When any other error occurs, the ErrorPage.htm page is displayedWhich section should you add to the Web.config file?A. <customErrors mode="Off" defaultRedirect="ErrorPage.htm"><error statusCode="404" redirect="PageNotFound.htm"/></customErrors>B. <customErrors mode="On" defaultRedirect="ErrorPage.htm"><error statusCode="404" redirect="PageNotFound.htm"/></customErrors>C. <customErrors mode="Off"><error statusCode="400" redirect="ErrorPage.htm"/><error statusCode="404" redirect="PageNotFound.htm"/></customErrors>D. <customErrors mode="On"><error statusCode="400" redirect="ErrorPage.htm"/><error statusCode="404" redirect="PageNotFound.htm"/></customErrors>
  19. 19. Answer: B115. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You plan to deploy the application to a test server.You need to ensure that during the initial request to the application, the code-behind filesfor the Webpages are compiled. You also need to optimize the performance of the application.Which code fragment should you add to the Web.config file?A. <compilation debug="true">B. <compilation debug="false">C. <compilation debug="true" batch="true">D. <compilation debug="false" batch="false">
  20. 20. Answer: B117. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You host the application on a server named ContosoTest that runs Microsoft IIS 6.0. Youset up remotedebugging on the ContosoTest server.You need to debug the application remotely from another computer named ContosoDev.What should you do?A. Attach Microsoft Visual Studio.NET to the w3wp.exe process.B. Attach Microsoft Visual Studio.NET to the inetinfo.exe process.C. Attach Microsoft Visual Studio.NET to the Msvsmon.exe process.D. Attach Microsoft Visual Studio.NET to the WebDev.WebServer.exe process.
  21. 21. Answer: A119. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.The application resides on a server named ContosoTest that runs Microsoft IIS 5.0.You use a computer named ContosoDev to log on to the Contoso.com domain with anaccount namedContosoUser.The ContosoTest and ContosoDev servers are members of the Contoso.com domain.You need to set up the appropriate permission for remote debugging.What should you do?A. Set the Remote Debugging Monitor to use Windows Authentication.B. Add the ContosoUser account to the domain Administrators group.C. Add the ContosoUser account to the local Administrators group on the ContosoTestserver.D. Change the ASP.NET worker process on the ContosoTest server to run as the localAdministratoraccount.
  22. 22. Answer: C121. You create a Microsoft ASP.NET AJAX application by using the Microsoft .NETFramework version3.5.You attach Microsoft Visual Studio 2008 debugger to the Microsoft Internet Explorerinstance to debug theJavaScript code in the AJAX application.You need to ensure that the application displays the details of the client-side object on thedebuggerconsole.What should you do?A. Use the Sys.Debug.fail method.B. Use the Sys.Debug.trace method.C. Use the Sys.Debug.assert method.D. Use the Sys.Debug.traceDump method.
  23. 23. Answer: D123. You create a Microsoft ASP.NET AJAX application by using the Microsoft .NETFramework version3.5.A JavaScript code segment in the AJAX application does not exhibit the desired behavior.MicrosoftInternet Explorer displays an error icon in the status bar but does not prompt you to debugthe script.You need to configure the Internet Explorer to prompt you to debug the script.Which two actions should you perform? (Each correct answer presents part of the solution.Choose two.)A. Clear the Disable Script Debugging (Other) check box.B. Clear the Disable Script Debugging (Internet Explorer) check box.C. Select the Show friendly HTTP error messages check box.D. Select the Enable third-party browser extensions check box.E. Select the Display a notification about every script error check box.
  24. 24. Answer: BE125. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You plan to capture the timing and performance information of the application.You need to ensure that the information is accessible only when the user is logged on tothe Web serverand not on individual Web pages.What should you add to the Web.config file?A. <compilation debug="true" />B. <compilation debug="false" urlLinePragmas="true" />C. <trace enabled="true" pageOutput="false" localOnly="true" />D. <trace enabled="true" writeToDiagnosticsTrace="true" pageOutput="true"localOnly="true" />
  25. 25. Answer: C127. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.When you access the application in a Web browser, you receive the following errormessage: "ServiceUnavailable".You need to access the application successfully.What should you do?A. Start Microsoft IIS 6.0.B. Start the Application pool.C. Set the .NET Framework version.D. Add the Web.config file for the application.
  26. 26. Answer: B129. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.| English | Chinese | Japan | Korean | - 132 - Test Information Co., Ltd. All rights reserved.The application is deployed on a Microsoft IIS 6.0 Web server by using the defaultASP.NET version 2.0application pool and Windows Authentication.The application contains functionality to upload files to a location on a different server.Users receive an access denied error message when they attempt to submit a file.You need to modify the Web.config file to resolve the error.Which code fragment should you use?A. <identity impersonate="true" />B. <anonymousIdentification enabled="true" />C. <roleManager enabled="true"defaultProvider="AspNetWindowsTokenRolePRovider"/>D. <authorization><allow users="*" /></authorization>
  27. 27. Answer: A131. You create a Microsoft ASP.NET Web application by using the Microsoft .NETFramework version3.5.When you review the application performance counters, you discover that there is anunexpectedincrease in the value of the Application Restarts counter.You need to identify the reasons for this increase.What are three possible reasons that could cause this increase? (Each correct answerpresents acomplete solution. Choose three.)A. Restart of the Microsoft IIS 6.0 host.B. Restart of the Microsoft Windows Server 2003 that hosts the Web application.C. Addition of a new assembly in the Bin directory of the application.D. Addition of a code segment that requires recompilation to the ASP.NET Webapplication.E. Enabling of HTTP compression in the Microsoft IIS 6.0 manager for the application.F. Modification to the Web.config file in the system.web section for debugging theapplication.
  28. 28. Answer: CDF133. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You plan to monitor the execution of the application at daily intervals.You need to modify the application configuration to enable WebEvent monitoring.What should you do?A. Enable the Debugging in the Web site option in the ASP.NET configuration settings.Modify theRequest Execution timeout to 10 seconds.Register the aspnet_perf.dll performance counter library by using the following command.B. regsvr32 C:WINDOWSMicrosoft.NETFrameworkv2.0.50727aspnet_perf.dllAdd the following code fragment to the <healthMonitoring> section of the Web.config fileof theapplication.C. <profiles><add name="Default" minInstances="1" maxLimit="Infinite" ?minInterval="00:00:10"custom="" /></profiles>Add the following code fragment to the <system.web> section of the Web.config file of theapplication.D. <healthMonitoring enabled="true" heartbeatInterval="10"><rules><add name="Heartbeats Default"eventName="Heartbeat"provider="EventLogProvider"profile="Critical"/></rules></healthMonitoring>
  29. 29. Answer: D135. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You add the following code fragment to the Web.config file of the application (Linenumbers are includedfor reference only).01 <healthMonitoring>02 <providers>| English | Chinese | Japan | Korean | - 136 - Test Information Co., Ltd. All rights reserved.03 <add name="EventLogProvider"04 type="System.Web.Management.EventLogWebEventProvider05 />06 <add name="WmiWebEventProvider"07 type="System.Web.Management.WmiWebEventProvider08 />09 </providers>10 <eventMappings>1112 </eventMappings>13 <rules>14 <add name="Security Rule" eventName="Security Event"15 provider="WmiWebEventProvider" />16 <add name="AppError Rule" eventName="AppError Event"17 provider="EventLogProvider" />18 </rules>19 </healthMonitoring>You need to configure Web Events to meet the following requirements:¡¤Securit-related Web Events are mapped to Microsoft Windows ManagementInstrumentation (WMI)events.¡¤ Web Event s caused by pr obl e ms wit h confi gur ati on or appli cati on code ar eloggedi nt o t he Wi ndowsApplication Event Log.Which code fragment should you insert at line 11?A. <add name="Security Event"type="System.Web.Management.WebAuditEvent"/><add name="AppErrorEvent"type="System.Web.Management.WebRequestErrorEvent"/>B. <add name="Security Event"type="System.Web.Management.WebAuditEvent"/><add name="AppError Event"type="System.Web.Management.WebErrorEvent"/>C. <add name="SecurityEvent"type="System.Web.Management.WebApplicationLifetimeEvent"/><add name="AppError
  30. 30. Event"type="System.Web.Management.WebRequestErrorEvent"/>| English | Chinese | Japan | Korean | - 137 - Test Information Co., Ltd. All rights reserved.D. <add name="SecurityEvent"type="System.Web.Management.WebApplicationLifetimeEvent"/><add name="AppError Event"type="System.Web.Management.WebErrorEvent"/>
  31. 31. Answer: B137. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You write the following code fragment. (Line numbers are included for reference only.)01 <asp:UpdatePanel ID="upnData" runat="server"02 ChildrenAsTriggers="false" UpdateMode="Conditional">03 <Triggers>0405 </Triggers>06 <ContentTemplate>07 <!-- more content here -->08 <asp:LinkButton ID="lbkLoad" runat="server" Text="Load"09 onclick="lbkLoad_Click" />10 <asp:Button ID="btnSubmit" runat="server" Text="Submit"11 Width="150px" onclick="btnSubmit_Click" />12 </ContentTemplate>13 </asp:UpdatePanel>14 <asp:Button ID="btnUpdate" runat="server" Text="Update"15 Width="150px" onclick="btnUpdate_Click" />| English | Chinese | Japan | Korean | - 139 - Test Information Co., Ltd. All rights reserved.You need to ensure that the requirements shown in the following table are met.What should you do?A. Set the value of the ChildrenAsTriggers property in line 02 to false.Add the following code fragment at line 04.<asp:AsyncPostBackTrigger ControlID="btnUpdate" /><asp:PostBackTrigger ControlID="btnSubmit" />B. Set the value of the ChildrenAsTriggers property in line 02 to false.Add the following code fragment at line 04.<asp:AsyncPostBackTrigger ControlID="btnSubmit" /><asp:PostBackTrigger ControlID="btnUpdate" />C. Set the value of the ChildrenAsTriggers property in line 02 to true.Add the following code fragment at line 04.<asp:AsyncPostBackTrigger ControlID="btnSubmit" /><asp:PostBackTrigger ControlID="btnUpdate" />D. Set the value of the ChildrenAsTriggers property in line 02 to true.Add the following code fragment at line 04.<asp:AsyncPostBackTrigger ControlID="btnUpdate" /><asp:PostBackTrigger ControlID="btnSubmit" />
  32. 32. Answer: D139. You create a Microsoft ASP.NET Web application by using the Microsoft .NETFramework version3.5.You add the following code fragment to an AJAX-enabled Web form. (Line numbers areincluded forreference only.)01 <asp:ScriptManager ID="scrMgr" runat="server" />02 <asp:UpdatePanel ID="updPanel" runat="server"03 UpdateMode="Conditional">04 <ContentTemplate>05 <asp:Label ID="lblTime" runat="server" />06 <asp:UpdatePanel ID="updInnerPanel"07 runat="server" UpdateMode="Conditional">08 <ContentTemplate>09 <asp:Timer ID="tmrTimer" runat="server"10 Interval="1000"11 OnTick="tmrTimer_Tick" />12 </ContentTemplate>1314 </asp:UpdatePanel>15 </ContentTemplate>1617 </asp:UpdatePanel>The tmrTimer_Tick event handler sets the Text property of the lblTime Label control to thecurrent time of| English | Chinese | Japan | Korean | - 142 - Test Information Co., Ltd. All rights reserved.the server.You need to configure the appropriate UpdatePanel control to ensure that the lblTimeLabel Control isproperly updated by the tmrTimer Timer control.What should you do?A. Set the UpdateMode="Always" attribute to the updInnerPanel UpdatePanel control inline 07.B. Set the ChildrenAsTriggers="false" attribute to the updPanel UpdatePanel control inline 02.C. Add the following code fragment to line 13.<Triggers><asp:PostBackTrigger ControlID="tmrTimer" /></Triggers>D. Add the following code fragment to line 16.
  33. 33. <Triggers><asp:AsyncPostBackTrigger ControlID="tmrTimer"EventName="Tick" /></Triggers>
  34. 34. Answer: D141. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You write the following code segment to create a client-script function. (Line numbers areincluded for| English | Chinese | Japan | Korean | - 144 - Test Information Co., Ltd. All rights reserved.reference only.)01 function updateLabelControl(labelId, newText) {02 var label = $find(labelId);03 label.innerHTML = newText;04 }The client script function uses ASP.NET AJAX and updates the text of any Label control inthe Web form.When you test the client script function, you discover that the Label controls are notupdated. You receivethe following JavaScript error message in the browser: "null is null or not an object."You need to resolve the error.What should you do?A. Replace line 03 with the following line of code.label.innerText = newText;B. Replace line 02 with the following line of code.var label = $get(labelId);C. Replace line 02 with the following line of code.var label = Sys.UI.DomElement.getElementById($get(labelId));D. Replace line 02 with the following line of code.var label = Sys.UI.DomElement.getElementById($find(labelId));
  35. 35. Answer: B143. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You create a Web form by using ASP.NET AJAX.You write the following client-script code fragment to handle the exceptions thrown fromasynchronouspostbacks. (Line numbers are included for reference only.)01 <script type="text/javascript">02 function pageLoad()03 {04 var pageMgr =05 Sys.WebForms.PageRequestManager.getInstance();0607 }0809 function errorHandler(sender, args)10 {1112 }| English | Chinese | Japan | Korean | - 146 - Test Information Co., Ltd. All rights reserved.13 </script>You need to ensure that the application performs the following tasks:¡¤Use a common clien-script function named errorHandler.¡¤Update a Label control that has an ID named lblEror with the error message.¡¤Prevent the browser from displaying any message box or Javascript errorWhat should you do?A. Insert the following code segment at line 06.pageMgr.add_endRequest(errorHandler);Insert the following code segment at line 11.if (args.get_error() != null) {$get(lblError).innerHTML = args.get_error().message;args.set_errorHandled(true);}B. Insert the following code segment at line 06.pageMgr.add_endRequest(errorHandler);Insert the following code segment at line 11.if (args.get_error() != null) {$get(lblError).innerHTML = args.get_error().message;}C. Insert the following code segment at line 06.pageMgr.add_pageLoaded(errorHandler);Insert the following code segment at line 11.
  36. 36. if (args.get_error() != null) {$get(lblError).innerHTML = args.get_error().message;args.set_errorHandled(true);}D. Insert the following code segment at line 06.pageMgr.add_pageLoaded(errorHandler);Insert the following code segment at line 11.| English | Chinese | Japan | Korean | - 147 - Test Information Co., Ltd. All rights reserved.if (args.get_error() != null) {$get(lblError).innerHTML = args.get_error().message;}
  37. 37. Answer: A145. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You create a Web form by using ASP.NET AJAX.The Web form contains the following code fragment. (Line numbers are included forreference only.)| English | Chinese | Japan | Korean | - 149 - Test Information Co., Ltd. All rights reserved.01 <script type="text/javascript">0203 Sys.Application.add_init(initComponents);0405 function initComponents() {0607 }0809 </script>1011 <asp:ScriptManager ID="ScriptManager1"12 runat="server" />13 <asp:TextBox runat="server" ID="TextBox1" />You need to create and initialize a client behavior named MyCustomBehavior by using theinitComponents function. You also need to ensure that MyCustomBehavior is attached tothe TextBox1Textbox control.Which code segment should you insert at line 06?A. $create(MyCustomBehavior, null, null, null, TextBox1);B. $create(MyCustomBehavior, null, null, null, $get(TextBox1));C. Sys.Component.create(MyCustomBehavior, TextBox1, null, null, null);D. Sys.Component.create(MyCustomBehavior, $get(TextBox1), null, null, null);
  38. 38. Answer: B147. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You create a login Web form by using the following code fragment.<asp:ScriptManager ID="ScriptManager1" runat="server" /><asp:TextBox runat="server" ID="txtUser" Width="200px" /><asp:TextBox runat="server" ID="txtPassword" Width="200px" /><asp:Button runat="server" ID="btnLogin" Text="Login" OnClientClick="login(); returnfalse;" />When a user clicks the btnLogin Button control, the login() client-side script is called toauthenticate theuser. The credentials provided in the TextBox controls are used to call the client-sidescript.You also add the following client-script code fragment in the Web form. (Line numbers areincluded for| English | Chinese | Japan | Korean | - 151 - Test Information Co., Ltd. All rights reserved.reference only.)01 <script type="text/javascript">02 function login() {03 var username = $get(txtUser).value;04 var password = $get(txtPassword).value;0506 // authentication logic.07 }08 function onLoginCompleted(validCredentials, userContext,09 methodName)10 {11 // notify user on authentication result.12 }1314 function onLoginFailed(error, userContext, methodName)15 {16 // notify user on authentication exception.17 }18 </script>The ASP.NET application is configured to use Forms Authentication. The ASP.NET AJAXauthenticationservice is activated in the Web.config file.You need to ensure that the following workflow is maintained:¡¤On successful authentication, the onLoginCompleted clien-script function is called tonotify the user.
  39. 39. ¡¤On failure of authentication, the onLoginFailed clien-script function is called to displayan error message.Which code segment should you insert at line 06?A. var auth = Sys.Services.AuthenticationService;auth.login(username, password, false,null,null,onLoginCompleted, onLoginFailed, null);B. var auth =Sys.Services.AuthenticationService;auth.set_defaultFailedCallback(onLoginFailed);var validCredentials = auth.login(username, password, false, null, null, null, null, null);if (validCredentials)onLoginCompleted(true, null, null);elseonLoginCompleted(false, null, null);C. var auth = Sys.Services.AuthenticationService;auth.set_defaultLoginCompletedCallback(onLoginCompleted);try {auth.login(username, password, false, null, null,null, null, null);}catch (err) {onLoginFailed(err, null, null);}D. var auth = Sys.Services.AuthenticationService;try {var validCredentials = auth.login(username, password, false, null, null, null, null, null);if (validCredentials)onLoginCompleted(true, null, null);elseonLoginCompleted(false, null, null);}catch (err) {onLoginFailed(err, null, null);}
  40. 40. Answer: A149. You create a Microsoft ASP.NET Web application by using the Microsoft .NETFramework version 3.5.The application contains the following device filter element in the Web.config file.<filter name="isHtml" compare="PreferredRenderingType"argument="html32" />The application contains a Web page that has the following image control. (Line numbersare included forreference only.)01 <mobile:Image ID="imgCtrl" Runat="server">0203 </mobile:Image>You need to ensure that the following conditions are met:¡¤The imgCtrl Image control displays he highRes.jpg file if the Web browser supportshtml.¡¤The imgCtrl Image control displays lowRes.gif if the Web browser does not support htmlWhich DeviceSpecific element should you insert at line 02?A. <DeviceSpecific><Choice Filter="isHtml" ImageUrl="highRes.jpg" /><Choice ImageUrl="lowRes.gif" /></DeviceSpecific>B. <DeviceSpecific><Choice Filter="isHtml" Argument="false" ImageUrl="highRes.jpg" /><Choice Filter="isHtml" Argument="true"ImageUrl="lowRes.gif" /></DeviceSpecific>C. <DeviceSpecific><Choice Filter="PreferredRenderingType" ImageUrl="highRes.jpg" /><Choice ImageUrl="lowRes.gif" /></DeviceSpecific>| English | Chinese | Japan | Korean | - 156 - Test Information Co., Ltd. All rights reserved.D. <DeviceSpecific><Choice Filter="PreferredRenderingType" Argument="false"ImageUrl="highRes.jpg" /><Choice Filter="PreferredRenderingType" Argument="true"ImageUrl="lowRes.gif" /></DeviceSpecific>
  41. 41. Answer: A151. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5. Theapplication contains a mobile Web page.You add the following StyleSheet control to the Web page.<mobile:StyleSheet id="MyStyleSheet" runat="server"><mobile:Style Name="StyleA" Font-Name="Arial" Font-Bold="True"Wrapping="NoWrap"></mobile:Style></mobile:StyleSheet>You need to add a Label control named MyLabel that uses the defined style in theMyStyleSheetStyleSheet control.Which markup should you use?A. <mobile:Label ID="MyLabel" Runat="server"StyleReference="MyStyleSheet:StyleA"></mobile:Label>B. <mobile:Label ID="MyLabel" Runat="server" StyleReference="StyleA"></mobile:Label>C. <mobile:Label ID="MyLabel" Runat="server"><DeviceSpecific ID="DSpec" Runat="server">| English | Chinese | Japan | Korean | - 158 - Test Information Co., Ltd. All rights reserved.<Choice Filter="MyStyleSheet" StyleReference="StyleA" /></DeviceSpecific></mobile:Label>D. <mobile:Label ID="MyLabel" Runat="server"><DeviceSpecific ID="DSpec" Runat="server"><Choice Argument="StyleA" StyleReference="MyStyleSheet" /></DeviceSpecific></mobile:Label>
  42. 42. Answer: A153. You modify an existing Microsoft ASP.NET application by using the Microsoft .NETFrameworkversion 3.5.You add a theme to the ASP.NET application.You need to apply the theme to override any settings of individual controls.What should you do?A. In the Web.config file of the application, set the Theme attribute of the pages element tothe name ofthe theme.B. In the Web.config file of the application, set the StyleSheetTheme attribute of the pageselement to thename of the theme.C. Add a master page to the application. In the @Master directive, set the Theme attributeto the name ofthe theme.D. Add a master page to the application. In the @Master directive, set theStyleSheetTheme attribute tothe name of the theme.
  43. 43. Answer: A155. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.The application uses 10 themes and allows the users to select their themes for the Webpage.When a user returns to the application, the theme selected by the user is used to displaypages in theapplication. This occurs even if the user returns to log on at a later date or from a differentclient computer.The application runs on different storage types and in different environments.You need to store the themes that are selected by the users and retrieve the requiredtheme.What should you do?A. ¡¤Use the Application object to store the name of the theme tha is selected by the user.B. ¡¤Retrieve the required theme name from the Application object each time the uservisits a pageC. ¡¤Use the Session object to store the name of the theme that is selected by the user.D. ¡¤Retrieve the required theme name fro the Session object each time the user visits apage.E. ¡¤Use the Response.Cookies collection to store the name of the theme that is selectedby the user.F. ¡¤Uset he Request. Cooki es coll ecti ont oi dentif yt het he met hat was sel ect ed bythe user eachti mtheuser visits a page.G. ¡¤Add a setting for the theme to the profile section of the Web.config file of theapplication.H. ¡¤Use the Profile.Theme string theme to store the name of the theme that is selectedby the user.I. ¡¤Retrieve the required them name each time the user visits a page.
  44. 44. Answer: D157. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.The application must redirect the original URL to a different ASPX page.You need to ensure that the users cannot view the original URL after the page is executed.You also needto ensure that each page execution requires only one request from the client browser.What should you do?A. Use the Server.Transfer method to transfer execution to the correct ASPX page.B. Use the Response.Redirect method to transfer execution to the correct ASPX page.C. Use the HttpContext.Current.RewritePath method to transfer execution to the correctASPX page.D. Add the Location: new URL value to the Response.Headers collection. Call theResponse.End()statement. Send the header to the client computer to transfer execution to the correctASPX page.
  45. 45. Answer: C159. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.The application uses Session objects. You are modifying the application to run on a Webfarm.You need to ensure that the application can access the Session objects from all theservers in the Webfarm. You also need to ensure that when any server in the Web farm restarts or stopsresponding, theSession objects are not lost.What should you do?A. Use the InProc Session Management mode to store session data in the ASP.NETworker process.B. Use the SQLServer Session Management mode to store session data in a commonMicrosoft SQLServer 2005 database.C. Use the SQLServer Session Management mode to store session data in an individualdatabase foreach Web server in the Web farm.D. Use the StateServer Session Management mode to store session data in a commonState Serverprocess on a Web server in the Web farm.
  46. 46. Answer: B161. You create a Microsoft ASP.NET Web application by using the Microsoft .NETFramework version3.5.The Web site uses C# as the programming language. You plan to add a code file writtenin MicrosoftVB.NET to the application. This code segment will not be converted to C#.You add the following code fragment to the Web.config file of the application.<compilation debug="false"><codeSubDirectories><add directoryName="VBCode"/></codeSubDirectories></compilation>You need to ensure that the following requirements are met:¡¤The existing VB.NET file can be used in the Web application¡¤The file can be modified and compiled at run timeWhat should you do?A. ¡¤Create a new folder named VBCode at the root of the application| English | Chinese | Japan | Korean | - 164 - Test Information Co., Ltd. All rights reserved.¡¤Place the VB.NET code file n this new folder.B. ¡¤Create a new folder named VBCode inside the App_Code folder of the application¡¤Place the VB.NET code file in this new folderC. ¡¤Create a new class library that uses VB.NET as the programming language¡¤Add the VB.NET code ile to the class library.¡¤Add a reference to the class library in the applicationD. ¡¤Cr eat e a new Mi cr osoft Wi ndows Co mmuni cati on Foundati on ( WCF) ser vi cepr oj ect t hat usesVB.NET as the programming language.¡¤Expose the VB.NET code functionalitythrough the WCF service.¡¤Add a service reference to the WCF service project in the application
  47. 47. Answer: B163. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.The application uses a set of general-purpose utility classes that implement business logic.These classesare modified frequently.You need to ensure that the application is recompiled automatically when a utility class ismodified.What should you do?A. ¡¤Create the Web application by using a Microsoft Visual Studio ASP.NET Web site¡¤Add the utility classes to the App_Code subfolder of the Web applicationB. ¡¤Create the Web aplication by using a Microsoft Visual Studio ASP.NET WebApplication project.¡¤Add the utility classes to the App_Code subfolder of the Web applicationC. ¡¤Create the Web application by using a Microsoft Visual Studio ASP.NET Web site¡¤Add the utilty classes to the root folder of the Web application.D. ¡¤Create the Web application by using a Microsoft Visual Studio ASP.NET WebApplication project¡¤Add the utility classes to the root folder of the Web application
  48. 48. Answer: A165. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You add a Web page named HomePage.aspx in the application. The Web page containsdifferent controls.You add a newly created custom control named CachedControl to the Web page.You need to ensure that the following requirements are met:¡¤The custom control state remains static for one minute¡¤The custom control settings do not affect the cache settings of other elements in theWeb pageWhat should you do?A. Add the following code fragment to the Web.config file of the solution.<caching><outputCacheSettings><outputCacheProfiles><addname="CachedProfileSet"varyByControl="CachedControl"duration="60" /></outputCacheProfiles></outputCacheSettings></caching>B. Add the following code fragment to the Web.config file of the solution.<caching><outputCacheSettings><outputCacheProfiles><addname="CachedProfileSet"varyByParam="CachedControl"duration="60" /></outputCacheProfiles></outputCacheSettings></caching>C. Add a class named ProfileCache that inherits from the ConfigurationSection class totheHomePage.aspx.cs page.Add the following to the Web.config file of the solution.<ProfileCache profile="CachedProfileSet" varyByControl="CachedControl"duration="60"></ProfileCache><caching><outputCache enableOutputCache="true"/>
  49. 49. </caching>D. Add a class named ProfileCache that inherits from the ConfigurationSection class totheHomePage.aspx.cs page.Add the following code fragment to the Web.config file of the solution.<ProfileCache profile="CachedProfileSet" varyByParam="CachedControl" duration="60"></ProfileCache><caching><outputCache enableOutputCache="true"/></caching>
  50. 50. Answer: A79. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You create a class that implements the IHttpHandler interface. You implement theProcessRequestmethod by using the following code segment. (Line numbers are included for referenceonly.)01 public void ProcessRequest(HttpContext ctx) {0203 }You need to ensure that the image named Alert.jpg is displayed in the browser when thehandler isrequested.Which code segment should you insert at line 02?A. StreamReader sr = newStreamReader(File.OpenRead(ctx.Server.MapPath("Alert.jpg")));ctx.Response.Pics(sr.ReadToEnd());sr.Close();B. StreamReader sr = newStreamReader(File.OpenRead(ctx.Server.MapPath("Alert.jpg")));ctx.Response.Pics("image/jpg");ctx.Response.TransmitFile(sr.ReadToEnd());sr.Close();C. ctx.Response.ContentType = "image/jpg";FileStream fs = File.OpenRead(ctx.Server.MapPath("Alert.jpg"));int b;while ((b = fs.ReadByte()) != -1) {ctx.Response.OutputStream.WriteByte((byte)b);}| English | Chinese | Japan | Korean | - 99 - Test Information Co., Ltd. All rights reserved.fs.Close();D. ctx.Response.TransmitFile("image/jpg");FileStream fs = File.OpenRead(ctx.Server.MapPath("Alert.jpg"));int b;while ((b = fs.ReadByte()) != -1) {ctx.Response.OutputStream.WriteByte((byte)b);}fs.Close();
  51. 51. Answer: C77. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You write the following code segment to create a class named MultimediaDownloader thatimplements the| English | Chinese | Japan | Korean | - 96 - Test Information Co., Ltd. All rights reserved.IHttpHandler interface.namespace Contoso.Web.UI{public class MultimediaDownloader : IHttpHandler{...}}The MultimediaDownloader class performs the following tasks:¡¤It returns the content of the multimedia files from the Web server¡¤It processes requests for the files that have the .media file extensionThe .media file extension is mapped to the aspnet_isapi.dll file in Microsoft IIS 6.0.You need to configure the MultimediaDownloader class in the Web.config file of theapplication.Which code fragment should you use?A. <httpHandlers><add verb="*.media" path="*" validate="false"type="Contoso.Web.UI.MultimediaDownloader" /></httpHandlers>B. <httpHandlers><add verb="HEAD" path="*.media" validate="true"type="Contoso.Web.UI.MultimediaDownloader" /></httpHandlers>C. <httpHandlers><add verb="*" path="*.media" validate="false"type="Contoso.Web.UI.MultimediaDownloader" /></httpHandlers>D. <httpHandlers><add verb="GET,POST" path="*" validate="true"type="Contoso.Web.UI.MultimediaDownloader" />| English | Chinese | Japan | Korean | - 97 - Test Information Co., Ltd. All rights reserved.</httpHandlers>
  52. 52. Answer: C75. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You create a Web page named enterName.aspx. The Web page contains a TextBoxcontrol namedtxtName. The Web page cross posts to a page named displayName.aspx that contains aLabel controlnamed lblName.You need to ensure that the lblName Label control displays the text that was entered inthe txtNameTextBox control.Which code segment should you use?A. lblName.Text = Request.QueryString["txtName"];B. TextBox txtName = FindControl("txtName") as TextBox;lblName.Text = txtName.Text;C. TextBox txtName = Parent.FindControl("txtName") as TextBox;lblName.Text = txtName.Text;D. TextBox txtName = PreviousPage.FindControl("txtName") as TextBox;lblName.Text = txtName.Text;
  53. 53. Answer: D73. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5. Theapplication runs on Microsoft IIS 6.0.You create a page named oldPage.aspx.You need to ensure that the following requirements are met when a user attempts toaccess the page:¡¤The browser diplays the URL of the oldPage.aspx page.¡¤The browser displays the page named newPage.aspxWhich code segment should you use?A. Server.Transfer("newPage.aspx");B. Response.Redirect("newPage.aspx");C. if (Request.Url.UserEscaped) {Server.TransferRequest("newPage.aspx");}else {Response.Redirect("newPage.aspx", true);}D. if (Request.Url.UserEscaped) {Response.RedirectLocation = "oldPage.aspx";Response.Redirect("newPage.aspx", true);}else {Response.Redirect("newPage.aspx");}| English | Chinese | Japan | Korean | - 94 - Test Information Co., Ltd. All rights reserved.
  54. 54. Answer: A71. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You create a page that contains the following code fragment.| English | Chinese | Japan | Korean | - 92 - Test Information Co., Ltd. All rights reserved.<asp:ListBox ID="lstLanguages"AutoPostBack="true" runat="server" />You write the following code segment in the code-behind file for the page.void BindData(object sender, EventArgs e) {lstLanguages.DataSource =CultureInfo.GetCultures(CultureTypes.AllCultures);lstLanguages.DataTextField = "EnglishName";lstLanguages.DataBind();}You need to ensure that the lstLanguages ListBox control maintains the selection of theuser duringpostback.Which line of code should you insert in the constructor of the page?A. this.Init += new EventHandler(BindData);B. this.PreRender += new EventHandler(BindData);C. lstLanguages.PreRender += new EventHandler(BindData);D. lstLanguages.SelectedIndexChanged += new EventHandler(BindData);
  55. 55. Answer: A69. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You create a page that contains the following control.<asp:Calendar EnableViewState="false"ID="calBegin" runat="server" />You write the following code segment in the code-behind file for the page.void LoadDate(object sender, EventArgs e) {if (IsPostBack) {calBegin.SelectedDate =(DateTime)ViewState["date"];}}void SaveDate(object sender, EventArgs e) {ViewState["date"] = calBegin.SelectedDate;}You need to ensure that the calBegin Calendar control maintains the selected date.Which code segment should you insert in the constructor of the page?A. this.Load += new EventHandler(LoadDate);this.Unload += new EventHandler(SaveDate);B. this.Init += new EventHandler(LoadDate);this.Unload += new EventHandler(SaveDate);C. this.Init += new EventHandler(LoadDate);this.PreRender += new EventHandler(SaveDate);D. this.Load += new EventHandler(LoadDate);this.PreRender += new EventHandler(SaveDate);| English | Chinese | Japan | Korean | - 91 - Test Information Co., Ltd. All rights reserved.
  56. 56. Answer: D67. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You create a Web page that has a GridView control named GridView1. The GridView1control displays the| English | Chinese | Japan | Korean | - 88 - Test Information Co., Ltd. All rights reserved.data from a database named Region and a table named Location.You write the following code segment to populate the GridView1 control. (Line numbersare included forreference only.)01 protected void Page_Load(object sender, EventArgs e)02 {03 string connstr;0405 SqlDependency.Start(connstr);06 using (SqlConnection connection =07 new SqlConnection(connstr))08 {09 SqlCommand sqlcmd = new SqlCommand();10 DateTime expires = DateTime.Now.AddMinutes(30);11 SqlCacheDependency dependency = new12 SqlCacheDependency("Region", "Location");13 Response.Cache.SetExpires(expires);14 Response.Cache.SetValidUntilExpires(true);15 Response.AddCacheDependency(dependency);1617 sqlcmd.Connection = connection;18 GridView1.DataSource = sqlcmd.ExecuteReader();19 GridView1.DataBind();20 }21 }You need to ensure that the proxy servers can cache the content of the GridView1 control.Which code segment should you insert at line 16?A. Response.Cache.SetCacheability(HttpCacheability.Private);B. Response.Cache.SetCacheability(HttpCacheability.Public);C. Response.Cache.SetCacheability(HttpCacheability.Server);| English | Chinese | Japan | Korean | - 89 - Test Information Co., Ltd. All rights reserved.D. Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate);
  57. 57. Answer: B65. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You create a custom Web user control named SharedControl. The control will becompiled as a library.You write the following code segment for the SharedControl control. (Line numbers areincluded forreference only.)01 protected override void OnInit(EventArgs e)02 {03 base.OnInit(e);0405 }All the master pages in the ASP.NET application contain the following directive.<%@ Master Language="C#" EnableViewState="false" %>You need to ensure that the state of the SharedControl control can persist on the pagesthat reference a| English | Chinese | Japan | Korean | - 87 - Test Information Co., Ltd. All rights reserved.master page.Which code segment should you insert at line 04?A. Page.RegisterRequiresPostBack(this);B. Page.RegisterRequiresControlState(this);C. Page.UnregisterRequiresControlState(this);D. Page.RegisterStartupScript("SharedControl","server");
  58. 58. Answer: B63. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You create a Web page named Default.aspx in the root of the application. You add anImageResources.resx resource file in the App_GlobalResources folder. TheImageResources.resx filecontains a localized resource named LogoImageUrl.You need to retrieve the value of LogoImageUrl.Which code segment should you use?A. string logoImageUrl = (string)GetLocalResource("LogoImageUrl");B. string logoImageUrl = (string)GetGlobalResource("Default", "LogoImageUrl");C. string logoImageUrl = (string)GetGlobalResource("ImageResources","LogoImageUrl");| English | Chinese | Japan | Korean | - 86 - Test Information Co., Ltd. All rights reserved.D. string logoImageUrl = (string)GetLocalResource("ImageResources.LogoImageUrl");
  59. 59. Answer: C61. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.The application allows users to post comments to a page that can be viewed by otherusers.You add a SqlDataSource control named SqlDS1. You write the following code segment.(Line numbersare included for reference only.)01 private void SaveComment()02 {03 string ipaddr;0405 SqlDS1.InsertParameters["IPAddress"].DefaultValue = ipaddr;06 ...07 SqlDS1.Insert();08 }You need to ensure that the IP Address of each user who posts a comment is capturedalong with theusers comment.Which code segment should you insert at line 04?A. ipaddr = Server["REMOTE_ADDR"].ToString();B. ipaddr = Session["REMOTE_ADDR"].ToString();C. ipaddr = Application["REMOTE_ADDR"].ToString();D. ipaddr = Request.ServerVariables["REMOTE_ADDR"].ToString();
  60. 60. Answer: D59. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.All the content pages in the application use a single master page. The master page uses astaticnavigation menu to browse the site.You need to ensure that the content pages can optionally replace the static navigationmenu with theirown menu controls.What should you do?A. ¡¤Add the following code fragment to the master page<asp:PlaceHolder ID="MenuPlaceHolder" runat="server"><div id="menu"><!-- Menu code here --></div></asp:PlaceHolder>B. ¡¤Add the following code segment to the Page_Load event of the content pagePlaceHolder placeHolder =Page.Master.FindControl("MenuPlaceHolder") as PlaceHolder;Menu menuControl = new Menu();placeHolder.Controls.Add(menuControl);C. ¡¤Add the following code fragment to the master page<asp:ContentPlaceHolder ID="MenuPlaceHolder" runat="server"><!-- Menu code here --></asp:ContentPlaceHolder>D. ¡¤Add the following code fragment to the content page<asp:Content ContentPlaceHolderID="MenuPlaceHolder">| English | Chinese | Japan | Korean | - 82 - Test Information Co., Ltd. All rights reserved.<asp:menu ID="menuControl" runat="server"> </asp: menu</asp:Content>E. ¡¤Add the following code fragment to the master page<asp:ContentPlaceHolder ID="MenuPlaceHolder" runat="server"><!-- Menu code here --></asp:ContentPlaceHolder>F. ¡¤Add the following code segment to the Page_Load event of the content pageContentPlaceHolder placeHolder =Page.Master.FindControl("MenuPlaceHolder") as ContentPlaceHolder;Menu menuControl = new Menu();placeHolder.Controls.Add(menuControl);G. ¡¤Add the following code fragment to the master page<asp:PlaceHolder ID="MenuPlaceHolder" runat="server">
  61. 61. <!-- Menu code here --></asp:PlaceHolder>H. ¡¤Add the following code fragment to the content page<asp:Content PlaceHolderID="MenuPlaceHolder"><asp:menu ID="menuControl" runat="server"> </asp: menu</asp:Content>
  62. 62. Answer: B57. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5. Theapplication has a mobile Web form that contains the following ObjectList control.<mobile:ObjectList ID="ObjectListCtrl" OnItemCommand="ObjectListCtrl_ItemCommand"Runat="server"><Command Name="CmdDisplayDetails" Text="Details" /><Command Name="CmdRemove" Text="Remove" /></mobile:ObjectList>You create an event handler named ObjectListCtrl_ItemCommand.You need to ensure that the ObjectListCtrl_ItemCommand handler detects the selection oftheCmdDisplayDetails item.Which code segment should you write?A. public void ObjectListCtrl_ItemCommand(object sender, ObjectListCommandEventArgs e){if (e.CommandName == "CmdDisplayDetails")| English | Chinese | Japan | Korean | - 79 - Test Information Co., Ltd. All rights reserved.{}}B. public void ObjectListCtrl_ItemCommand(object sender, ObjectListCommandEventArgs e){if (e.CommandArgument.ToString() == "CmdDisplayDetails"){}}C. public void ObjectListCtrl_ItemCommand(object sender, ObjectListCommandEventArgs e){ObjectListCommand cmd = sender as ObjectListCommand;if (cmd.Name == "CmdDisplayDetails"){}}D. public void ObjectListCtrl_ItemCommand(object sender, ObjectListCommandEventArgs e){ObjectListCommand cmd = e.CommandSource as ObjectListCommand;
  63. 63. if (cmd.Name == "CmdDisplayDetails"){}}
  64. 64. Answer: A55. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.The application contains the following code segment.public class CapabilityEvaluator{public static bool ChkScreenSize(System.Web.Mobile.MobileCapabilities cap,String arg){int screenSize = cap.ScreenCharactersWidth *cap.ScreenCharactersHeight;return screenSize < int.Parse(arg);}| English | Chinese | Japan | Korean | - 76 - Test Information Co., Ltd. All rights reserved.}You add the following device filter element to the Web.config file.<filter name="FltrScreenSize"type="MyWebApp.CapabilityEvaluator,MyWebApp"method="ChkScreenSize" />You need to write a code segment to verify whether the size of the device display is lessthan 80characters.Which code segment should you use?A. MobileCapabilities currentMobile;currentMobile = Request.Browser as MobileCapabilities;if(currentMobile.HasCapability("FltrScreenSize","80")){}B. MobileCapabilities currentMobile;currentMobile = Request.Browser as MobileCapabilities;if(currentMobile.HasCapability("FltrScreenSize","").ToString()=="80"){}C. MobileCapabilities currentMobile;currentMobile = Request.Browser as MobileCapabilities;if (currentMobile.HasCapability("CapabilityEvaluator.ChkScreenSize", "80")){}D. MobileCapabilities currentMobile;
  65. 65. currentMobile = Request.Browser as MobileCapabilities;if (currentMobile.HasCapability("CapabilityEvaluator.ChkScreenSize", "").ToString()=="80")| English | Chinese | Japan | Korean | - 77 - Test Information Co., Ltd. All rights reserved.{}
  66. 66. Answer: A53. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You create an AJAX-enabled Web form by using the following code fragment.<asp:ScriptManager ID="scrMgr" runat="server" /><asp:UpdatePanel runat="server" ID="updFirstPanel"UpdateMode="Conditional"><ContentTemplate><asp:TextBox runat="server" ID="txtInfo" />| English | Chinese | Japan | Korean | - 73 - Test Information Co., Ltd. All rights reserved.<asp:Button runat="server" ID="btnSubmit"Text="Submit" /></ContentTemplate></asp:UpdatePanel><asp:UpdatePanel runat="server" ID="updSecondPanel"UpdateMode="Conditional"><ContentTemplate>...</ContentTemplate></asp:UpdatePanel>When the updFirstPanel UpdatePanel control is updated, a dynamic client script isregistered.You write the following code segment in the code-behind file of the Web form. (Linenumbers are includedfor reference only.)01 protected void Page_Load(object sender, EventArgs e)02 {03 if(IsPostBack)04 {05 string generatedScript = ScriptGenerator.GenerateScript();0607 }08 }You need to ensure that the client-script code is registered only when an asynchronouspostback is issuedon the updFirstPanel UpdatePanel control.Which code segment should you insert at line 06?A. ClientScript.RegisterClientScriptBlock(typeof(TextBox),"txtInfo_Script", generatedScript);B. ScriptManager.RegisterClientScriptBlock(this, typeof(Page),"txtInfo_Script", generatedScript, false);C. ClientScript.RegisterClientScriptBlock(typeof(Page),
  67. 67. | English | Chinese | Japan | Korean | - 74 - Test Information Co., Ltd. All rights reserved."txtInfo_Script", generatedScript);D. ScriptManager.RegisterClientScriptBlock(txtInfo,typeof(TextBox), "txtInfo_Script", generatedScript, false);
  68. 68. Answer: D51. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You write the following code segment to create a JavaScript file namedCalculatorScript.js.function divide(a, b) {if (b == 0) {var errorMsg = Messages.DivideByZero;alert(errorMsg);return null;| English | Chinese | Japan | Korean | - 71 - Test Information Co., Ltd. All rights reserved.}return a/b;}You embed the CalculatorScript.js file as a resource in a Class Library project. Thenamespace for thisproject is Calculator.Resources. The JavaScript function retrieves messages from aresource file namedMessageResources.resx by using the JavaScript Messages object.You add an AJAX Web form in the ASP.NET application. You reference the Class Libraryin the application.You add an ASP.NET AJAX ScriptReference element to the AJAX Web form.You need to ensure that the JavaScript function can access the error messages that aredefined in theresource file.Which code segment should you add in the AssemblyInfo.cs file?A. [assembly: ScriptResource("CalculatorScript", "MessageResources", "Messages")]B. [assembly: ScriptResource("CalculatorScript.js", "MessageResources.resx", "Messages")]C. [assembly: ScriptResource("Calculator.Resources.CalculatorScript.js", "Calculator.Resources.MessageResources","Messages")]D. [assembly: ScriptResource("Calculator.Resources.CalculatorScript","Calculator.Resources.MessageResources.resx","Messages")]
  69. 69. Answer: C49. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You create a Web form in the application by using the following code fragment. (Linenumbers areincluded for reference only.)01 <script runat="server">02 protected void Button_Handler(object sender, EventArgs e)03 {04 // some long-processing operation.05 }| English | Chinese | Japan | Korean | - 66 - Test Information Co., Ltd. All rights reserved.06 </script>07 <div>08 <asp:ScriptManager ID="defaultScriptManager"09 runat="server" />1011 <asp:UpdatePanel ID="defaultPanel"12 UpdateMode="Conditional" runat="server">13 <ContentTemplate>14 <!-- more content here -->15 <asp:Button ID="btnSubmit" runat="server"16 Text="Submit" OnClick="Button_Handler" />17 </ContentTemplate>18 </asp:UpdatePanel>19 </div>You plan to create a client-side script code by using ASP.NET AJAX.You need to ensure that while a request is being processed, any subsequent Click eventson thebtnSubmit Button control are suppressed.Which code fragment should you insert at line 10?A. <script type="text/javascript" language="javascript">var rm = Sys.WebForms.PageRequestManager.getInstance();rm.add_beginRequest(checkPostback);function checkPostback(sender, args) {if (rm.get_isInAsyncPostBack() &&args.get_postBackElement().id == btnSubmit) {rm.abortPostBack();alert(A previous request is still in progress.);}}</script>| English | Chinese | Japan | Korean | - 67 - Test Information Co., Ltd. All rights reserved.
  70. 70. B. <script type="text/javascript" language="javascript">var rm = Sys.WebForms.PageRequestManager.getInstance();rm.add_initializeRequest(checkPostback);function checkPostback(sender, args) {if (rm.get_isInAsyncPostBack() &&args.get_postBackElement().id == btnSubmit) {rm.abortPostBack();alert(A previous request is still in progress.);}}</script>C. <script type="text/javascript" language="javascript">var rm = Sys.WebForms.PageRequestManager.getInstance();rm.add_initializeRequest(checkPostback);function checkPostback(sender, args) {if (rm.get_isInAsyncPostBack() &&args.get_postBackElement().id == btnSubmit) {args.set_cancel(true);alert(A previous request is still in progress.);}}</script>D. <script type="text/javascript" language="javascript">var rm = Sys.WebForms.PageRequestManager.getInstance();rm.add_beginRequest(checkPostback);function checkPostback(sender, args) {var request = args.get_request();if (rm.get_isInAsyncPostBack() &&args.get_postBackElement().id == btnSubmit) {| English | Chinese | Japan | Korean | - 68 - Test Information Co., Ltd. All rights reserved.request.completed(new Sys.CancelEventArgs());alert(A previous request is still in progress.);}}</script>
  71. 71. Answer: C47. You create a Microsoft ASP.NET application by using the Microsoft .NET Frameworkversion 3.5.You write the following code fragment.<asp:ScriptManager ID="ScriptManager1" runat="server" /><asp:UpdatePanel ID="updateLabels" runat="server"UpdateMode="Conditional"><ContentTemplate><asp:Label ID="Label1" runat="server" /><asp:Label ID="Label2" runat="server" /><asp:Button ID="btnSubmit" runat="server" Text="Submit"onclick="btnSubmit_Click" />| English | Chinese | Japan | Korean | - 63 - Test Information Co., Ltd. All rights reserved.</ContentTemplate></asp:UpdatePanel><asp:Label id="Label3" runat="server" />You need to ensure that when you click the btnSubmit Button control, each Label controlvalue isasynchronously updatable.Which code segment should you use?A. protected void btnSubmit_Click(object sender, EventArgs e){Label1.Text = "Label1 updated value";Label2.Text = "Label2 updated value";Label3.Text = "Label3 updated value";}B. protected void btnSubmit_Click(object sender, EventArgs e){Label1.Text = "Label1 updated value";Label2.Text = "Label2 updated value";ScriptManager1.RegisterDataItem(Label3, "Label3 updated value");}C. protected void btnSubmit_Click(object sender, EventArgs e){ScriptManager1.RegisterDataItem(Label1, "Label1 updated value");ScriptManager1.RegisterDataItem(Label2, "Label2 updated value");Label3.Text = "Label3 updated value";}D. protected void btnSubmit_Click(object sender, EventArgs e){Label1.Text = "Label1 updated value";Label2.Text = "Label2 updated value";
  72. 72. ScriptManager1.RegisterAsyncPostBackControl(Label3);| English | Chinese | Japan | Korean | - 64 - Test Information Co., Ltd. All rights reserved.Label3.Text = "Label3 updated value";}
  73. 73. Answer: B

×