ADO.Net interview questions for experienced/ADO.Net Interview Questions and Answers for Freshers & Experienced

Describe ADO.NET Architecture?

ADO.NET provides the efficient way to manipulate the database. It contains the following major components are :

* DataSet Object
* Data Providers :
›› Connection Object
››Command Object
››DataReader Object
››DataAdapter Object

Explain role-based security in .NET

Role-based security is used to implement security measures in .NET, based on the roles assigned to the users in the organization. In the organization, authorization of users is done based on their roles.

For example, windows have role-based access like administrators, users, and guests

What are MDI and SDI?

MDI (Multiple Document Interface): An MDI allows you to open multiple windows, it will have one parent window and as many child windows. The components are shared from the parent window like toolbar, menubar, etc.

SDI (Single Document Interface): SDI opens each document in a separate window. Each window has its own components like a toolbar, menubar, etc. Therefore it is not constrained to the parent window.

What is the meaning of CAS in .NET?

Code Access Security(CAS) is necessary to prevent unauthorized access to programs and resources in the runtime. It is designed to solve the issues faced when obtaining code from external sources, which may contain bugs and vulnerabilities that make the user’s system vulnerable.

CAS gives limited access to code to perform only certain operations instead of providing all at a given point in time. CAS constructs a part of the native .NET security architecture.

What is a delegate in .NET?

A delegate is a .NET object which defines a method signature and it can pass a function as a parameter.

Delegate always points to a method that matches its specific signature. Users can encapsulate the reference of a method in a delegate object.

When we pass the delegate object in a program, it will call the referenced method. To create a custom event in a class, we can make use of delegate.

Explain Microsoft Intermediate Language

MSIL is the Microsoft Intermediate Language, which provides instructions for calling methods, memory handling, storing and initializing values, exception handling, and so on.

The instructions provided by MSIL are platform-independent and are generated by the language-specific compiler from the source code. JIT compiler compiles the MSIL into machine code based on the requirement.

What is the difference between int and Int32?

There is no difference between int and Int32. Int32 is a type provided by the .NET framework class whereas int is an alias name for Int32 in the C# programming language.

What are the different methods available under sqlcommand class to access the data?

* ExecuteReader – Used where one or more records are returned – SELECT Query.
* ExecuteNonQuery – Used where it affects a state of the table and no data is being queried – INSERT, UPDATE, DELETE, CREATE and SET queries.
* ExecuteScalar – Used where it returns a single record(a single value normally) – SQL Functions like MIN(), NAX().

Does an OleDbCommand object need to be closed?

No, only the OleDbDataReader and OleDbConnection object need to be closed explicitly.

What keyword is used to accept a variable number of parameter in a method?

params keyword is used as to accept variable number of parameters.

What two classes are used to execute arbitrary SQL commands in a database using ADO.NET?

The SqlCommand and OleDbCommand classes are used to execute SQL commands using ADO.NET.

What two classes are used to open and connect to a database using ADO.NET?

Use the SqlConnection and OleDbConnection classes to connect to a database using ADO.NET.

What two classes are used to read data only?

Use the SqlDataReader and OldDbDataReader classes to read data in a forward direction only.

What method is used by the Command classes to execute SQL statements that return single values?

The Execute Scalar method executes SQL commands that return single values.

Does an OleDbCommand object need to be closed?

No, only the OleDbDataReader and OleDbConnection object need to be closed explicitly.

What is the difference between an ADO.NET Dataset and an ADO Recordset?

There are two main differences are :
* Dataset you an retrieve data from two databases like oracle and sql server and merge them in one dataset.
* Recordset this is not possible
* All representation of Dataset is using XML while recordset uses COM.
* Recordset can not be transmitted on HTTP while Dataset can be.

What is the use of parameter object?

Parameter object is used to pass the parameter value to a stored procedure.

Define Non-Clustered Index?

The data rows are not stored in any particular order, and there is no particular order to the sequence of the data pages. In a clustered index, the physical order of the rows in the table is not same as the logical (indexed) order of the key values.

Define Clustered Index?

The data rows are stored in order based on the clustered index key. Data stored is in a sequence of the index. In a clustered index, the physical order of the rows in the table is the same as the logical (indexed) order of the key values. A table can contain only one clustered index. A clustered index usually provides faster access to data than does a non-clustered index.

Which method do you invoke on the DataAdapter control to load your generated dataset with data?

DataAdapter' fill () method is used to fill load the data in dataset.

What is the difference between an ADO.NET Dataset and an ADO Recordset?

* Dataset can fetch source data from many tables at a time, for Recordset you can achieve the same only using the SQL joins.
* A DataSet can represent an entire relational database in memory, complete with tables, relations, and views, A Recordset can not.
* A DataSet is designed to work without any continues connection to the original data source; Recordset maintains continues connection with the original data source.
* DataSets have no current record pointer, you can use For Each loops to move through the data. Recordsets have pointers to move through them.

