Exam Prep Questions

Question 1

You have recently deployed an expense reporting system in your company that relies heavily on a SQL Server database. All employees in the company have similar access permissions to the database. You have created the application in such a way that it uses each employee's login name and password in the connection string to connect to SQL Server. Users of the application have reported significantly slow performance, although other applications that use the same database seem to work fine. Your task is to optimize the performance of this application. Which of the following steps should you take?

  • A. Compile the application to native code using ngen.exe .

  • B. Run the SQL Server Index Tuning Wizard.

  • C. Increase the maximum size of the connection pool.

  • D. Use the same connection string for all users.

A1:

The correct answer is D. To get the maximum benefit from connection pooling, you must use the same connection string every time you connect to the database. Answer A is incorrect because the application is not slow only during the initial run. Answer B is incorrect because other applications accessing the same database are working well. Answer C is incorrect because you should use the existing connections effectively rather than increasing the size of the connection pool.

Question 2

You want to determine whether a given event log exists on a remote machine. Which of the following methods is the most efficient way of determining this?

  • A. Exists()

  • B. SourceExists()

  • C. GetEventLogs()

  • D. LogNameFromSourceName()

A2:

The correct answer is A. The easiest and most efficient way to determine whether a log exists on a local or remote machine is to use the static Exists() method of the EventLog class. Answer B is incorrect because the SourceExists() method determines the existence of an event source instead of an event log. Answer C is incorrect because the GetEventLogs() method creates an array of all the event logs on a computer, meaning you'll have to do additional programming to search that list and determine the existence of an event log. Answer D is incorrect because the LogNameFromSourceName() method is used to determine the name of the event log for the specified event source.

Question 3

You are designing a database- intensive Web application for a large publishing house. You want to get maximum performance from the SQL queries that run to populate a drop-down list from a SQL Server database. Which of the following code segments would give you the fastest performance?

  • A.

     SqlConnection conn = new SqlConnection(connStr); conn.Open(); DataSet ds = new DataSet(); SqlDataAdapter ad = new SqlDataAdapter ("select * from authors", conn); ad.Fill(ds); 
  • B.

     OleDbConnection conn = new OleDbConnection(connStr); conn.Open(); DataSet ds = new DataSet(); OleDbDataAdapter ad =     new OleDbDataAdapter ("select * from authors", conn); ad.Fill(ds); 
  • C.

     SqlConnection conn = new SqlConnection (connStr); SqlCommand cmd = new SqlCommand("select * from authors", connStr); conn.Open(); SqlDataReader reader; reader = cmd.ExecuteReader(); 
  • D.

     OleDbConnection conn = new OleDbConnection (connStr); OleDbCommand cmd =    new OleDbCommand("select * from authors", connStr); conn.Open(); OleDbDataReader reader; reader = cmd.ExecuteReader(); 
A3:

The correct answer is C. When you are working with a SQL Server database, using the SQL Server managed provider gives you better performance than its OleDb counterpart . This fact makes answers B and D incorrect. Also, when you are doing sequential read-only operations such as populating a drop-down list, the SqlDataReader object gives better performance than the SqlDataAdapter object. This fact makes answer A incorrect.

Question 4

You create a Web application that enables users to locate the retail stores of your company all across the country. When a user selects a state from a DropDownList control, a list of all the stores in that state are displayed. The list is stored in a SQL Server database and changes very infrequently. You are concerned about the performance of the application when the Web server is under heavy load. Which of these actions should you take to improve application performance?

  • A. Use State Server to store the information for each user between requests .

  • B. Use caching to hold the delivered page in memory between requests.

  • C. Use thread pooling to ensure that the application will always have available threads.

  • D. Migrate the results page from ASP.NET to ASP.

A4:

The correct answer is B. By using page-level caching, you can cache a separate copy of the results page for each input state. The server can deliver these copies quickly because no database access or other processing is involved in satisfying subsequent requests. Answer A is incorrect because State Server is helpful in sharing the state in a Web farm but does not help in increasing the performance of the Web page. Answer C is incorrect because it is not clear from the question whether the application uses multiple threads. Answer D is incorrect because an ASP.NET page will have better performance compared to an equivalent ASP page.

Question 5

