Interview Preparation Exam  >  Interview Preparation Notes  >  Placement Papers - Technical & HR Questions  >  ADO.NET (Part - 2), .NET Interview Questions

ADO.NET (Part - 2), .NET Interview Questions | Placement Papers - Technical & HR Questions - Interview Preparation PDF Download

23. Explain the architecture of ADO.NET in brief.

AD0.NET consists of two fundamental components:
The data provider contains the ConnectionCommandDataReader, and DataAdapter objects. The Connection object provides connectivity to the database. The Command object provides access to database commands to retrieve and manipulate data in a database. The DataReader object retrieves data from the database in the readonly and forward-only mode. The DataAdapter object uses Command objects to execute SQL commands. The DataAdapter object loads the DataSet object with data and also updates changes that you have made to the data in the DataSet object back to the database.

  • The DataSet, which is disconnected from the data source and does not need to know where the data that it holds is retrieved from.
  • The .net data provider, which allows you to connect your application to the data source and execute the SQL commands against it.


24. Describe the disconnected architecture of ADO.NET's data access model.

ADO.NET maintains a disconnected database access model, which means, the application never remains connected constantly to the data source. Any changes and operations done on the data are saved in a local copy (dataset) that acts as a data source. Whenever, the connection to the server is re-established, these changes are sent back to the server, in which these changes are saved in the actual database or data source.


25. What are the usages of the Command object in ADO.NET?

The following are the usages of the Command object in AD0.NET:

The Command object in AD0.NET executes a command against the database and retrieves a DataReader or DataSet object.
 

  • It also executes the INSERTUPDATE, or DELETE command against the database.
  • All the command objects are derived from the DbCommand class.
  • The command object is represented by two classes: SqlCommand and OleDbCommand.
  • The Command object provides three methods to execute commands on the database:
    • The ExecuteNonQuery() method executes a Transact-SQL statement against the connection and returns the number of rows affected.
    • The ExecuteScalar() method returns a single value from a database query.
    • The ExecuteReader() method returns a result set by using the DataReader object.


26. What are the pre-requisites for connection pooling?

The prerequisites for connection pooling are as follows:

  • There must be multiple processes to share the same connection describing the same parameters and security settings.
  • The connection string must be identical.


27. What is connection pooling?

Connection pooling refers to the task of grouping database connections in cache to make them reusable because opening new connections every time to a database is a time-consuming process. Therefore, connection pooling enables you to reuse already existing and active database connections, whenever required, and increasing the performance of your application.

You can enable or disable connection pooling in your application by setting the pooling property to either true or false in connection string. By default, it is enabled in an application.


28. What are the various methods provided by the DataSet object to generate XML?

The various methods provided by the DataSet object to generate XML are:

  • ReadXml() - Reads XML document into a DataSet object.
  • GetXml() - Returns a string containing an XML document.
  • WriteXml() - Writes an XML data to disk.


29. Out of Windows authentication and SQL Server authentication, which authentication technique is considered as a trusted authentication method?

The Windows authentication technique is considered as a trusted authentication method because the username and password are checked with the Windows credentials stored in the Active Directory.

The SQL Server Authentication technique is not trusted as all the values are verified by SQL Server only.


30. How would you connect to a database by using .NET?

The connection class is used to connect a .NET application with a database.
 

31. Which adapter should you use, if you want to get the data from an Access database?

OleDbDataAdapter is used to get the data from an Access database.


32. Which object is used to add a relationship between two DataTable objects?

The DataRelation object is used to add relationship between two DataTable objects.


33. What are different types of authentication techniques that are used in connection strings to connect .NET applications with Microsoft SQL Server?

.NET applications can use two different techniques to authenticate and connect with SQL Server. These techniques are as follows:

  • The Windows Authentication option
  • The SQL Server Authentication option


34. Explain the new features in ADO.NET Entity Framework 4.0.

