Exam 70-320 Preparation Questions

Page 6

E: The Strong Name tool (Sn.exe) helps sign assemblies with strong names. However, we are creating a Dataset not an assembly. Question:8. You develop an ADO.NET application that uses a Microsoft SQL Server database and a SqlClient data provider. Your application includes the following four code segments, which are each called once: SqlConnection myConnection1 = new SqlConnection(); myConnection1.ConnectionString = "Data Source=CompanyServer;" + "Initial Catalog=Billing; Integrated Security=true"; myConnection1.Open(); SqlConnection myConnection2 = new SqlConnection(); myConnection2.ConnectionString = "Data Source=CompanyServer;" 1+ "Initial Catalog=Billing; Integrated Security=True"; myConnection2.Open(); SqlConnection myConnection3 = new SqlConnection(); myConnection3.ConnectionString= "Data Source=CompanyServerB;" 2+ "Initial Catalog=Search; Integrated Security=true"; myConnection3.Open(); SqlConnection myConnection4 = new SqlConnection(); myConnection4.ConnectionString = "Data Source=CompanyServer;" .+ "Initial Catalog=OrderEntry; Integrated Security=true"; myConnection4.Open(); You verify that your application is the only application that is using SQL Server. Your application runs all code segments by using the same identity. You run the application. Connection pooling is enabled, and the entire application runs within the connection timeout parameter. How many connection pools are created? 3A. One 4B. Two 5C. Three 6D. Four

Answer: C Explanation: MyConnection1 and MyConnection2 use exactly the same connection string, while MyConnection3 and MyConnection4 use separate connections strings. The three separate connection strings will create three connections poolsNote: When a connection is opened, a connection pool is created based on an exact matching algorithm that associates the pool with the connection string in the connection. Each connection pool is associated with a distinct connection string. When a new connection is opened, if the connection string is not an exact match to an existing pool, a new pool is created. Reference: .NET Framework Developer's Guide, Connection Pooling for the SQL Server .NET Data Provider Incorrect Answers A, B; D: One connection pool will be created for each unique connection strings. Three unique connections strings are used, not 1, 2 or 4. Question:9. You have a SqlDataReader object named orders DataReader. This object contains a column named OrderQuantity that has an integer value. This object also contains one row for each order received during the previous week. You need to write code that will process each row in orders DataReader and pass OrderQuantity to a function named myFunction. Which code segment should you use? A. long weeklyOrderQuantity = 0; while (ordersDataReader.Read()) { myFunction((int)ordersDataReader["OrderQuantity"]); } B. long weeklyOrderQuantity = 0; while (ordersDataReader.NextResult()) { myFunction((int)ordersDataReader["OrderQuantity"]);


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.