Google News
logo
ADO.NET - Quiz(MCQ)
A)
All Data Object
B)
Access Data Object
C)
ActiveX Data Object
D)
ActiveX DataSet Object

Correct Answer : Option (C) :   ActiveX Data Object


Explanation : ADO.NET stands for ActiveX Data Object is a database access technology created by Microsoft as part of its . NET framework

A)
SqlInfo
B)
SqlBulkCopyOptions
C)
SqlNotification
D)
All of the above

Correct Answer : Option (B) :   SqlBulkCopyOptions


Explanation : Bitwise flag that specifies one or more options to use with an instance of SqlBulkCopy.

A)
Asynchronous=true
B)
BeginExecute=true
C)
MultiThreaded=true
D)
MultipleActiveResultSets=true

Correct Answer : Option (A) :   Asynchronous=true

A)
Command
B)
Connection
C)
Data Reader
D)
All of the above

Correct Answer : Option (D) :   All of the above

A)
SetName
B)
DataSetName
C)
DefaultSetName
D)
DefaultViewManager

Correct Answer : Option (B) :   DataSetName

A)
True
B)
False
C)
None of the Above
D)
--

Correct Answer : Option (A) :   True


Explanation : True, ADO.NET provides a bridge between the front end controls and the back end database.

A)
GetXML
B)
ReadXML
C)
WriteXML
D)
All of the above

Correct Answer : Option (D) :   All of the above

A)
Yes, by setting the Filter property of the DataView
B)
Yes, by using the SetFilter(. method of the DataView
C)
Yes, by setting the RowFilter property of the DataView
D)
No, a DataView cannot be used to filter rows in a DataTable

Correct Answer : Option (C) :   Yes, by setting the RowFilter property of the DataView

A)
Database
B)
Initial Catalog
C)
Data Source
D)
Catalog Initial

Correct Answer : Option (B) :   Initial Catalog

A)
Interoperability
B)
Disconnected data access
C)
It uses DataSet to represent data in memory that can store data from multiple tables and multiple sources.
D)
All of the above

Correct Answer : Option (D) :   All of the above

A)
Clone
B)
Copy
C)
EndInit
D)
BeginInit

Correct Answer : Option (A) :   Clone


Explanation : Clone : Copies the structure of the DataSet, including all DataTable schemas, relations, and constraints. Does not copy any data.

A)
True
B)
False
C)
None of the Above
D)
--

Correct Answer : Option (B) :   False


Explanation : The goal of dotConnect for SQL Server is to enable developers to write efficient and flexible database applications. The dotConnect for SQL Server assemblies are implemented using optimized code and advanced data access algorithms.

A)
sqlConn.open() and sqlConn.Close()
B)
sqlConn.Open() and sqlConn.close()
C)
sqlConn.Open() and sqlConn.Close()
D)
None of the above

Correct Answer : Option (C) :   sqlConn.Open() and sqlConn.Close()


Explanation : The Close method rolls back any pending transactions and releases the Connection from the SQL Server Database.

A)
DataQuery
B)
DataMember
C)
DataSource
D)
All of the above.

Correct Answer : Option (D) :   All of the above.

A)
Fill
B)
ReadData
C)
Update
D)
FillSchema

Correct Answer : Option (B) :   ReadData

A)
A UniqueConstraint is added to the parent table
B)
A ForeignKeyConstraint is added to the child table by default
C)
Both (A) and (B)
D)
None of the Above

Correct Answer : Option (C) :   Both (A) and (B)

A)
Zero
B)
One
C)
Any value defined by the programmer
D)
All of the above

Correct Answer : Option (A) :   zero

A)
Extra data binding capabilities
B)
Ability of monitoring query execution
C)
Supports the latest versions of SQL Server
D)
All of the above

Correct Answer : Option (D) :   All of the above


Explanation : dotConnect for SQL Server includes base-class-based provider model, provider factories, connection string builder, metadata schemas, asynchronous commands, pooling enhancements, batch update support, provider-specific types, server enumeration, database change notification support and so on.

A)
DataSet
B)
ParentColumns
C)
ParentDataSet
D)
ParentRelations

Correct Answer : Option (A) :   DataSet

A)
DataSet
B)
DataAdapter
C)
Both (A) and (B)
D)
None of the above

Correct Answer : Option (C) :   Both (A) and (B)

A)
Server=host\sqlexpress
B)
Server=localhost\sqlexpress
C)
Server=local\sqlexpress
D)
Ser=localhost\sqlexpress

