1.
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application. The Contoso.com network contains a Microsoft SQL Server 2005 server named DB01. Your application retrieve records from a database named Trades that resides on DB01. The application connects to Trades by using an instance of the SqlConnection class with the following connection string. "Data Source=DB01;UID='mhamm';PWD='password';" When the application calls the Open method of the SqlConnection object, it displays the following: "Cannot open user default database. Login failed. Login failed for user 'mhamm'". You need to make sure that you can connect to Trades when the user account for the connection is mhamm. What should you do?
2.
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. The application is used under a Least-Privilege User Account (LUA) of the operating system. You want to configure the SQL Server 2005 connection string in the app.config file to use SQL Server Express user instances. What should you do?
3.
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. Your application contains the following code. string queryString = "Select * from dbo.Users"; SqlCommand command = new SqlCommand(queryString, (SqlConnection)connection)); You want to get the value that is contained in the first column of the first row of the result set returned by the query. What should you do?
4.
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. Your application contains the following code. 01 DataTable dt = new DataTable(); 02 dt.Columns.Add("number"); 03 dt.Columns.Add("string"); 04 dt.Rows.Add(1, "3"); 05 dt.Rows.Add(2, "2"); 06 dt.Rows.Add(3, "1"); 07 var result = from p in dt.AsEnumerable() 08 09 foreach (var number in result) { 10 Console.Write(number.ToString()); 11 } You need to display the string "321". What should you do?
5.
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. The following contacts.xml file is read by the developed application. Mia Hamm Andy Reid Amy Walsh Your application contains the following code. (Line numbers are for reference only.) 01 XDocument loaded = XDocument.Load(@"D:\contacts.xml"); 02 03 foreach (string name in q) 04 Console.WriteLine("{0}", name); You want to make sure that the application outputs only the names Andy Reid and Amy Walsh. What should you do?
6.
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. The application fills a DataSet object named cust with customer records. Your application contains the following code. (Line numbers are for reference only.) 01 System.IO.StreamWriter sw = 02 new System.IO.StreamWriter("Customers.xml"); 04 sw.Close(); You want to write the content of the cust object to the Customers.xml file as XML data along with inline XML schema. What should you do?
7.
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. The application uses an XML file that contains product data. Furthermore, a corresponding XSD file contains the schema of the XML file. You want the application to do the following: Loads the XML file in a typed DataSet and validates it against the schema provided in the XSD file. What should you do?
8.
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application. The user name and password that is kept by the connection string is stored directly in the code of the application. You want to make sure that the password in the connection string is as protected. What should you do?
9.
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application. The database on the Microsoft SQL Server 2005 database has two tables that are displayed by using two SqlConnection objects in two different GridView controls. You want the tables to be displayed at the same time with the use a single SqlConnection object. What should you do?
10.
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. You then define the connection string of the application as follows: "Server=Prod;Database=WingtipToys;Integrated Security=SSPI;Asynchronous Processing=true" The following code segment is used on the application: (Line numbers are included for reference only.) 01 protected void UpdateData(SqlCommand cmd) { 02 cmd.Connection.Open(); 03 04 lblResult.Text = "Updating ..."; 05 } You discover that the cmd object takes a long time to execute. You want to make sure that the application continues to execute while cmd is executing. What should you do?