5. You are creating an ASP.NET application that performs updates to a database. The application performs the updates by running a series of SQL statements. You write a procedure to run the SQL statements. The procedure accepts a connection string and an array of SQL statements as parameters.You use structured exception handling in your procedure to handle any errors that occur while the statements are running. You want the procedure to terminate after handling an exception and to return to the SQL statement that caused the exception. You also want to ensure that the database connection is closed before the procedure terminates, whether or not an error occurs.You begin writing the procedure by using the following code:public static void ExecuteStatements(
string connectionString, string[. sql)
{
OleDbConnection cnn =
new OleDbConnection(connectionString);
OleDbCommand cmd = new OleDbCommand();int i;
cmd.Connection = cnn;
cnn.Open();
try
{
for (i=0; i<= sql.Length - 1;i++)
{
cmd.CommandText = sql[i.;
cmd.ExecuteNonQuery();
}
}
Which code segment should you use to complete the procedure?A. catch(OleDbException ex) { throw(ex); } finally { cnn.Close(); } } 
B. catch(OleDbException ex) { throw(new Exception(sql[i., ex)); } finally { cnn.Close(); } } 
C. catch(OleDbException ex) { throw(ex); } } cnn.Close(); 
D. catch(OleDbException ex) { throw(new Exception(sql[i., ex)); } } cnn.Close();  Answer(s)   Rank (%)   Rank (# votes)   Answer Rationale  
B 100% 11/11 Rationales 
----------------------------------------------------6. You ASP.NET application manages order entry data by using a DataSet object named orderEntry. The orderEntry object includes twp DataTable objects named orderNames and OrderDetails. A ForeignKeyConstraint object named orderDetailsKey is defined between the two DataTable objects.You attempt to delete a row in orderNames while there are related rows in OrderDetails, and an exception is generated.What is the most likely cause of the problem?A. The current value of OrderDetails.KeyDeleteRule is Rule.Cacade. 
B. The current value of OrderDetails.KeyDeleteRule is Rule.SetNull. 
C. The current value of OrderDetails.KeyDeleteRule is Rule.SetDefault. 
D. The current value of OrderDetails.KeyDeleteRule is Rule.None.  Answer(s)   Rank (%)   Rank (# votes)   Answer Rationale  
D 89% 8/9 Rationales 
A 11% 1/9 Rationales 
----------------------------------------------------7. You are creating an ASP.NET application to track sales orders. The application users an ADO.NET DataSet object that contains two DataTable objects. One table is named Orders, and the other table is named OrderDetails. The application displays data from the Orders table in a list box. You want the order details for an order to be displayed in a grid when a user selects the order in the list box. You want to modify these objects to enable your code to find all the order details for the selected order.What should you do?A. Add a DataRelation object to the Relations collection of the DataSet object. 
B. Use the DataSet.Merge method to connect the Orders table and the OrderDetails table to each other. 
C. Add a ForeignKeyConstraint to the OrderDetails table. 
D. Add a keyref constraint to the OrderDetails table.  Answer(s)   Rank (%)   Rank (# votes)   Answer Rationale  
A 90% 9/10 Rationales 
B 10% 1/10 Rationales 
----------------------------------------------------

解决方案 »

  1.   

    8. You create an ASP.NET application and deploy it on a test server. The application consists of a main page that links to 30 other pages containing ASP.NET code.You want to accomplish the following goals:
    " Enable tracing on all the pages in the application except the main page.
    " Display trace output for up to 40 requests.
    " Ensure that trace output is appended to the bottom of each of the pages that will contain trace output.
    " Ensure that any configuration changes affect only this application.You need to accomplish these goals with the minimum amount of development effort.Which three actions should you take (Each Answer: presents part of the solution.)? (Choose three)A. Add the following element to the Web.config file: <trace enabled=_true_ pageOutput=_True_/> 
    B. Add the following attribute to the Trace element of the application's Weconfig file: requestLimit=40 
    C. Add the following attribute to the Trace element of the application's Machine.config file: RequestLimit=40 
    D. Set the Trace attribute of the Page directive to true for each page except the main page. 
    E. Set the Trace attribute of the Page directive to false for the main page 
    F. Set the TraceMode attribute of the Page directive to SortByTime for the main page.  Answer(s)   Rank (%)   Rank (# votes)   Answer Rationale  
    A,B,E 88% 21/24 Rationales 
    A,D 4% 1/24 Rationales 
    A,B,D 8% 2/24 Rationales 
    ----------------------------------------------------9. You are creating an ASP.NET application that uses the Microsoft SQL Server .NET Data Provider to connect to your company's database. Your database administrator reports that, due to heavy usage of the application, data requests are being blocked while users wait for new connections to be created.You want to improve throughput by setting a minimum connection pool size of 10.What should you do?A. Add a connection element under an appSettings element in the Web.config file for your application, and specify a minimum size of 10 for the connection pool. 
    B. Add a connection element under an appSettings element in the Machine.config file on your Web server, and specify a minimum size of 10 for the connection pool. 
    C. Add a Min Pool Size property to the connection string you use when opening a connection, and specify a minimum size of 10 for the connection pool. 
    D. Add a Min Pool Size property to your ADO.NET connection objects, and assign a value of 10 to the property.  Answer(s)   Rank (%)   Rank (# votes)   Answer Rationale  
    C 100% 6/6 Rationales 
    ----------------------------------------------------
    10. You are creating an ASP.NET application for your company. The company data is stored in a Microsoft SQL Server 6.5 database. Your application generates accounting summary reports based on transaction tables that contain million of rows.You want your application to return each summary report as quickly as possible. You need to configure your application to connect to the database and retrieve the data in a away that achieves this goal.What should you do?A. Use a SqlConnection object to connect to the database, and use a SqlCommand object to run a stored procedure that returns the dat 
    B. Use an OleDbConnection object to connect to the database, and use an OleDbCommand object to run a stored procedure that returns the data. 
    C. Configure SQL Server to support HTTP access, and create an XML template to run a stored procedure that returns the data in XML format. 
    D. Use COM interop to create an ADODB.Connection object, and use an ADODB.Command object to run a SQL statement that returns the data.  Answer(s)   Rank (%)   Rank (# votes)   Answer Rationale  
    B 79% 11/14 Rationales 
    A 21% 3/14 Rationales 
    ----------------------------------------------------11. You are creating an ASP.NET page to retrieve sales data from a Microsoft SQL Server database. You are writing a method named GetYTDSales to run a stored procedure in the SQL Server database. The stored procedure has one input parameter that is used to specify a product. The stored procedure returns to the year-to-date sales for that products.You declare a numeric variable in the GetYTDSales method. You want to assign the return value of the stored procedure to the variable.What should you do?A. Create a SqlDataAdapter object and call its Fill method to run the stored procedure and assign the year-to-date sales value to your numeric variable. 
    B. Create a SqlDataAdapter object and call its Update method to run the stored procedure and assign the year-to-date sales value to your numeric variable. 
    C. Create a SqlCommand object and call its ExecuteScalar method to run the stored procedure and assigns the year-to-date sales value to your numeric variable. 
    D. Create a SqlCommand object and call its ExecuteReader method to run the stored procedure and assign the year-to-date sales value to your numeric variable.  Answer(s)   Rank (%)   Rank (# votes)   Answer Rationale  
    C 100% 7/7 Rationales 
    ----------------------------------------------------12. You are creating an ASP.NET page that displays a list of products. The product information is stored in a Microsoft SQL Server database. You use SqlConnection object to connect to the database.Your SQL Server computer is named ServerA The database that contains the product information is named SalesDB. The table that contains the product information is named Products. To connect to SalesDB, you use a SQL Server user account named WebApp that has the password s1p2t9.You need to set the ConnectionString property of the SqlConnection object.Which string should you use?A. _Provider=SQLOLEDB.1;File Name =_Data\MyFile.udl 
    B. _Provider=MSDASQL;Data Source=ServerA; Initial Catalog=SalesDB; User ID=WebApp;Password=s1p2t9_ 
    C. _Data Source= ServerA;Initial Catalog=SalesDB; User ID=WebApp;Password=s1p2t9_ 
    D. _Data Source= ServerA;Database=SalesDB; Initial File Name=Products;User ID=WebApp;Pwd=s1p2t9_  Answer(s)   Rank (%)   Rank (# votes)   Answer Rationale  
    C 100% 8/8 Rationales 
    ----------------------------------------------------