Correct Answer : Option (B) :   Server=localhost\sqlexpress


Explanation : An instance of the SqlConnection class in .NET Framework is supported by the Data Provider for SQL Server Database.

A)
ADO.NET doesn't support disconnected architecture
B)
ADO.NET enables to create distributed data sharing applications
C)
The classes of ADO.NET are defined in the System.Data namespace
D)
ADO.NET uses XML to transfer data across applications and data source

Correct Answer : Option (A) :   ADO.NET doesn't support disconnected architecture


Explanation : Bitwise flag that specifies one or more options to use with an instance of SqlBulkCopy.

A)
DataSet provides a disconnected view of a data source.
B)
Dataset enables to store data from multiple tables and multiple sources
C)
We can create relationship between the tables in a DataSet.
D)
All of above are true

Correct Answer : Option (D) :   All of above are true

24 .
State whether the following statements about the command object are True or False.

i) The command object exposes parameters and can execute in the scope of a transaction from a connection.
ii) Command object performs the standard select, Insert, Delete and Update T-SQL operations.
iii) ConnectionType and CommandText are the properties of the command object.
A)
i-True, ii-True, iii-True
B)
i-False, ii-True, iii-True
C)
i-False, ii-True, iii-False
D)
i-True, ii-True, iii-False

Correct Answer : Option (D) :   i-True, ii-True, iii-False

25 .
State whether the following statements about the typed dataset are True or False.

i) It is the class that derives from a Dataset.
ii) It provides strongly typed methods, events, and properties.
A)
i-True, ii-True
B)
i-False, ii-True
C)
i-True, ii-False
D)
i-False, ii-False

Correct Answer : Option (A) :   i-True, ii-True

A)
VB.Net
B)
C#.Net
C)
ADO.Net
D)
ASP.Net

Correct Answer : Option (C) :   ADO.Net

27 .
Which of the following are the benefits of ADO.Net.

i) Interoperability
ii) Maintainability
iii) Performance
iv) Visibility
A)
i, iii and iv only
B)
i, ii and iii only
C)
ii, iii and iv only
D)
All i, ii, iii and iv

Correct Answer : Option (B) :   i, ii and iii only

A)
Root Table
B)
Data Relation
C)
Data Table
D)
System Table

Correct Answer : Option (B) :   Data Relation

A)
ODBC provider
B)
OLEDB provider
C)
SQLServer Data provider
D)
SQLServer .NET Data Provider

Correct Answer : Option (D) :   SQLServer .NET Data Provider

A)
ADO
B)
ADO.NET
C)
Both (A) and (B)
D)
None of the above

Correct Answer : Option (A) :   ADO

A)
XML Format
B)
Text Stream
C)
Binary format only
D)
None of the above

Correct Answer : Option (A) :   XML Format

A)
ExecuteReader
B)
ExecuteNonQuery
C)
ExecuteScalar
D)
None of the Above

Correct Answer : Option (C) :   ExecuteScalar

A)
RowChanged
B)
RowChanging
C)
ColumnChanged
D)
All of the above

Correct Answer : Option (D) :   All of the above

A)
Root Table
B)
Data Table
C)
System Table
D)
Data Relation

Correct Answer : Option (B) :   Data Table

A)
ExecuteCommand()
B)
ExecuteReader()
C)
ExecuteScalar()
D)
ExecuteXmlReader()

Correct Answer : Option (B) :   ExecuteReader()

36 .
State whether the following statements about ADO.Net are True or False.

i) ADO.Net allows you to access data through typed programming.
ii) It is the CLR-based library.
iii) It works in the connected mode to access data.
A)
i-True, ii-True, iii-False
B)
i-False, ii-True, iii-True
C)
i-True, ii-True, iii-True
D)
i-False, ii-True, iii-False

Correct Answer : Option (A) :   i-True, ii-True, iii-False

37 .
Which of the following are the advantages of ADO.Net compared to classic ADO.

i) Locking feature is available.
ii) XML integration is possible.
iii) It uses Dataset to store the data from the data source.
A)
i and ii only
B)
i and iii only
C)
ii and iii only
D)
All i, ii and iii

Correct Answer : Option (C) :   ii and iii only

A)
Data set
B)
Data bridge
C)
Data reader
D)
Data Adapter

Correct Answer : Option (A) :   Data set

39 .
Which of the following are the methods of data adapter object.

i) Fill()
ii) Read()
iii) Update()
A)
i and ii only
B)
ii and iii only
C)
i and iii only
D)
All i, ii and iii

