Tải bản đầy đủ (.docx) (35 trang)

BTNB quiz4 database programming with ADO net

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (97.96 KB, 35 trang )

Part 1 of 1 -

Question 1 of 20

73.33/ 100.0 Points

0.0/ 5.0 Points

Which Dataset gives easier access to the contents of the table ?

A. Typed

B. UnTyped

C. Mixed

Question 2 of 20

Which of the following is not a member of ADODBCommand object?

A. ExecuteScalar

B. Open

C. ExecuteReader

0.0/ 5.0 Points


D. ExecuteStream


Question 3 of 20

5.0/ 5.0 Points

Chose valid value for datarowstates !

A.Detached

B.Modified

C.Deleted

D.Added

Question 4 of 20

What must your ASP code have if you are using the DSN method of connecting?

A. Both

5.0/ 5.0 Points


B. Connection object

C. Connection string

Question 5 of 20

What's wrong with these code:

using System;
using System.Data;
using System.Data.SqlClient;
class Program
{
static void Main(string[] args)
{
string sqlConnectString = ""Data Source=(local);"" +
""Integrated security=SSPI;Initial Catalog=AdventureWorks;"";
string sqlSelect = ""SELECT TOP 3 * FROM Sales.SalesOrderHeader;"" +
""SELECT TOP 3 * FROM Sales.SalesOrderDetail"";
int rsNumber;
SqlDataAdapter da = new SqlDataAdapter(sqlSelect, sqlConnectString);
DataSet ds = new DataSet( );
da.Fill(ds);
rsNumber = 0;
foreach (DataTable dt in ds.Tables)
{
Console.WriteLine(""Result set: {0}"", ++rsNumber);
foreach (DataRow row in dt.Rows)
{
Console.WriteLine(""{0}, {1}, {2}"", row[0], row[1], row[2]);
}
}
}
}

5.0/ 5.0 Points



A. Run time error, multi result set is not supported by ADO.NET

B. Nothing wong, multi result set is supported by ADO.NET

Question 6 of 20

0.0/ 5.0 Points

Permistic concurency means

A. ...... control works on the assumption that resource conflicts between multiple users are
unlikely (but not impossible), and allows transactions to execute without locking any resources. Only
when attempting to change data are resources checked to determine if any conflicts have occurred. If a
conflict occurs, the application must read the data and attempt the change again.
B. ….whatever data modification was made last gets written to the database.

C. …. control locks resources as they are required, for the duration of a transaction. Unless
deadlocks occur, a transaction is assured of successful completion.

Question 7 of 20

5.0/ 5.0 Points

When we need to retrieve only a single value from the Database,which Method is efficient

A. ExecuteReader()


B. ExecuteXmlReader()


C. ExecuteNonQuery()

D. ExecuteScalar()

Question 8 of 20

5.0/ 5.0 Points

Optimistic concurency means

A. …. control locks resources as they are required, for the duration of a transaction. Unless
deadlocks occur, a transaction is assured of successful completion.
B. ….whatever data modification was made last gets written to the database.

C. ...... control works on the assumption that resource conflicts between multiple users are
unlikely (but not impossible), and allows transactions to execute without locking any resources. Only
when attempting to change data are resources checked to determine if any conflicts have occurred. If a
conflict occurs, the application must read the data and attempt the change again.

Question 9 of 20

5.0/ 5.0 Points

If the DSN (Data Source Name) has to be used with SQL Server, which namespace has to be imported ?


A. Sytem.Data.ODBC

B. Sytem.Data.ODBC


C. System.Data.SQLClient

D. System.Data.Oledb

Question 10 of 20

Database connectivity with ADO has 3 main objects:

A. All of the above

B. ADODB.Recordset

C. ADODB.Command

D. ADODB.Connection

5.0/ 5.0 Points


Question 11 of 20

5.0/ 5.0 Points

Which of the following Namespace is used for better performance when connecting to SQLServer ?

A. System.Data.Oledb

B. System.Data

C. System.Data.SQLClient


D. System.Data.OracleClient

Question 12 of 20

5.0/ 5.0 Points

Which method of DataTable can be used to return all changed rows since it was last loaded?

A. GetChanged()

