070-516 無料問題集「Microsoft TS: Accessing Data with Microsoft .NET Framework 4」
The application must provide a component part list for any product. The component part list must give the
quantity of
each distinct part that is required to manufacture that product.
You need to create a LINQ expression that delivers a a result of type IEnumerable<Tuple<int,Part>> to
meet the requirements.
Which expression should you use?
quantity of
each distinct part that is required to manufacture that product.
You need to create a LINQ expression that delivers a a result of type IEnumerable<Tuple<int,Part>> to
meet the requirements.
Which expression should you use?
正解:E
解答を投票する
You use Microsoft Visual Studio 2010 and Microsoft ADO.NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server 2008 database.
You use the ADO.NET LINQ to SQL model to retrieve data from the database. You use stored procedures
to return multiple result sets.
You need to ensure that the result sets are returned as strongly typed values. What should you do?
The application connects to a Microsoft SQL Server 2008 database.
You use the ADO.NET LINQ to SQL model to retrieve data from the database. You use stored procedures
to return multiple result sets.
You need to ensure that the result sets are returned as strongly typed values. What should you do?
正解:D
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server database. The application uses the ADO.NET Entity
Framework to manage order data.
The application makes a Web service call to obtain orders from an order-tracking system.
You need to ensure that the orders are added to the local data store. Which method should you call on the
ObjectContext?
The application connects to a Microsoft SQL Server database. The application uses the ADO.NET Entity
Framework to manage order data.
The application makes a Web service call to obtain orders from an order-tracking system.
You need to ensure that the orders are added to the local data store. Which method should you call on the
ObjectContext?
正解:A
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server database. The application stores user names and
passwords in the database.
You need to ensure that users cannot read passwords extracted from the database. What should you do?
The application connects to a Microsoft SQL Server database. The application stores user names and
passwords in the database.
You need to ensure that users cannot read passwords extracted from the database. What should you do?
正解:C
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server 2008 database. The application uses DataContexts to
query the database.
You create a function that meets the following requirements:
-Updates the Customer table on the database when a customer is marked as deleted.
-Updates the related entries in other tables (CustomerAddress, CustomerContacts) by marking them as deleted.
-Prevents consumer code from setting the Deleted column's value directly.
You need to ensure that the function verifies that customers have no outstanding orders before they are
marked as deleted.
You also need to ensure that existing applications can use the update function without requiring changes in
the code.
What should you do?
The application connects to a Microsoft SQL Server 2008 database. The application uses DataContexts to
query the database.
You create a function that meets the following requirements:
-Updates the Customer table on the database when a customer is marked as deleted.
-Updates the related entries in other tables (CustomerAddress, CustomerContacts) by marking them as deleted.
-Prevents consumer code from setting the Deleted column's value directly.
You need to ensure that the function verifies that customers have no outstanding orders before they are
marked as deleted.
You also need to ensure that existing applications can use the update function without requiring changes in
the code.
What should you do?
正解:A
解答を投票する
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server 2008 database.
You create classes by using LINQ to SQL based on the records shown in the exhibit:

You need to create a LINQ query to retrieve a list of objects that contains the OrderID and CustomerID
properties.
You need to retrieve the total price amount of each Order record. What are two possible ways to achieve
this goal?
(Each correct answer presents a complete solution. Choose two.)
The application connects to a Microsoft SQL Server 2008 database.
You create classes by using LINQ to SQL based on the records shown in the exhibit:

