Chinaunix首页 | 论坛 | 博客
  • 博客访问: 307175
  • 博文数量: 469
  • 博客积分: 2510
  • 博客等级: 少校
  • 技术积分: 5200
  • 用 户 组: 普通用户
  • 注册时间: 2008-06-03 16:15
文章分类

全部博文(469)

文章存档

2011年(82)

2010年(284)

2009年(69)

2008年(34)

我的朋友

分类:

2010-08-30 16:08:55

MCTS 考试题库由我们专业IT认证讲师及产品专家精心打造,包括了当前最新的全真考试试题,全部附有正确答案。题库的覆盖率在96%以上,确保考生能一次通过考试!

  考题信息如下:

  考试代号:

  认证名称:TS: MS .NET Framework 3.5, ADO.NET Application Development

  版本号:V8.02

  考题数量:85

  更新日期:2010-8-14

  1. You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET.

You need to ensure that the application can connect to any type of database.

What should you do?

A. Set the database driver name in the connection string of the application, and then create the

connection object in the following manner.

DbConnection connection = new OdbcConnection(connectionString);

B. Set the database provider name in the connection string of the application, and then create the

connection object in the following manner.

DbConnection connection = new OleDbConnection(connectionString);

C. Create the connection object in the following manner.

DbProviderFactory factory =

DbProviderFactories.GetFactory("System.Data.Odbc");

DbConnection connection = factory.CreateConnection();

D. Create the connection object in the following manner.

DbProviderFactory factory =

DbProviderFactories.GetFactory(databaseProviderName);

DbConnection connection = factory.CreateConnection();

Answer: D

2. You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET. The

application connects to a Microsoft SQL Server 2005 database.

You write the following code segment.

string queryString = "Select Name, Age from dbo.Table_1";

SqlCommand command = new SqlCommand(queryString,

(SqlConnection)connection));

You need to get the value that is contained in the first column of the first row of the result set returned by

the query.

Which code segment should you use?

A. var value = command.ExecuteScalar();

string requiredValue = value.ToString();

B. var value = command.ExecuteNonQuery();

string requiredValue = value.ToString();

C. var value = command.ExecuteReader(CommandBehavior.SingleRow);

string requiredValue = value[0].ToString();

D. var value = command.ExecuteReader(CommandBehavior.SingleRow);

string requiredValue = value[1].ToString();

Answer: A

3. You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET. The

application connects to a Microsoft SQL Server 2005 database.

You write the following code segment. (Line numbers are included for reference only.)

01 using (SqlConnection connection = new

SqlConnection(connectionString)) {

02 SqlCommand cmd = new SqlCommand(queryString, connection);

03 connection.Open();

04

05 while (sdrdr.Read()){

06 // use the data in the reader

07 }

08 }

You need to ensure that the memory is used efficiently when retrieving BLOBs from the database.

Which code segment should you insert at line 04?

A. SqlDataReader sdrdr =

cmd.ExecuteReader();

B. SqlDataReader sdrdr =

cmd.ExecuteReader(CommandBehavior.Default);

C. SqlDataReader sdrdr =

cmd.ExecuteReader(CommandBehavior.SchemaOnly);

D. SqlDataReader sdrdr =

cmd.ExecuteReader(CommandBehavior.SequentialAccess);

Answer: D

4. You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET.

The application has a DataTable object named OrderDetailTable. The object has the following columns:

` ID

` OrderID

` ProductID

` Quantity

` LineTotal

The OrderDetailTable object is populated with data provided by a business partner. Some of the records

contain a null value in the LineTotal field and 0 in the Quantity field.

You write the following code segment. (Line numbers are included for reference only.)

01 DataColumn col = new DataColumn("UnitPrice", typeof(decimal));

02

03 OrderDetailTable.Columns.Add(col);

You need to add a DataColumn named UnitPrice to the OrderDetailTable object.

Which line of code should you insert at line 02?

A. col.Expression = "LineTotal/Quantity";

B. col.Expression = "LineTotal/ISNULL(Quantity, 1)";

C. col.Expression = "LineTotal.Value/ISNULL(Quantity.Value,1)";

D. col.Expression = "iif(Quantity > 0, LineTotal/Quantity, 0)";

Answer: D

  如需下载更多的70-561题库,可登陆

阅读(146) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~