B. GetChanges()


C. GetUpdated()

D. FindChanges()

Question 13 of 20

5.0/ 5.0 Points

Which of the following statements is true about Dataset ?

A. Dataset can store only one table in its cache

B. Dataset cannot store any tables in the cache

C. Dataset can store multiple tables in cache


D. Dataset stores tables in the cache,only when cache set to true

Question 14 of 20

How do the SQL classes in .Net Communicate to SQLServer ?

A. TDS - Tabular Data Stream

0.0/ 5.0 Points


B. OLEDB

C. ODBC

D. None of the above

Question 15 of 20

5.0/ 5.0 Points

What is a connection string?

A. Specifies the type of ODBC driver to use, database format and filename

B. Specifies whether to use a DSN or DSN-less connection

C. Opens the initial connection to a database

D. Specifies which type of database is being used


Question 16 of 20

DataSet object contains :

3.33/ 5.0 Points


A.DataRow

B.DataTable

C.DataRelation

D.DataColumn

Question 17 of 20

5.0/ 5.0 Points

Which method do you invoke on the Data Adapter control to load your generated dataset?

A. ExecuteQuery( )

B. Fill()

C. Read( )

Question 18 of 20


5.0/ 5.0 Points

You have code that executes SQL statements on a database within the context of a SQLTransaction. You


want to ensure that no user can perform any updates in the database until your transaction is complete.
What IsolationLevel should you use?

A. Serializable

B. ReadUncommitted

C. Chaos

D. ReadCommitted

Question 19 of 20

Which object of ADO.NET has the best performance for retrieving the data

A. Dataadapter

B. Data Provider

C. DataReader

5.0/ 5.0 Points


D. DataSet


Question 20 of 20

0.0/ 5.0 Points

You decide to use named parameters in a SqlCommand object in order to execute SQL queries on a
database. You have a parameter named “CustomerName”. How do you refer to it within the SQL query
text in the SqlCommand object?

A. “#CustomerName”

B. “%CustomerName”

C. “@CustomerName”

D. “?CustomerName”

Part 1 of 1 -

Question 1 of 20

Permistic concurency means

65.0/ 100.0 Points

0.0/ 5.0 Points


A. ...... control works on the assumption that resource conflicts between multiple users are
unlikely (but not impossible), and allows transactions to execute without locking any resources. Only

when attempting to change data are resources checked to determine if any conflicts have occurred. If a
conflict occurs, the application must read the data and attempt the change again.
B. ….whatever data modification was made last gets written to the database.

C. …. control locks resources as they are required, for the duration of a transaction. Unless
deadlocks occur, a transaction is assured of successful completion.

Question 2 of 20

5.0/ 5.0 Points

What is the sequential procedure in working with databases?

A. Connection object, connection string, close connection object, close connection string

B. Connection string, connection object, close connection string, close connection object

C. Connection object, connection string, close connection string, close connection object

Question 3 of 20

5.0/ 5.0 Points

Which method of DataTable can be used to return all changed rows since it was last loaded?


A. GetChanged()

B. GetChanges()


C. GetUpdated()

D. FindChanges()

Question 4 of 20

5.0/ 5.0 Points

Which of the following Namespace is used for better performance when connecting to SQLServer ?

A. System.Data.Oledb

B. System.Data

C. System.Data.SQLClient

D. System.Data.OracleClient


Question 5 of 20

5.0/ 5.0 Points

You have code that executes SQL statements on a database within the context of a SQLTransaction. You
want to ensure that no user can perform any updates in the database until your transaction is complete.
What IsolationLevel should you use?

A. Serializable

B. ReadUncommitted


C. Chaos

D. ReadCommitted

Question 6 of 20

Which type of Dataset supports schema ?

A. Mixed

B. Typed

5.0/ 5.0 Points


C. UnTyped

D. Mixed

Question 7 of 20

5.0/ 5.0 Points

Which connection method requires a connection string?

A. DSN-less

B. Both


C. DSN

Question 8 of 20

Base class for TypedDataset is ?

A. DataReader

B. DataSet

5.0/ 5.0 Points


C. DataAdapter

Question 9 of 20

5.0/ 5.0 Points

Chose valid value for datarowstates !

