.Net Interview Questions and Answers

.Net Interview Questions and Answers:
A list of top most asked .Net  interview questions and answers are given below

1) What is .NET?

.NET is a framework for software development. It is just like other software development framework like (J2EE). It provides runtime capabilities and a rich set of pre-built functionality in the form of class library and API’s. This .NET framework is an environment to build, deploy and run web services and other applications.

The .NET framework contains three main parts:

(i) Common Language Runtime
(ii) Framework classes
(iii) ASP.NET
2) How many languages are supported by .NET at present time?

When .NET was introduced first time, it supports many languages like VB.NET,C#,COBOL, and Perl etc. At present time it supports almost 44 languages.

3) How is it possible for .NET to support many languages?

The .NET language code is compiled to Microsoft Intermediate Language (MSIL). The generated code is called managed code. This managed code is run in .NET environment. So after compilation the language is not a barrier and the code can call or use function of another language also.

4) Is ASP.NET different from ASP? If yes, explain how?

Yes, ASP.NET is different from ASP. These are the main differences:

ASP.NET is developed by Microsoft to create dynamic web applications while ASP (Active Server Pages) is a Microsoft’s server side technology use to create web pages.
ASP.NET is compiled while ASP is interpreted.
ASP uses the technology named ADO while ASP.NET uses ADO.NET.
ASP.NET is completely object oriented while ASP is partially object oriented.
5) What is the state management in ASP.NET?

State management is a technique that is used to manage a state of an object on different request. It is very important to manage state in any web application. There are two types of state management systems in ASP.NET.

.Client side state management
.Server side state management

6) What is the difference between trace and debug?

Debug class is used to debug builds while Trace is used for both debug and release builds.

7) What are differences between system.stringbuilder and system.string?

The main differences between system.stringbuilder and system.string are:

system.stringbuilder is a mutable while system.string is immutable.
Append keyword is used in system.stringbuilder but not in system.string.
8) What is the difference between int and int32?

There is no difference between int and int32. System. Int is an alias name for System.Int32 which is a .Net Class.

9) What is the difference between namespace and assembly?

An assembly is a physical grouping of logical units while namespace groups classes. A namespace can span multiple assemblies.

10) Explain the differences between value type and reference type.

Following are the main differences between value type and reference type:

Value type contain variable while reference type doesn’t contain value directly in its memory.
In reference type, memory is allocated in managed heap and in value type memory allocated in stack.
Reference type ex-class value type-struct, enumeration

11) If you want to replace multiple if-else statements in code, which statement will you use?

In Visual basic, we can use Select-Case statement to replace multiple If-Else statement. In C#, we should use Switch-Case statement to replace multiple If-Else statement.

12) What are the different types of indexes in .Net?

There are two types of indexes in .Net:

Clustered index and non-clustered index

13) How many types of memories are there in .Net?

There are two types of memories in .Net

Stack memory
Heap Memory
14) Which are the new features added in .NET framework 4.0?

A list of new features of .NET Framework 4.0:

.Improved Application Compatibility and Deployment Support
.Dynamic Language Runtime
.Managed Extensibility Framework
.Parallel Programming framework
.Improved Security Model
.Networking Improvements
.Improved Core ASP.NET Services
.Improvements in WPF 4
.Improved Entity Framework (EF)
.Integration between WCF and WF
15) What are cookies?

A cookie is a small amount of data created by server on the client. When a web server creates a cookie, an additional HTTP header is sent to the browser when a page is served to the browser.