CodeKicks.com
Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Wednesday, June 11, 2008

ADO.NET FAQs & Interview Questions

image Description 

To introduce ADO.NET and to describe how to make connections to databases and run stored procedures and SQL statements in a connected design

1. Which of the following statements about stored procedures are true?
Choose more than one option.
1. They reside on the client
2. They reside on the server True
3. You can encapsulate multiple SQL statements in a stored procedure True
4. You encapsulate a single SQL statement in each stored procedure

Topic title: Architecture of ADO.NET
2. Which of the following fully qualified names describes the data adapter for a SQL 2000 server?
Choose an option.

System.Data.SqlClient.DataAdapter

System.Data.SqlClient.SqlDataAdapter  True

System.Data.SqlDataAdapter

System.Xml.SqlDataAdapter

Topic title: Working with ADO.NET connections in VB.NET
3. Assuming that ReadNextOrder expects one parameter, which options accurately describe this code?

Dim cnnOrders As SqlConnection
Dim cmd As SqlCommand, drOrders As SqlDataReader
cmd = New SqlCommand ("ReadNextOrder", cnnOrders)
drOrders = cmd.ExecuteReader ()
Choose more than one option.

The connection must be opened explicitly True

The CommandType property must be set to StoredProcedure True

The ExecuteNonQuery method should be used for all stored procedures

The ExecuteReader method call will fail because no parameter has been added to the Parameters collection True

Topic title: Distributed data-access requirements
4. Which of the following attributes in a ConnectionString specifies the SQL Server server used when a connection is open?

Choose an option.

Initial Catalog

Provider

Data Source True

ConnectionTimeout

Topic title: Distributed data-access requirements
5. Connected data-access applications are generally ___________ more than disconnected data-access applications.
Choose an option below to fill in the blank.

complicated
distributed
scalable
secure True
suited to the Internet

Topic title: Pooling ADO.NET connections in VB.NET
6. Which of the following statements about the DataReader object are true?
Choose more than one option.

The DataReader points to the first row of the result set after Read is first called True

You create a new DataReader using one of several overloaded constructors

You use the ExecuteScalar method of the Command object to obtain a DataReader

You use the NextResult method on the DataReader to get the next result set True

Topic title: Pooling ADO.NET connections in VB.NET
7. Which of the following methods of a DataReader enable you to obtain column metadata?
Choose more than one option.

GetString

GetName True

GetOrdinal True

GetSchemaTable True

GetDateTime

Topic title: Defining an ADO.NET Connection object in VB.NET
8. Which of the following are implementations of Command classes for .NET data providers?
Choose more than one option.

OdbcCommand objects True

OleDbCommand objects True

SqlCommand objects True

XMLCommand objects

Topic title: Defining an ADO.NET Connection object in VB.NET
9. Which of the following SqlConnection.ConnectionString attributes determines the number a seconds a connection can stay in a pool?
Choose an option.

Connection Duration

Connection Lifetime True

Connection TimeOut

Connection Reset

Topic title: Pooling ADO.NET connections in VB.NET
10. To specify the name of a stored procedure in .NET code, you use a _____________ object.
Choose an option below to fill in the blank.

DataSet
SqlCommand True
SqlConnection
SqlDataAdapter

Topic title: Architecture of ADO.NET
Which of the following objects exclusively contains metadata about tables?
Choose an option.

The DataColumn object True

The DataRow object

The DataView object

The SqlDataAdapter object

Topic title: Distributed data-access requirements
11. Which of these namespaces do you need to reference to connect to a SQL database using the .NET provider for OLEDB?
Choose more than one option.

System.Data True

System.Data.Connect

System.Data.Oledb True

System.Data.SqlClient

Topic title: Architecture of ADO.NET
13. What happens when you try to make the following assignment to an OleDbConnection.ConnectionString property and then try to open that connection?
cnNew.ConnectionString = "Data Source=8044DYSZ033R\SQLLOCAL; Initial" & _ "Catalog=Northwind; User ID=sa;"
cnNew.Open()
Choose an option.

It fails to compile

It compiles and runs correctly

It compiles but throws an ArgumentException because no Provider is included True

It compiles but throws an OleDbException when you attempt to open it

Topic title: Architecture of ADO.NET
14. What happens when you try to make the following assignment to an OleDbConnection.ConnectionString property and then try to open that connection?
cnNew.ConnectionString = "Data Source=8044DYSZ033R\SQLLOCAL; Initial" & _ "Catalog=Northwind; User ID=sa;"
cnNew.Open()
Choose an option.