Correct Answer : Option (C) :   i and iii only

A)
In App_Data
B)
In App_Data folder
C)
In MasterPage file
D)
In Web.config file

Correct Answer : Option (D) :   In Web.config file

A)
State
B)
Status
C)
ConnectionState
D)
ConnectionStatus

Correct Answer : Option (A) :   State

A)
SQLDataAdapter
B)
OleDbDataAdapter
C)
QueryDataAdapter
D)
All of the above.

Correct Answer : Option (C) :   QueryDataAdapter

A)
Data reader
B)
Data Adapter
C)
Data bridge
D)
Data object

Correct Answer : Option (B) :   Data Adapter

A)
Data object
B)
Data bridge
C)
Data Adapter
D)
Data reader

Correct Answer : Option (D) :   Data reader

A)
ExecuteScalar()
B)
ExecuteReader()
C)
ExecuteCommand()
D)
ExecuteNonQuery()

Correct Answer : Option (D) :   ExecuteNonQuery()

46 .
State whether the following statements about the data reader are True or False.

i) It reads a forward-only, read-only stream of data from a data source.
ii) It works in a connected model.
iii) Fill() is the method of data reader object.
A)
i and ii only
B)
i and iii only
C)
ii and iii only
D)
All i, ii and iii

Correct Answer : Option (A) :   i and ii only

A)
Use DataViev object with each sort
B)
Use Sort method of DataTable
C)
Use Sort method of DataSet
D)
Use datapaging and sort the data.

Correct Answer : Option (A) :   Use DataViev object with each sort


Explanation :

DataView.Sortproperty allow you to sort data. Using a DataView, you can show the data in a table with different sort orders.

Example : In this example our table name is StudentMaster.

public partial class Default5 : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("provide connection string");
SqlDataAdapter da;
protected void Page_Load(object sender, EventArgs e)
{
string query = "select * from StudentMaster";
da = new SqlDataAdapter(query, con);
DataSet ds = new DataSet();
da.Fill(ds);
DataView dv = new DataView();
dv = ds.Tables[0].DefaultView;
dv.Sort = "studName";
DataTabledt = dv.Table;
GridView1.DataSource = dt;
GridView1.DataBind();
}
}

A)
It is any type defined in the SqlDbDataTypeenumeration.
B)
It is the type of column in a DataTablethat it represents.
C)
It is the type of column or data in SQL Server that the command expects.
D)
It is the .NET Framework data type in your application that the parameter represents.

Correct Answer : Option (C) :   It is the type of column or data in SQL Server that the command expects.

A)
int, varchar, nvarchar
B)
Input, Integer, String
C)
Integer, String, DateTime
D)
Input, Output, InputOutput

Correct Answer : Option (D) :   Input, Output, InputOutput


Explanation : There are three types of parameters that you can use in a .NET Framework and those are Input, Output, InputOutput . Parameters are like variables that you can use to pass and return values between your application and a database. The types of parameters are defined by SqlDbTypeenumeration. It contains a list of the types available in SQL Server. These parameter values are pass to SQL statements and stored procedures. SQL Server uses the @ symbol as a prefix to denote parameters.

Parameters are Input parameters by default. You can change its direction by using ParameterDirection property.
 
Example :
SqlParameterparaObj = new SqlParameter();
paraObj.ParameterName = "@TotalCost";
paraObj.SqlDbType = SqlDbType.Money;

A)
Set the Command.CommandTypeproperty to multiple result sets.
B)
Call the ExecuteReadermethod of a single Command object twice.
C)
Set the Command.CommandTextproperty to multiple SQL statements delimited by a semicolon.
D)
Call the ExecuteReadermethod of two Command objects and assign the results tothe same instance of a DataReader.

Correct Answer : Option (C) :   Set the Command.CommandTextproperty to multiple SQL statements delimited by a semicolon.


Explanation :

You can execute more than one SQL statements delimited by a semicolon.

For this you have to set the CommandText property of a Command object to multipleSQL statements separated by semicolons (;). After calling the ExecuteReader method, theDataReader will hold the number of result sets equal to the number of SQL statements executed.
 
Example :
String sqlQuery = ”select * from table1; select * from table2”;
SqlConnection con = new SqlConnection(connectionString);
SqlCommandcmd = new SqlCommand ();
Con.Open();
SqlDataReaderdr = cmd.ExecuteReader();

While(dr.read())
{
// Process the table1
}
Dr.NextResult();

