ADO.Net interview questions and answers

1)What is ADO.NET?

   It is an object oriented technology given by the Microsoft.
   It can be used for communication with datasources from .net enabled application.

2)What is Data Source?
 
  Data source is nothing but where we can store the data and retrieve data for application .
  we can use different datacources in the .net enabled applications...
  Data sources are database, collection of objects,Xml documents and file system

3)What is the difference between connection oriented architecture and disconnected architecture?
         
              Connection oriented                                           disconnected
              -----------------------------                                         -------------------
         (a)the application with establish                    (a)the required data will be fetched
            connection with database server                 in to the dataset and the connection
            and it will be kept open and until                will be closed.
            task has been completed
                                          
         (b)for every operation of the database           (b)the required data manipulations will be
            we need to communicate with database       done on the tables in to the dataset and
            server, so that traffic to the                             then changes will be update back to the    
            database server will be increased                   database at once.
        
         (c)parallel transactions will be easy                 (c)parallel transactions will be difficult
        
         (d)fetching the data will be fast                        (d)fetching the data will be slow
         (e)no memory management is required           (e)memory management is required for the
                                                                                                            dataset.
4)What is connection pooling?
 
  It is a set of open connections maintained by the application.
  Whenever the application wants connection  to the database server it can  taken from the
   connection to the connection pool. Once task has been completed the connection will be return
   back to the connection pool, so that traffic to the database server can be reduced to open
   a connection and close a connection

5)Is the connection pool is the part of the ADO.NET?
 
  NO, it is a separate algorithm which is implemented by the .net data provider.

6)Where we can provide size of the connection pool?

  As a part of connection string

7)What is the .NET Data Provider?
 
  It is a collection of classes which are implementing standard interfaces given by
   the Microsoft as a part of  "System.Data" name space.
  .NET Data providers are
     (a)OLEDB .NET Data Provider
     (b)SQLserver .NET Data Provider
     (c)Oracle .NET Data Provider
     (d)ODBC .NET Data Provider
     (e)SQL Client .NET Data Provider
8)What is the .NET Data Provider used by the MySql?
  
ByteFxData
 CoreLabs

9)How many types of classes are existing in the ADO.Net?
 
  Two types of classes are existing in the ADO.Net
   they are
    (a)connection oriented classes:
            *connection oriented classes are designed as a part of the .net data provider.
            *all the connection oriented classes are designed according to the interfaces
              given by the Microsoft as a part of System.Data namespace.
            *Connection oriented classes are use full to communicate with different databases(local or remote)
          EX:connection,command,DataReader,DataAdaptor
    (b)content based classes:
  
             *content based classes objects are used to hold the data that has been fetched
               from different data sources.
             *all the content based classes designed as a part of System.Data namespace.
           Ex:DataSet,DataTable,DataRow,DataColumn.

10)What is the connection object?
  
  connection object can be used for prepare the connection, open the connection and close
   the connection.

11)What is the connection string?
  
 It will provide complete information of the database server.

12)What are the properties of the connection object?
  
   *ConnectionString:Specify connection string
   *ConnectionTimeOut:time in seconds how long the code has to wait before generating error if      connection cannot be established
   *DataBase:specify the name of database
   *state: it gives state of connection(open, closed)

13)What are the methods of the connection object?(Optional)
  
   *BeginTransaction()
   *ChangeDatabase()
   *Open()
   *CreateCommand()
   *Close()

14)What is the Command object?
  
   *it can be used for prepare and submit sql commands to database engine

15)What are the properties of the command object?
 
  *CommandText:specify command in the form of text or stored procedure
  *CommandType:text or stored procedure
  *Connection: specify connection object
  *CommandTimeOut:How long code has to wait before generating error report if command cannot be executed
  *Parameters

16)Wchich methods are submitting the command to the database engine?
  
   ExecuteReader():

          This method can be used to submit the sqlstatements to database engine. It will return one row
          or more than one row from database.

   ExecuteNonQuery():

         This method can be used to submit the DML commands to database engine. If the DML commands executed
         successfully it will return '1' otherwise it will return '0'.
    
   ExecuteScalar():
   
          This method can be used to submit the sqlstatements to databaseengine.which can return a
          single value.

17)What is DataReader?
  
   *DataReader object can be used for fetch a records one by one from the network buffer.
   *DataReader object can contain single record at a time.
  
18)What is DataSet?
  
   *DataSet is a virtual relational database. Which contains tables and relations.
   *Dataset is a bidirectional navigation and manipulation.
   *Dataset can be used for disconnected architecture why because it maintained the database tables without connecting the database.

19)What is the DataAdaptor?
 
   *it can be used for transmitting the data from database to dataset.
   *DataAdaptor will not perform storage, it will transmitting the data only.

20)What is the diff between DataReader and DataSet?

   *DataReader object can be used to fetch the records  one by one from the network buffer  whereas
    DataSet object can be used to fetch all the records at a time from the network buffer
   *DataReader object can contain single record at a time.
    Dataset object can contain multiple records at a time.

21)What is the difference between copy() and clone()?
  
   *copy method will copy the structure and data of the table.
   *clone method will copy the structure of the table.

22)What is the difference between close() and dispose()?
  
   *connection close with close method, it can be opened.
   *connection close with dispose method ,it cannot be opened.

23)What is the purpose of Fill()?
 
   *automatically connection will be open and fetch the data from database in to dataset.
   once fetch the data has been completed automatically connection will be closed.

24)What are DataSource controls?
 
  *Datasource control is programming component for connecting  to different type of data.
  *it acts like mediator between databound[gridview,datalist,...] controls and datasources
  *Datasource controls are:
   (a)Sqldatasource
   (b)Linqdatasource
   (c)Entitydatasource
   (d)Objectdatasource
   (e)Xmldatasource
   (f)Sitemapdatasource

25)What is purpose of read method?

  *read method can be used to fetch the record from network buffer.

26)What is the diff b/w command obj and command builder obj?

  *command object can be used prepare the command and submit the sql command to database engine and result set is given to the database engine and then send back to the application.
  *command builder can prepare the sql statements according to the operations done on the
  tables in the dataset and commands are assigned to the data adaptor.
 



Thanks for visiting this blog. How is the content?. Your comment is great gift to my work. Cheers.

No comments:

Post a Comment