Updated on Kisan Patel
.net interview questions and answers with explanation for interview, placement test, online test, competitive examination and entrance test.
1.What is .NET?
.NET is an integral part of many applications running on Windows and provides common functionality for those applications to run. This download is for people who need .NET to run an application on their computer. For developers, the .NET Framework provides a comprehensive and consistent programming model for building applications that have visually stunning user experiences and seamless and secure communication.
2.How many languages .NET is supporting now?
When .NET was introduced it came with several languages.
VB.NET, C#, COBOL Perl, etc.
3. What is an IL?
Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code is compiled to IL. IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.
4. What is code access security (CAS)?
Code access security (CAS) is part of the .NET security model that prevents unauthorized access of resources and operations, and restricts the code to perform particular tasks.
5. What is Difference between NameSpace and Assembly?
Assembly is physical grouping of logical units, Namespace, logically groups classes.
Namespace can span multiple assembly.
6. Mention the execution process for managed code.
7. What is Microsoft Intermediate Language (MSIL)?
The .NET Framework is shipped with compilers of all .NET programming languages to develop programs. There are separate compilers for the Visual Basic, C#, and Visual C++ programming languages in .NET Framework. Each .NET compiler produces an intermediate code after compiling the source code. The intermediate code is common for all languages and is understandable only to .NET environment. This intermediate code is known as MSIL.
8. What is managed extensibility framework?
Managed extensibility framework (MEF) is a new library that is introduced as a part of .NET 4.0 and Silverlight 4. It helps in extending your application by providing greater reuse of applications and components. MEF provides a way for host application to consume external extensions without any configuration requirement.
9. Which method do you use to enforce garbage collection in .NET?
The System.GC.Collect()
method.
10. What is the difference between int and int32.
There is no difference between int and int32. System.Int32 is a .NET Class and int is an alias name for System.Int32.
11. What are tuples?
Tuple is a fixed-size collection that can have elements of either same or different data types. Similar to arrays, a user must have to specify the size of a tuple at the time of declaration. Tuples are allowed to hold up from 1 to 8 elements and if there are more than 8 elements, then the 8th element can be defined as another tuple. Tuples can be specified as parameter or return type of a method.
12. What is the full form of ADO?
The full form of ADO is ActiveX Data Object.
13. What are the two fundamental objects in ADO.NET?
DataReader and DataSet are the two fundamental objects in ADO.NET.
14. What is the meaning of object pooling?
Object pooling is a concept of storing a pool (group) of objects in memory that can be reused later as needed. Whenever, a new object is required to create, an object from the pool can be allocated for this request; thereby, minimizing the object creation. A pool can also refer to a group of connections and threads. Pooling, therefore, helps in minimizing the use of system resources, improves system scalability, and performance.
15. Mention the namespace that is used to include .NET Data Provider for SQL server in .NET code.
The System.Data.SqlClient namespace.
16. Which architecture does Datasets follow?
Datasets follow the disconnected data architecture.
17. What is the role of the DataSet object in ADO.NET?
One of the major component of ADO.NET is the DataSet object, which always remains disconnected from the database and reduces the load on the database.
18. Which property is used to check whether a DataReader is closed or opened?
The IsClosed property is used to check whether a DataReader is closed or opened. This property returns a true value if a Data Reader is closed, otherwise a false value is returned.
19. Name the method that needs to be invoked on the DataAdapter control to fill the generated DataSet with data?
The Fill() method is used to fill the dataset with data.
20. What are the pre-requisites for connection pooling?
There must be multiple processes to share the same connection describing the same parameters and security settings. The connection string must be identical.
21. 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.
22. What are different types of authentication techniques that are used in connection strings to connect .NET applications with Microsoft SQL Server?
23. What are the parameters that control most of connection pooling behaviors?
24. What is AutoPostBack?
If you want a control to postback automatically when an event is raised, you need to set the AutoPostBack property of the control to True.
25. What is the function of the ViewState property?
The ASP.NET 4.0 introduced a new property called ViewStateMode for the Control class. Now you can enable the view state to an individual control even if the view state for an ASP.NET page is disabled.
26. Which properties are used to bind a DataGridView control?
The DataSource property and the DataMember property are used to bind a DataGridView control.
27. What is the basic difference between ASP and ASP.NET?
The basic difference between ASP and ASP.NET is that ASP is interpreted; whereas, ASP.NET is compiled. This implies that since ASP uses VBScript; therefore, when an ASP page is executed, it is interpreted. On the other hand, ASP.NET uses .NET languages, such as C# and VB.NET, which are compiled to Microsoft Intermediate Language (MSIL).
28. In which event are the controls fully loaded?
Page load event guarantees that all controls are fully loaded. Controls are also accessed in Page_Init events but you will see that view state is not fully loaded during this event
29. How can we identify that the Page is Post Back?
Page object has an “IsPostBack” property, which can be checked to know that is the page posted back.
30. Which is the parent class of the Web server control?
The System.Web.Ul.Control
class is the parent class for all Web server controls.