What is the difference between "Optimistic" and "Pessimistic" locking?

In Pessimistic locking when user wants to update data it locks the record and till then no one can update data.
In Optimistic locking multiple users can open the same record for updating, thus increase maximum concurrency.

What method is used by the command classes to execute commands that do not return resultsets, such as the SELECT COUNT command?

The Execute Non Query method executes SQL commands that don't return a result set.

What is the preferred method for executing SQL commands that contain parameters?

The preferred method is to use the sqlParameter and oleDbParameter objects, as detailed in the section "Using Parameters with the command Object."

What two classes are used to execute arbitrary SQL commands in a database using ADO.NET?

The Sqlcommand and Oledb command classes are used to execute SQL Commands using ADO.NET.

What is BindingSource class in ADO.NET?

The BindingSource class is used to simplify data binding as well as various operations on records. It has different methods like AddNew( ), MoveFirst( ), MovePrevious( ), MoveNext( ), etc which provide easier way for adding new row, moving to first record, moving to previous record, moving to next record and many other operations without writing code for them.

What is GetChanges() method in ADO.NET?

The GetChanges method of DataSet can be used to retrieve the rows that have been modified since the last time DataSet was filled, saved or updated. The GetChanges method returns a DataSet object with modified rows.

Hpw DataSet objects in ADO.NET replace the ADO Recordset object?

<> DataSet is good for ADO.NET objects to replace the ADO Recordset object:
<> DataSet can hold multiple tables at a time.
<> It allows data access to easily read or write data operations in / from the database.
<> DataSet data stores in local system.
<> It holds multiple rows at a time.
<> It uses more memory.
<> DataSet maintain relation.
<> It bind data from the database.

What is the preferred method for executing SQL commands that contain parameters?

The preferred method is to use the SqlParameter and oleDbParameter objects, as detailed in the section "Using Parameters with the command Object."

The SqlParameter class is found in the "System.Data.SqlClient" namespace. It is a class of a connected architecture of .NET framework. It represents parameters. To work with the SqlParameter class we should have a database.

What is XML Schema?

XML Schema A description of the data elements contained in an XML file. The XML Schema provides the names of the elements, their types, whether or not they are key fields, and other information.

What you understand by ExecuteNonQuery Method?

The ExecuteNonQuery method is used to execute the command and return the number of rows affected.

The ExecuteNonQuery method cannot be used to return the result set.

Snippets working with ExecuteNonQuery

public void CallExecuteNonQuery()
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = ConfigurationManager.ConnectionStrings["connString"].ConnectionString;
try
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "DELETE FROM EMP WHERE DEPTNO = 40";
cmd.CommandType = CommandType.Text;
conn.Open();
Int32 RowsAffected = cmd.ExecuteNonQuery();
MessageBox.Show(RowsAffected + " rows affected", "Message");
cmd.Dispose();
conn.Dispose();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}

What is Transaction?

ransaction A group of commands (treated as a single unit) that change the data stored in a database. The transaction ensures that the commands are handled in an all-or-nothing fashion—if one of the commands fails, all of the commands fail, and any data that was written to the database by the commands is backed out. In this way, transactions maintain the integrity of data in a database.

Describe the System.Data Namespace Class?

The three general namespaces are System.Data, System.Data.Common and System.Data.SqlTypes. Some of the provider-specific namespaces are System.Data.OleDb, Microsoft.Data.Odbc and System.Data.SqlClient.

The System.Data namespace defines classes that you can use with all the data providers or without data providers at all. This namespace also defines interfaces that are base classes for the data provider classes. The following figure shows the System.Data namespace class hierarchy.

What is Dataset?

The DataSet is a disconnected, in-memory representation of data. It can be thought of as a local copy of the relevant portions of a database. Data can be loaded into a DataSet from any valid data source, such as a SQL Server database, a Microsoft Access database, or an XML file. The DataSet persists in memory, and the data therein can be manipulated and updated independent of the database

How can you read XML data into a dataset? How would you write data in a dataset to an XML file? How would you retrieve a string representation of the XML contained within a dataset? Describe each in general terms.

To read data from an XML file into a dataset, you can use the ReadXML method of the dataset, specifying the stream or file that contains the XML data. To write data to a file, you can use the WriteXML method of the dataset, again specifying either the file or the stream that represents the file. The GetXML method of the dataset can be used to retrieve a string representation of the XML data contained by a dataset.

Which objects need to be closed?

OLEDBReader and OLEDBConnection object need to be clogged. This will reside in memory if it is not correctly closed.

What are the important features of ADO.Net 2.0?

Most important features of ADO.NET 2.0:

Bulk Copy Operation: It facilitates bulk copy operation from one Data Source to another Data Source.
Batch Update: To update n no of rows in a database table in a single call from a program thus by avoiding round trip to the database.
Data Paging: To read data from a certain index
Connection Details: To get detailed info about connections like buffer information, cursor details, etc.
DataSet.RemotingFormat Property: To make the dataset serialized in Binary
DataTable's Load and Save Methods: For XML interactions.