While(dr.read())
{
// Process the table2

}

A)
10 Seconds
B)
20 Seconds
C)
30 Seconds
D)
40 Seconds

Correct Answer : Option (C) :   30 Seconds

A)
EmployDataAdapter.Fill(EmployDataset)
B)
EmployDataset.Load(EmployDataAdapter)
C)
EmployDataAdapter.Load(EmployDataset)
D)
EmployDataset.Fill(EmployDataAdapter)

Correct Answer : Option (A) :   EmployDataAdapter.Fill(EmployDataset)

53 .
What property contains the actual error message returned by SQL Server?
 
1. SqlException.Source
2. SqlException.Message
3. SqlError.Class
4. SqlError.Message
A)
1, 2
B)
1, 3
C)
1, 2, 3
D)
2, 4

Correct Answer : Option (D) :   2, 4


Explaination : SqlException.Message and SqlError.Messageproperty contains the actual error message returned by SQL Server.

54 .
OleDbConnectionobject works with?
 
1. When connecting to an Oracle database
2. When connecting to an Office Access database
3. When connecting to SQL Server 6.x or later
4. When connecting to SQL Server 2000
A)
1, 2
B)
2, 3
C)
1, 3
D)
4 Only

Correct Answer : Option (B) :   2, 3


Explaination :

OleDbConnection object is used to connect to SQL Server 6.x or later. It is also used to connect with access database.

Example of connection string :
Provider = Microsoft.ACE.OLEDB.12.0;
Data Source = C:\myFolder\myAccessFile.accdb;
Persist Security Info = False;​

A)
Use existing stored procedure.
B)
Use SQL statements.
C)
Create a new stored procedure.
D)
All of the above.

Correct Answer : Option (B) :   Use SQL statements.

A)
Typed
B)
Mixed
C)
UnTyped
D)
All types

Correct Answer : Option (A) :   Typed

A)
ODBC
B)
OLEDB
C)
Both (A) and (B)
D)
TDS - Tabular Data Stream

Correct Answer : Option (D) :   TDS - Tabular Data Stream

A)
SQL Provider
B)
ODBC provider
C)
OLEDB Provider
D)
Windows 2000 Component Service

Correct Answer : Option (D) :   Windows 2000 Component Service

A)
The JDBC data provider.
B)
The OLE DB data provider.
C)
The SqlClient data provider.
D)
The Oracle data provider

Correct Answer : Option (C) :   The SqlClient data provider.


Explanation :

The SqlClient data provider gives the maximum performance from a connection to SQL Server.

Data provider works as a bridge between an application and a data source.SQL Server.NET Data Provider available in the System.Data.SqlClient namespace.

A)
Object
B)
System.Int32
C)
No. of effected records
D)
None of the above

Correct Answer : Option (A) :   Object

A)
getXML
B)
getXMLData
C)
ExecuteXMLReader
D)
None of the above.

Correct Answer : Option (C) :   ExecuteXMLReader

62 .
The three statements are given below about DataSet and DataReader, choose the correct option according to the statement.
 
Statement 1: DataSet Provides Disconnected environment but DataReader provides Connected environment.
Statement 2: DataSet Provides Connected environment but DataReader provides Disconnected environment.
Statement 3: DataSet Can store multiple table simultaneously but DataReader Supports a single table based on a single SQL query.
A)
Only Statement 1 is correct.
B)
Statement 1 and 2 is correct.
C)
Statement 1 and 3 is correct.
D)
Statement 2 and 3 is correct.

Correct Answer : Option (C) :   Statement 1 and 3 is correct.

63 .
You want to secure the connection strings contained within your Web.config file to ensure that no one can open the file easily and see the connection information. Which tool must you use to encrypt the connection strings?
A)
ASPNET_WP.EXE
B)
ASPNET_REGIIS.EXE
C)
ASPNET_REGSQL.EXE
D)
None of the above.

Correct Answer : Option (B) :   ASPNET_REGIIS.EXE

A)
DataTable, DataColumn, and type.
B)
DataReader,DataAdapter, and Command.
C)
DataTable, DataRelation, and DataAdapter.
D)
DataTable, DataColumn, and DataRelation.

Correct Answer : Option (D) :   DataTable, DataColumn, and DataRelation.

A)
Set ResultSets=True
B)
Set MultipleActiveResultSets=True
C)
Set MultipleResultSets=true
D)
None of the above.

Correct Answer : Option (B) :   Set MultipleActiveResultSets=True