Microsoft 70-305 Real Exam Questions
Developing and Implementing Web Applications with Microsoft Visual Basic .NET and Microsoft Visual Studio .NET
1: You create an ASP.NET application that produces sales reports. The sales data is stored in a Microsoft SQL Server database that is used for transaction processing. The application consists of complex Transact-SQL statements. Many users report that the report generation is taking longer to run each day. You need to improve response times. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)
A.Use an OleDbDataAdapter instead of a SqlDataAdapter to access the data.
B.Ensure that appropriate indexes exist on the SQL Server tables.
C.Rewrite your SQL statements to use aliases for all table names.
D.Rewrite your direct SQL statements as stored procedures and call the stored procedures from your application.
E.Configure queries to run in the security context of the user who is running the query.
Correct Answers: B D
2: You are creating an ASP.NET page for your company. The page contains a DataGrid control that displays all the current prices for the commodities that the company purchases. The page also contains a Button control that refreshes the data in the DataGrid control. The DataGrid control needs to be repopulated each time the page is displayed. The data is accessed through a DataView object stored in the Session object. You want to ensure the fastest load time for the page. What should you do?
A.Set the DataSource property and call the DataBind method of the DataGrid control in the Click event handler for the Button control.
B.Set the DataSource property and call the DataBind method of the DataGrid control in the Start event handler for the Session object.
C.Set the EnableViewState property of the DataGrid control to false.
D.Set the EnableViewState property of the DataGrid control to true.
Correct Answers: C
3: You create an ASP.NET application for an online shopping site. The application uses a Microsoft SQL Server 2000 database. The database contains a stored procedure named getProductsByCategory that returns all products that match a specified category code. The category code is supplied as a parameter named @ProdCode.
The application includes a page named ShowProducts.aspx. You are using Visual Studio .NET to debug ShowProducts.aspx. ShowProducts.aspx uses the getProductsByCategory stored procedure to populate a DataSet object. You set a breakpoint within getProductsByCategory so that you can step through the stored procedure within the debugger.
While you are debugging getProductsByCategory, you need to view the current value of @ProdCode. What should you do?
A.Open the Locals debugging window.
B.Open the Modules debugging window.
C.Add the following line of code to getProductsByCategory:
Print @ProdCode
Open the Output debugging window and select Debug as the source from the drop-down list box.
D.Add the following line of code to getProductsByCategory:
SELECT @ProdCode As DebugOutput
Open the Output debugging window and select Database Output as the source from the drop-down list box.
Correct Answers: A
4: You are creating an ASP.NET application for your company’s human resources (HR) department. Users in the HR department will use the application to process new employees. The application automates several activities that include creating a network login account, creating an e-mail account, registering for insurance benefits, and other activities.
During integration testing of your application, you need to verify that the individual activities run successfully and in the proper order. Each page in your application includes the following elements in the Page directive:
Debug="True"
Trace="True"
You want each page to provide execution information in the Web browser immediately after the page’s normal display output. You need to add instrumentation to the code in your pages to accomplish this goal.
Which statement should you use?
A.Trace.Write
B.Debug.Print
C.System.Diagnostics.Trace.Write
D.System.Diagnostics.Debug.Write
E.System.Diagnostics.Debugger.Log
Correct Answers: A
5: You create an ASP.NET application for your company. Your application contains a method named nextBusinessDay. This method uses a date parameter and returns the next date that is not a holiday or weekend day.
You are debugging a page named ProjectTimeline.aspx. You need the execution to break on the following line of code when the value of the dStartDate variable changes:
dStartDate = nextBusinessDay(dStartDate)
What should you do?
A.Set a breakpoint on the line of code and open the BreakPoint Properties dialog box.
Specify the following breakpoint condition:
dStartDate <> dStartDate
Select the is true option.
B.Set a breakpoint on the line of code and open the BreakPoint Properties dialog box.
Specify the following breakpoint condition:
dStartDate
Select the has changed option.
C.Add the following statement immediately after the call to nextBusinessDay:
System.Diagnostics.Debug.Assert( _
dStartDate <> dStartDate, "dStartDate has changed.")
D.Add the following statement immediately after the call to nextBusinessDay:
System.Diagnostics.Trace.Assert( _
dStartDate <> dStartDate, "dStartDate has changed.")
Correct Answers: B
6: You are creating an ASP.NET application for an online banking site. You need to allow customers to transfer funds between accounts. You write a component in Visual Basic .NET to handle transfers of funds. This component is used by the page named FundsTransfer.aspx.
For unit testing, you add the following code segment to the TransferFunds method of your component. (Line numbers are included for reference only.)
1 Dim ctx As HttpContext
2 ctx = HttpContext.Current
3 ctx.Trace.Write("Funds transfer requested.")
You want to be able to view the trace output on the FundsTransfer.aspx page. What should you do?
A.Add code to the FundsTransfer.aspx page that instantiates a Trace listener.
B.Enable tracing in the Page directive for the FundsTransfer.aspx page.
C.Add the following attribute to the Machine.config file:
<trace enabled="true">
D.Modify line 3 of the code segment as follows:
System.Diagnostics.Trace.WriteIf( _
ctx.IsDebuggingEnabled, "Funds transfer requested.")
Correct Answers: B
7: You create a reporting application for Margie’s Travel. You create several reports, each of which resides in its own folder under the Reports folder. Each subfolder has the appropriate security rights sets for Microsoft Windows users.
You write a function named ListReports that generates a list of available reports. You want to configure the application and the ListReports function to find out which reports are available to the current user.
If a user is logged in by using Windows authentication, you want ListReports to apply that user’s rights. If the user is not logged in by using Windows authentication, you want ListReports to use the rights granted to the margiestravel\ReportingAccount user account. The password for this user account is "p1W2o3r4d."
Which two actions should you take? (Each correct answer presents part of the solution. Choose two.)
A.Add the following element to the Web.config file:
<identity impersonate="false">
B.Add the following element to the Web.config file:
<identity impersonate="true">
C.Add the following element to the Web.config file:
<identity impersonate="true"
userName="margiestravel\ReportingAccount"
password="p1W2o3r4d">
D.Add the following element to the Web.config file:
<authorization>
<allow user="margiestravel\ReportingAccount">
</authorization>
E.Add code to the ListReports function to create and use a WindowsPrincipal object based on the margiestravel\ReportingAccount user account
only if no user is authenticated.
F.Add code to the ListReports function to always create and use a WindowsPrincipal object based on the margiestravel\ReportingAccount user
account.
Correct Answers: B E
8: You create an ASP.NET application named Inventory. This application will be used by customers on the Internet.
During the beta test period, you ensure that the actual ASP.NET error message is displayed whenever an error is encountered. Both developers and beta testers see the actual text of the error message.
You perform beta testing of other applications on the same beta test server during the beta testing period for Inventory. All of the other applications display ASP.NET error messages.
After the beta testing period is complete, the beta test server is promoted to a production server. You want all applications to display a single, user-friendly error message. You want to configure Inventory and the production server to meet these goals.
You want to perform this task by using the minimum amount of administrative effort.
Which two actions should you take? (Each correct answer presents part of the solution. Choose two.)
A.Set the mode parameter of the customErrors element in the Web.config file for Inventory to "On".
B.Remove the customErrors element from the Web.config file for Inventory.
C.Set the mode parameter of the customErrors element in the Inventory.config file to "On".
D.Remove the customErrors element from the Inventory.config file.
E.Set the mode parameter of the customErrors element in the Machine.config file to "On".
F.Remove the customErrors element from the Machine.config file.
Correct Answers: B E
9: You create an ASP.NET application for a hotel. The application contains a page that displays current weather conditions for the city in which the hotel is located. The application calls an XML Web service every 10 minutes to update the current weather conditions. A new page is then displayed for subsequent requests. You want the same page to be cached and retrieved from the cache during the time between calls to the XML Web service. You decide to use a Page directive to accomplish this goal. Which Page directive should you use?
A.<%@ Cache Seconds="600" VaryByParam="Page" %>
B.<%@ OutputCache Time="600" %>
C.<%@ OutputCache Duration="600" VaryByParam="None" %>
D.<%@ OutputCache Duration="600" %>
Correct Answers: C
10: You create an ASP.NET application named TimeSheet for your company’s intranet. The application will be used only by employees of your company.
You want the application to recognize the user without forcing the user to enter a name and password. You write the following code to save the user’s Microsoft Windows login name in the Session object:
Session.Item("User")=User.Identity.Name
When you run TimeSheet, the Session.Item("User") variable returns an empty string.
You want to configure Internet Information Services (IIS) and your application to be able to retrieve the user name automatically. What should you do?
A.Disable Anonymous Access for the application in IIS.
B.Enable Basic authentication for the application in IIS.
C.Add the following element to the Web.config file for TimeSheet:
<identity impersonate="True" />
D.Add the following element to the Web.config file for TimeSheet:
<identity impersonate="False" />
Correct Answers: A
Download | Password: certificatexam.com