A.Detached

B.Modified

C.Deleted

D.Added

Question 10 of 20


How many types of Concurrency handling techniques in ADO.NET ?

A. 4

0.0/ 5.0 Points


B. 3

C. 2

D. 1

Question 11 of 20

5.0/ 5.0 Points

Which object in ADO.Net is similar to the Recordset object of ADO ?

A. DataProvider

B. DataProvider

C. DataReader

D. DataSet

Question 12 of 20


Which of the following is not a member of ADODBCommand object?

0.0/ 5.0 Points


A. ExecuteScalar

B. Open

C. ExecuteReader

D. ExecuteStream

Question 13 of 20

5.0/ 5.0 Points

How to get a DataReader object from Command object?

A. Command.GetAllReader()

B. Command.ExecuteReader()

C. Command.GetReader()

Question 14 of 20

What's wrong with these code:
using System;
using System.Data;


5.0/ 5.0 Points


using System.Data.SqlClient;
class Program
{
static void Main(string[] args)
{
string sqlConnectString = ""Data Source=(local);"" +
""Integrated security=SSPI;Initial Catalog=AdventureWorks;"";
string sqlSelect = ""SELECT TOP 3 * FROM Sales.SalesOrderHeader;"" +
""SELECT TOP 3 * FROM Sales.SalesOrderDetail"";
int rsNumber;
SqlDataAdapter da = new SqlDataAdapter(sqlSelect, sqlConnectString);
DataSet ds = new DataSet( );
da.Fill(ds);
rsNumber = 0;
foreach (DataTable dt in ds.Tables)
{
Console.WriteLine(""Result set: {0}"", ++rsNumber);
foreach (DataRow row in dt.Rows)
{
Console.WriteLine(""{0}, {1}, {2}"", row[0], row[1], row[2]);
}
}
}
}

A. Run time error, multi result set is not supported by ADO.NET


B. Nothing wong, multi result set is supported by ADO.NET

Question 15 of 20

Which object that bellowed statements describe about?
Its is Read only !
Its connected to datasource
You must manage connection your self

0.0/ 5.0 Points


It use fewer server resource

A. DataReader

B. DataView

C. DataTable

D. Dataset

Question 16 of 20

0.0/ 5.0 Points

You decide to use named parameters in a SqlCommand object in order to execute SQL queries on a
database. You have a parameter named “CustomerName”. How do you refer to it within the SQL query
text in the SqlCommand object?


A. “#CustomerName”

B. “%CustomerName”

C. “@CustomerName”


D. “?CustomerName”

Question 17 of 20

5.0/ 5.0 Points

Which internal format DataSet uses to load and persist its contents?

A. Which internal format DataSet uses to load and persist its contents?

B. Binary Format

C. No format is required

D. CSV Format

Question 18 of 20

What is a connection string?

A. Specifies the type of ODBC driver to use, database format and filename


0.0/ 5.0 Points


B. Specifies whether to use a DSN or DSN-less connection

C. Opens the initial connection to a database

D. Specifies which type of database is being used

Question 19 of 20

5.0/ 5.0 Points

Two users are trying to update the row in a database at the same time.Assuming that optimistic
concurrency is not used for concurrency control in this case, what will be the result ?

A. The Second Update overwrites the first update

B. Error will be raised when the Second update happens

C. Second update does not happen at all

D. None of the above

Question 20 of 20

Which Dataset gives easier access to the contents of the table ?

0.0/ 5.0 Points



A. Typed

B. UnTyped

C. Mixed

Part 1 of 1 -

Question 1 of 20

61.25/ 100.0 Points

0.0/ 5.0 Points

OLEDB Connection Pooling is handled by OLEDB.Net Provider and SQLClient Connection pooling is
handled by

A. Windows 2000 Component Service

B. OLEDB Provider

C. SQL Provider


D. ODBC provider

Question 2 of 20

5.0/ 5.0 Points


What must your ASP code have if you are using the DSN method of connecting?

A. Both

B. Connection object

C. Connection string

Question 3 of 20

The "RejectChanges" method of Dataset is used to :

A. "Commits the changes
"
B. remove all datarow in it

5.0/ 5.0 Points


×