ADO.NET Entity Framework 4.0 is introduced in .NET Framework 4.0 and includes the following new features:

  • Persistence Ignorance - Facilitates you to define your own Plain Old CLR Objects (POCO) which are independent of any specific persistence technology.
  • Deferred or Lazy Loading - Specifies that related entities can be loaded automatically whenever required. You can enable lazy loading in your application by setting the DeferredLoadingEnabledproperty to true.
  • Self-Tracking Entities - Refers to the entities that are able to track their own changes. These changes can be passed across process boundaries and saved to the database.
  • Model-First Development - Allows you to create your own EDM and then generate relational model (database) from that EDM with matching tables and relations.
  • Built-in Functions - Enables you to use built-in SQL Server functions directly in your queries.
  • Model-Defined Functions - Enables you to use the functions that are defined in conceptual schema definition language (CSDL).


35. What is the difference between the Clone() and Copy() methods of the DataSet class?

The Clone() method copies only the structure of a DataSet. The copied structure includes all the relation, constraint, and DataTable schemas used by the DataSet. The Clone() method does not copy the data, which is stored in the DataSet

The Copy() method copies the structure as well as the data stored in the DataSet.


36. What is the use of DataView?

User-defined view of a table is contained in a DataView. A complete table or a small section of table depending on some criteria can be presented by an object of the DataView class. You can use this class to sort and find data within DataTable.

The DataView class has the following methods:

  • Find() - Finds a row in a DataView by using sort key value.
  • FindRows() - Uses the sort key value to match it with the columns of DataRowView objects. It returns an array of all the corresponding objects of DataRowView whose columns match with the sort key value.
  • AddNew() - Adds a new row to the DataView object.
  • Delete() - Deletes the specified row from the DataView object according to the specified index.

 


37. What are the parameters that control most of connection pooling behaviors?

The parameters that control most of connection pooling behaviors are as follows:

  • Connect Timeout
  • Max Pool Size
  • Min Pool Size
  • Pooling

38. How can you add or remove rows from the DataTable object of DataSet?

The DataRowCollection class defines the collection of rows for the DataTable object in a DataSet. The DataTable class provides the NewRow() method to add a new DataRow to DataTable. The NewRow method creates a new row, which implements the same schema as applied to the DataTable. The following are the methods provided by the DataRowCollection object:

  • Add() - Adds a new row to DataRowCollection.
  • Remove()- Removes a DataRow object from DataRowCollection.
  • RemoveAt() - Removes a row whose location is specified by an index number.


39. Explain in brief DataAdapter class in ADO.NET.

The DataAdapter class retrieves data from the database, stores data in a dataset, and reflects the changes made in the dataset to the database. The DataAdapter class acts as an intermediary for all the communication between the database and the DataSet object. The DataAdapter Class is used to fill a DataTable or DataSet Object with data from the database using the Fill() method. The DataAdapter class applies the changes made in dataset to the database by calling the Update() method. 

The DataAdapter class provides four properties that represent the database command: 

SelectCommandInsertCommandDeleteCommand, and UpdateCommand.

 

The document ADO.NET (Part - 2), .NET Interview Questions | Placement Papers - Technical & HR Questions - Interview Preparation is a part of the Interview Preparation Course Placement Papers - Technical & HR Questions.
All you need of Interview Preparation at this link: Interview Preparation
85 docs|57 tests

Top Courses for Interview Preparation

85 docs|57 tests
Download as PDF
Explore Courses for Interview Preparation exam

Top Courses for Interview Preparation

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

pdf

,

shortcuts and tricks

,

past year papers

,

Important questions

,

Previous Year Questions with Solutions

,

Extra Questions

,

Objective type Questions

,

.NET Interview Questions | Placement Papers - Technical & HR Questions - Interview Preparation

,

study material

,

video lectures

,

Summary

,

ADO.NET (Part - 2)

,

Viva Questions

,

Exam

,

.NET Interview Questions | Placement Papers - Technical & HR Questions - Interview Preparation

,

ADO.NET (Part - 2)

,

ppt

,

MCQs

,

.NET Interview Questions | Placement Papers - Technical & HR Questions - Interview Preparation

,

practice quizzes

,

mock tests for examination

,

ADO.NET (Part - 2)

,

Sample Paper

,

Free

,

Semester Notes

;