Your application includes a complex Web page with approximately eight DataGrid controls. The data in three of these controls is important in determining the proper navigation path when the page is posted back to the server; the other controls' values are changed in every page load. What should you do to improve performance on this page?

  • A. Set the Enabled property of the DataGrid controls that are changed in every page load to false .

  • B. Set the ViewState property of the DataGrid controls that are changed in every page load to false .

  • C. Set the ViewState property of the DataGrid controls that are not changed in every page load to false .

  • D. Set the Enabled property of the DataGrid controls that are not changed in every page load to false .

A5:

The correct answer is B. When you set the ViewState property for a DataGrid control to true , the contents of the data grid are passed between the client and server in a hidden form field. Setting ViewState to false removes this information and therefore cuts down on download times. Answers A and D are incorrect because setting the Enabled property of the DataGrid control to false does not have an impact on the view state for the DataGrid control. Answer C is incorrect because, if the DataGrid controls are not changed in every page load, you might actually improve performance by setting its ViewState property to true rather than false .

Question 6

You have developed a database-intensive ASP.NET application for a large pharmaceutical company. The database for the application uses SQL Server 2000. Users of your application are complaining about the consistently slow nature of some reports . Which of the following actions would you take to increase the performance of this application? (Select two.)

  • A. Compile the application to native code using ngen.exe .

  • B. Run the SQL Server Index Tuning Wizard.

  • C. Convert all ad hoc SQL statements to SQL Server stored procedures.

  • D. Add a PerformanceMonitor component to the code.

A6:

The correct answers are B and C. The SQL Server's Index Tuning Wizard identifies any bottlenecks caused by indexing. SQL Server stored procedures also improve data access performance significantly. Answer A is incorrect because the application is performing slowly consistently rather than only during the initial load. Answer D is incorrect because adding the PerformanceMonitor component helps you monitor the performance of an application but will not help in improving it.

Question 7

Which of the following coding constructs will have a major impact on an application's performance and should therefore be used cautiously?

  • A. try

  • B. catch

  • C. finally

  • D. throw

A7:

The correct answer is D. The throw statement has the maximum performance penalty and should be used cautiously. Answers A, B, and C are incorrect because they do not have any major impact on the application's performance.

Question 8

Your Web application displays routing and timing information related to your company's network. Each time a new page is loaded, it makes entirely new calculations to determine which information to display. No page in the application passes any information to another page in the application. Which alternative should you use for session state in this application to maximize performance?

  • A. <@% Page EnableSessionState="false" %>

  • B. In-process session state

  • C. State Server session state

  • D. SQL Server session state

A8:

The correct answer is A. Nothing in this application requires knowledge of session state. To maximize performance, you should disable session state tracking. Answers B, C, and D are incorrect because these are the solutions to store session state and, as noted, session state itself is not required.

Question 9

You have written an application that publishes its own custom performance counter. You want to decrease the value of a performance counter by five. Which of the following methods is the best way to do this?

  • A. Decrement()

  • B. Increment()

  • C. IncrementBy()

  • D. NextValue()

A9:

The correct answer is C. Using the IncrementBy() method is the most efficient way to increase or decrease the value of a counter by the specified amount. Answer A is incorrect because instead of increasing the performance counter, the Decrement() method decreases the performance counter by one. Answer B is incorrect because the Increment() method can increase the performance counter only by one, and you would need to call it several times to increase the counter by multiple units. Answer D is incorrect because, instead of increasing the performance counter, the NextValue() method only returns the next calculated value of a performance counter.

Question 10

Your Web application uses a legacy COM component to perform calculations. Ten values need to be passed to the COM component. You have the choice of several methods to communicate with the COM component. Which method should you select for best performance?

  • A. Set individual properties to pass the 10 values. Then call a single method with no parameters that returns the answer.

  • B. Call 10 individual methods ”each of which takes a single value as a parameter and each of which returns part of the required information.

  • C. Call a single method that takes all 10 values as parameters and then returns the required information.

  • D. Call one method that takes an array of all 10 values as a parameter, and then call a second method that returns the required information.

A10:

The correct answer is C. Communication with legacy COM components must cross process boundaries. To speed up this communication, you need to minimize the number of calls between your application and the COM component. Answers A, B, and D are incorrect because these solutions require making additional method calls to the COM component.



MCAD Developing and Implementing Web Applications with Visual C#. NET and Visual Studio. NET (Exam [... ]am 2)
MCAD Developing and Implementing Web Applications with Visual C#. NET and Visual Studio. NET (Exam [... ]am 2)
ISBN: 789729016
EAN: N/A
Year: 2005
Pages: 191

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net