It fails to compile

It compiles and runs correctly

It compiles but throws an ArgumentException because no Provider is included True

It compiles but throws an OleDbException when you attempt to open it

Topic title: Working with ADO.NET connections in VB.NET
15. Which combination of classes do you use when passing arguments to a stored procedure through the SQL .NET Data Provider?
Choose an option.

Argument and SqlCommand

Parameter and SqlCommand

SqlArgument and SqlCommand

SqlParameter and SqlCommand True

Topic title: Working with ADO.NET connections in VB.NET
16. A Command object's property indicates whether an object encapsulates a stored procedure or a SQL statement, or is requesting a full table.
Choose an option below to fill in the blank.

Connection
CommandType True
CommandText
Parameters

Topic title: Architecture of ADO.NET
Which method releases unmanaged resources when a connection is closed?
Choose an option.

Delete

Dispose True

Open

Topic title: Working with ADO.NET connections in VB.NET
17. You use Visual Studio .NET's ___________ to create sequences of SQL commands.
Choose an option below to fill in the blank.

Toolbox
Query Analyzer tool True
Properties window

Topic title: Distributed data-access requirements
18. Which of the following attributes in a ConnectionString sets the name of the OLE DB or SQL database?
Choose an option.

Initial Catalog True

Provider

Data Source

ConnectionTimeout

Topic title: Architecture of ADO.NET
19. If a connection has a nonfatal error, the ____________ event is thrown.
Incorrect. The correct option is as follows

InfoMessage True
OleDbException
SqlException
StateChange

Topic title: Distributed data-access requirements
20. _______________ eliminates the need for database locks and protracted database connections and facilitates data exchange between tiers.
Choose an option below to fill in the blank.

A 2-tier application architecture
The use of in-memory data caches True
The use of strongly typed data
XML messaging

Topic title: Defining an ADO.NET Connection object in VB.NET
21. If both the ________________ of a client's Connection object match those of a dormant connection in a pool, the client can obtain a connection in that pool.
Choose an option below to fill in the blank.

connection context and database context
connection context and security context
security context and pooling context
security context and transaction context True

Topic title: Defining an ADO.NET Connection object in VB.NET
22. Which of the following SqlConnection.ConnectionString attributes specifies the number of connections that are automatically allocated to a new pool when it's created by a unique connection?
Choose an option.

Init Pool Size

Max Pool Size

Min Pool Size True

Start Pool Size

Topic title: Working with ADO.NET connections in VB.NET
23. When you are stepping through a stored procedure, which of the following types of information are displayed in the Autos window?
Choose more than one option.

Debug information

The contents of the call stack

The types of the procedure's variables True

The values of the procedure's variables True

Topic title: Defining an ADO.NET Connection object in VB.NET
24. Which of the following elements is always incorporated in a Command object?
Incorrect. The correct option is as follows


A Connection object True

A database table name

A set of parameters

A SQL statement string

The name of a stored procedure

Topic title: Pooling ADO.NET connections in VB.NET
25. The Read method returns the value _____________ when there is no more data to be read in a DataSet.
Choose an option below to fill in the blank.

Null
0
-1
False True

Topic title: Defining an ADO.NET Connection object in VB.NET
26. In which of the following situations is the use of a connected strategy always necessary?
Choose more than one option.

When you're using a web application that uses ASP.NET

When you're modifying database structure True

When you're performing operations directly on a database True

When you need to read data as XML

Topic title: Pooling ADO.NET connections in VB.NET
27. What is the default setting of the ParameterDirection property of a stored-procedure parameter?
Choose an option.

Input True

InputOutput

Output

ReturnValue

Topic title: Architecture of ADO.NET
28. Which of the following collections are encapsulated in the DataSet object?
Choose an option.

Adapters and Views

Commands and Connections

Rows, Columns, and Constraints

Tables and Relations True

Topic title: Distributed data-access requirements
29. In a tiered data-access application, each tier comprises a discrete ____________________.
Choose an option below to fill in the blank.

application server
group of users separated logically
section of application functionality True
set of application data

Topic title: Working with ADO.NET connections in VB.NET
30. The __________________ method returns the number of rows affected by the execution of a DDL command.
Choose an option below to fill in the blank.

ExecuteScalar
ExecuteReader
ExecuteXMLReader
ExecuteNonQuery True

Post a Comment