Loading, please wait...

MCQ

Ado.net Multiple choice questions and answer

In this article, we will go through the Ado.net multiple choice question and answers. It will help us brush up our knowledge about Ado.net .

1) To perform asynchronous data access, what must be added to the connection string?

  1. BeginExecute=true
  2. MultiThreaded=true
  3. MultipleActiveResultSets=true
  4. Asynchronous=true

Answer : 4

2) Can you use a DataView to filter rows in a DataTable

  1. Yes, by setting the Filter property of the DataView
  2. Yes, by setting the RowFilter property of the DataView
  3. Yes, by using the SetFilter(. method of the DataView
  4. No, a DataView cannot be used to filter rows in a DataTable

Answer : 2

3) Which is a property of the DataGrid control?

  1. DataMember
  2. DataSource
  3. DataQuery
  4. All of the above.

Answer : 4

4) In a connection string _____________ represents name of the database

  1. Data Source
  2. Initial Catalog
  3. Catalog Initial
  4. Database

Answer : 2

5)   What are the Command Object Methods?

  1. ExecuteNonQuery
  2. ExecuteReader
  3. ExecuteScalar
  4. All of the above.

Answer : 4

6) When you create a relationship between tables in ADO.NET DataSet

  1. A UniqueConstraint is added to the parent table
  2. A ForeignKeyConstraint is added to the child table by default
  3. Both a and b
  4. None

Answer : 3

7) The first record in a dataset has a position property of:

  1. zero
  2. one
  3. any value defined by the programmer
  4. All of the above

Answer : 1

8)  Which ado.net class provide disconnected environment?

  1. DataReader
  2. DataSet
  3. Command
  4. None of the above.

Answer : 2

9) What information is specified in the Connection tab of the DataLink window?

  1. Database login
  2. Database name
  3. Database type
  4. All of the above.

Answer : 4

10) Which of the following is true for ADO.NET DataSet?

  1. DataSet provides a disconnected view of a data source.
  2. Dataset enables to store data from multiple tables and multiple sources
  3. We can create relationship between the tables in a DataSet.
  4. All of above are true

Answer : 4

11) Which file you should write for the connection string, so that you can access it in all the web pages for the same application?

  1. In App_Data folder
  2. In Web.config file
  3. In MasterPage file
  4. None of the above

Answer : 2

12) Which of the following is not a DataReader method?

  1. NextResult
  2. GetName
  3. GetValue
  4. GetDataType

Answer : 4

13) Which database is the ADO.NET SqlConnection object designed for?

  1. Access
  2. Microsoft SQL Server
  3. MySQL
  4. Oracle

Answer : 2

14) The data is stored in a Microsoft SQL Server database on a server named Admin and the Database name is Diploma. You connect to Diploma by using Windows authentication mode.You use a SqlConnection object to connect to the database. Then which is the correct connection string from below?

  1. Data Source=Admin\SQLEXPRESS;Initial Catalog=Diploma;Integrated Security=True
  2. Data Source=Admin/SQLEXPRESS;Initial Catalog=Diploma;Integrated Security=True
  3. Data Source=Admin\SQLEXPRESS;Initial Catalog=Diploma;Integrated Security=False
  4. All of the Above

Answer : 1

15) Choose the correct option about the Integrated Security property of connection object.

  1. If Integrated Security=false then User ID, and Password must be specified in the connection string.
  2. If Integrated Security=true then current Windows account credentials are used for authentication.
  3. Both A and B option are correct.
  4. None of the above.

Answer : 3

16) The first step of configuring a DataAdapter is to select:

  1. An adapter object.
  2. A connection object.
  3. A database object.
  4. A dataset object.

Answer : 2

17) To check the status of the connection, ____ property is useful

  1. ConnectionStatus
  2. Status
  3. State
  4. ConnectionState

Answer : 3

18) Which is not an ADO.NET DataAdapter Object?

  1. OleDbDataAdapter
  2. SQLDataAdapter
  3. QueryDataAdapter
  4. All of the above.

Answer : 3

19) Which type of object has the Generate Dataset method?

  1. Adapter object
  2. Connection object
  3. Database object
  4. Dataset object

Answer : 1

20) Which of the following illustrates the benefit of ADO.NET?

  1. Interoperability
  2. It uses DataSet to represent data in memory that can store data from multiple tables and multiple sources.
  3. Disconnected data access
  4. All of above

Answer : 4

21) Which object does the data-aware control bind to?

  1. Dataset
  2. DataAdapter
  3. Connection
  4. All of the above.

Answer : 1

22) Which object contains the Position property of the current record in a dataset?

  1. BindingContext
  2. BindingData
  3. DataBinding
  4. DataBound

Answer : 1

23) Which below is specified by the DataSource Property?

  1. Connection object
  2. DataAdapter object
  3. Database field
  4. Dataset object

Answer : 3

24) Which of the following method of the command object is best suited when you have aggregate functions in a SELECT statement?

  1. ExecuteScalar
  2. ExecuteReader
  3. ExecuteNonQuery
  4. None

Answer : 1

25) What data type is returned when calling the ExecuteScalar method of a command object?

  1. System.Int32
  2. Object
  3. No of effected records.
  4. None of the above.

Answer : 2

26)To perform Insert, Update and Delete Command which method is used?

  1. ExecuteScalar
  2. ExecuteReader
  3. ExecuteNonQuery
  4. None

Answer : 3

27) Which DataAdapter Query Type can be used with the Access database?

  1. Use SQL statements.
  2. Create new stored procedure.
  3. Use existing stored procedure.
  4. All of the above.

Answer : 1

28) What is the proper code to put data into the dataset called EmployDataset using the EmployDataAdapter object?

  1. EmployDataset.Fill(EmployDataAdapter)
  2. EmployDataAdapter.Fill(EmployDataset)
  3. EmployDataset.Load(EmployDataAdapter)
  4. EmployDataAdapter.Load(EmployDataset)

Answer : 2

29) Which of the following is the method provided by the DataSet object to generate XML?

  1. ReadXML
  2. WriteXML
  3. 3.GetXML
  4. All of the above

Answer: 4

30) The default timeout for SqlCommand.Command timeout property

  1. 10 Seconds
  2. 20 Seconds
  3. 30 Seconds
  4. 40 Seconds

Answer : 3

MCQ

Related Article