You need to create a LINQ query to retrieve a list of objects that contains the OrderID and CustomerID
properties.
You need to retrieve the total price amount of each Order record. What are two possible ways to achieve
this goal?
(Each correct answer presents a complete solution. Choose two.)
正解:B、D
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
You use Microsoft .NET Framework 4.0 to develop an application. You use the XmlReader class to load
XML from a location that you do not control.
You need to ensure that loading the XML will not load external resources that are referenced in the XML.
Which code segment should you use?
XML from a location that you do not control.
You need to ensure that loading the XML will not load external resources that are referenced in the XML.
Which code segment should you use?
正解:D
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows
Communication
Foundation (WCF) Data Services service. You deploy the data service to the following URL: http://
contoso.com/Northwind.svc.
You add the following code segment. (Line numbers are included for reference only.)
01 var uri = new Uri(@"http://contoso.com/Northwind.svc/");
02 var ctx = new NorthwindEntities(uri);
03 var categories = from c in ctx.Categories select c;
04 foreach (var category in categories) {
05 PrintCategory(category);
06 ...
07 foreach (var product in category.Products) {
08 ...
09 PrintProduct(product);
10 }
11 }
You need to ensure that the Product data for each Category object is lazy-loaded. What should you do?
Communication
Foundation (WCF) Data Services service. You deploy the data service to the following URL: http://
contoso.com/Northwind.svc.
You add the following code segment. (Line numbers are included for reference only.)
01 var uri = new Uri(@"http://contoso.com/Northwind.svc/");
02 var ctx = new NorthwindEntities(uri);
03 var categories = from c in ctx.Categories select c;
04 foreach (var category in categories) {
05 PrintCategory(category);
06 ...
07 foreach (var product in category.Products) {
08 ...
09 PrintProduct(product);
10 }
11 }
You need to ensure that the Product data for each Category object is lazy-loaded. What should you do?
正解:C
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You create a Database Access Layer (DAL) that is database-independent. The DAL includes the following
code segment.
(Line numbers are included for reference only.)
01 static void ExecuteDbCommand(DbConnection connection)
02 {
03 if (connection != null){
04 using (connection){
05 try{
06 connection.Open();
07 DbCommand command = connection.CreateCommand();
08 command.CommandText = "INSERT INTO Categories (CategoryName)
VALUES ('Low Carb')";
09 command.ExecuteNonQuery();
10 }
11 ...
12 catch (Exception ex){
13 Trace.WriteLine("Exception.Message: " + ex.Message);
14 }
15 }
16 }
17 }
You need to log information about any error that occurs during data access.
You also need to log the data provider that accesses the database. Which code segment should you insert
at line 11?
You create a Database Access Layer (DAL) that is database-independent. The DAL includes the following
code segment.
(Line numbers are included for reference only.)
01 static void ExecuteDbCommand(DbConnection connection)
02 {
03 if (connection != null){
04 using (connection){
05 try{
06 connection.Open();
07 DbCommand command = connection.CreateCommand();
08 command.CommandText = "INSERT INTO Categories (CategoryName)
VALUES ('Low Carb')";
09 command.ExecuteNonQuery();
10 }
11 ...
12 catch (Exception ex){
13 Trace.WriteLine("Exception.Message: " + ex.Message);
14 }
15 }
16 }
17 }
You need to log information about any error that occurs during data access.
You also need to log the data provider that accesses the database. Which code segment should you insert
at line 11?
正解:D
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
The application populates a DataSet object by using a SqlDataAdapter object.
You use the DataSet object to update the Categories database table in the database. You write the
following code segment.
(Line numbers are included for reference only.)
01 SqlDataAdapter dataAdpater = new SqlDataAdapter("SELECT CategoryID,
CategoryName FROM Categories", connection);
02 SqlCommandBuilder builder = new SqlCommandBuilder(dataAdpater);
03 DataSet ds = new DataSet();
04 dataAdpater.Fill(ds);
05 foreach (DataRow categoryRow in ds.Tables[0].Rows)
06 {
07 if (string.Compare(categoryRow["CategoryName"].ToString(), searchValue,
true) == 0)
08 {
09 ...
10 }
11 }
12 dataAdpater.Update(ds);
You need to remove all the records from the Categories database table that match the value of the
searchValue variable.
Which line of code should you insert at line 09?
You use the DataSet object to update the Categories database table in the database. You write the
following code segment.
(Line numbers are included for reference only.)
01 SqlDataAdapter dataAdpater = new SqlDataAdapter("SELECT CategoryID,
CategoryName FROM Categories", connection);
02 SqlCommandBuilder builder = new SqlCommandBuilder(dataAdpater);
03 DataSet ds = new DataSet();
04 dataAdpater.Fill(ds);
05 foreach (DataRow categoryRow in ds.Tables[0].Rows)
06 {
07 if (string.Compare(categoryRow["CategoryName"].ToString(), searchValue,
true) == 0)
08 {
09 ...
10 }
11 }
12 dataAdpater.Update(ds);
You need to remove all the records from the Categories database table that match the value of the
searchValue variable.
Which line of code should you insert at line 09?
正解:A
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)