What are the important features of ADO.Net 2.0?

Most important features of ADO.NET 2.0:

Bulk Copy Operation: It facilitates bulk copy operation from one Data Source to another Data Source.
Batch Update: To update n no of rows in a database table in a single call from a program thus by avoiding round trip to the database.
Data Paging: To read data from a certain index
Connection Details: To get detailed info about connections like buffer information, cursor details, etc.
DataSet.RemotingFormat Property: To make the dataset serialized in Binary
DataTable's Load and Save Methods: For XML interactions.

What is the difference between Data Grid and Data Repeater?

Typed datasets use explicit names and data types for their members but untyped dataset uses table and columns for their members.

What is the usage of the DataSet object in ADO.NET?

DataSet object is one of the major components of ADO.NET. It always remains disconnected from the database and reduces the load on the database.

Name the different methods by which you can populate a dataset?

Different methods are:

<> Merging with another dataset
<> Data from XML Documents
<> Programmatically creating data row, data table and data column objects.
<> Using data adapter objects and the “fill” process

What do you mean by Batch Updates?

A batch update can be distinct as a batch of updates grouped. To perk up the presentation of the data updates in a database is to inform and send the changes in batches to the database, slightly than one by one.

Define Data binding?

Data binding is the procedure of binding the data with graphical elements. After binding the data in a window shape, you can steer through the records with the help of the Binding Navigator Control.

What are the major challenges in accessing data from a database?

The challenges include:

1. More than one user might need to access the data simultaneously from one database.
2. More than one user might need to access the data anytime, anywhere.

The solution to this problem is attained by implementing a ‘Database locking’ during the time of transaction execution.

What is the difference between Integrated Security = True and Integrated Security = SSPI?

To connect to the database server is recommended to use Windows Authentication, commonly known as integrated security. To specify the Windows authentication, you can use any of the following two key-value pairs with the data provider. NET Framework for SQL Server:

Integrated Security = true;
Integrated Security = SSPI;
However, only the second works with the data provider .NET Framework OleDb. If you set Integrated Security = true for ConnectionString an exception is thrown.

What is the difference between ExecuteScalar, ExecuteReader and ExecuteNonQuery?

ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.
ExecuteReader is used for any result set with multiple rows/columns (e.g., SELECT col1, col2 from sometable).
ExecuteNonQuery is typically used for SQL statements without results (e.g., UPDATE, INSERT, etc.).

What is Denormalization?

It is the process of improving the performance of the database by adding redundant data.

Define ACID Properties.

<> Atomicity: It ensures all-or-none rule for database modifications.
<> Consistency: Data values are consistent across the database.
<> Isolation: Two transactions are said to be independent of one another.
<> Durability: Data is not lost even at the time of server failure.

What Are All The Different Authentication Techniques Used To Connect To Ms Sql Server?

SQL Server should authenticate before performing any activity in the database. There are two types of authentication:
Windows Authentication – Use authentication using Windows domain accounts only.
SQL Server and Windows Authentication Mode – Authentication provided with the combination of both Windows and SQL Server Authentication.

Could you explain me some of the main differences between Connection-oriented access and Connectionless access in ADO.NET?

<> Connection Oriented means : connection is exist throw out your process. Example : using DataReader in ADO.NET you can get data as connection oriented database connection type.

<> Connection Less means : Your connection is not available throw out your whole process. Example: using DataAdapter in ADO.NET you can get data as connection less database connection type.

Search
R4R Team
R4R provides ADO.Net Freshers questions and answers (ADO.Net Interview Questions and Answers) .The questions on R4R.in website is done by expert team! Mock Tests and Practice Papers for prepare yourself.. Mock Tests, Practice Papers,ADO.Net interview questions for experienced,ADO.Net Freshers & Experienced Interview Questions and Answers,ADO.Net Objetive choice questions and answers,ADO.Net Multiple choice questions and answers,ADO.Net objective, ADO.Net questions , ADO.Net answers,ADO.Net MCQs questions and answers Java, C ,C++, ASP, ASP.net C# ,Struts ,Questions & Answer, Struts2, Ajax, Hibernate, Swing ,JSP , Servlet, J2EE ,Core Java ,Stping, VC++, HTML, DHTML, JAVASCRIPT, VB ,CSS, interview ,questions, and answers, for,experienced, and fresher R4r provides Python,General knowledge(GK),Computer,PHP,SQL,Java,JSP,Android,CSS,Hibernate,Servlets,Spring etc Interview tips for Freshers and Experienced for ADO.Net fresher interview questions ,ADO.Net Experienced interview questions,ADO.Net fresher interview questions and answers ,ADO.Net Experienced interview questions and answers,tricky ADO.Net queries for interview pdf,complex ADO.Net for practice with answers,ADO.Net for practice with answers You can search job and get offer latters by studing r4r.in .learn in easy ways .