Which code segment should you use?
You use Microsoft .NET Framework 4 to develop an ASP.NET Web application that connects to a
Microsoft SQL Server 2008 database. The application uses Integrated Windows authentication in
Internet Information Services (IIS) to authenticate users. A connection string named connString
defines a connection to the database by using integrated security. You need to ensure that a
SqlCommand executes under the application pool’ s identity on the database server. Which code
segment should you use?
Which code segment should you use?
You need to fill a DataSet from the result that is returned by the stored procedure. The first result
set must be added to a DataTable named Class, and the second result set must be added to a
DataTable named Student. Which code segment should you use?
Which code segment should you use?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application
that uses LINQ to SQL. The application contains the following model.
Each region contains a single vendor. Customers order parts from the vendor that is located in their
region. You need to ensure that each row in the Customer table references the appropriate row
from the Vendor table. Which code segment should you use?
Which IsolationLevel should you use?
You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL
Server 2008 database. You need to prevent dirty or phantom reads. Which IsolationLevel should you
use?
Which code segment should you insert at line 04?
You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL
Server 200B database. You populate a SqlDataAdapter by using the following code. (Line numbers
are included for reference only.)
01 SqlDataAdapter dataAdapterl = new SqlDataAdapter
(“SELECT * FROM [BlogEntries]
ORDER BY CreationDote”, connection);
02 cmdBuilder = nev SqlCormnandBuilder(dataAdapterl);
03 dataAdapterl.Fill(BlogEntryDataSet, “BlogEntries”); 04
05 connection.Close()
You need to update the blog owner for all BlogEntry records.
Which code segment should you insert at line 04?
Which code segment should you insert at line 08?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application
that uses LINQ to SQL. The application contains the following model.
You write the following code. (Line numbers are included for reference only.)
01 static void Insect()
02 {
03 NorthwindDataContext dc = new NorthwindDataContext();
04 Customer newCustomer = new Customer();
05 newCustomer.Firstname = “Todd”;
06 newCustomer.Lastname = “Meadows”;
07 newCustomer.Email = “troeadows@contoso.com”; 08
09 dc.SubmitChanges();
10 {
A product named Bike Tire exists in the Products table. The new customer orders the Bike Tire
product. You need to ensure that the correct product is added to the order and that the order is
associated with the new customer. Which code segment should you insert at line 08?
Which code segment should you use?
You use Microsoft .NET Framework 4 to develop an ASP.NET 4 Web application. You need to encrypt
the connection string information that is stored in the web.config file. The application is deployed to
multiple servers. The encryption keys that are used to encrypt the connection string information
must be exportable and importable on all the servers. You need to encrypt the connection string
section of the web.config file so that the file can be used on all of the servers. Which code segment
should you use?
You need to ensure that the EDM contains an entity type named Employee that contains all of the data from both
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application that
connects to a database by using the Entity Framework. You create an Entity Data Model (EDM) by
using the Generate from database wizard for the following tables.
You need to ensure that the EDM contains an entity type named Employee that contains all of the
data from both tables. What should you do?
Which code segment should you use?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application
that uses the Entity Framework. The application has an entity model that contains a
SalesOrderHeader entity. The entity includes an OrderDate property of type DateTime. You need to
retrieve the 10 oldest SalesOrderHeaders according to the OrderDate property. Which code segment
should you use?
Which code segment should you insert at line 03?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You
are creating the data layer of the application. You write the following code segment. (Line numbers
are included for reference only.)
01 public static SqlDataReader GetDataReader(string sql) {
02 SqlDataReader dr – null;
03
03 return dr;
05 }
You need to ensure that the following requirements are met:
• The SqlDataReader returned by the GetDataReader method can be used to retrieve rows
from the database.
• SQL connections opened within the GetDataReader method will close when the
SqlDataReader is closed.
Which code segment should you insert at line 03?