Top 26 .NET Interview Questions And Answers

Top 26 .NET Interview Questions And Answers: Here are the top interview questions of .NET. Be prepared for the interview. You can download the entire questions in a pdf format. so guys All the best for your interview.

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 a 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:

  • Common Language Runtime
  • Framework classes
  • ASP.NET

2) How many languages are supported by .NET at the present time?

When .NET was introduced the first time, it supports many languages like VB.NET, C#, COBOL, and Perl, etc. At the 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 the .NET environment. So after compilation, the language is not a barrier and the code can call or use the 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 used 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?

Top 26 .NET Interview Questions And Answers: State management is a technique that is used to manage a state of an object on a 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 are the different validators in ASP.NET?

  1. Required field Validator
  2. Range Validator
  3. Compare Validator
  4. Custom Validator
  5. Regular expression Validator
  6. Summary Validator

7) Which validator control you use if you need to make sure the values in two different controls matched?

Compare Validator control.

8) What is ViewState?

ViewState is used to retain the state of server-side objects between page postbacks.

9) Where the viewstate is stored after the page postback?

ViewState is stored in a hidden field on the page at the client side. ViewState is transported to the client and back to the server and is not stored on the server or any other external source.

10) How long the items in ViewState exists?

They exist for the life of the current page.

11) What are the Advantages of ASP.NET?

Answer: Top 26 .NET Interview Questions And Answers: ASP.NET provides services to allow the creation, deployment, and execution of Web Applications and Web Services like ASP, ASP.NET is a server-side technology. Web Applications are built using Web Forms. ASP.NET comes with built-in Web Form controls, which are responsible for generating the user interface. They mirror typical HTML widgets such as text boxes or buttons. If these controls do not fit your needs, you are free to create your own user controls.

Advantages of ASP.NET:

  • Separation of Code from HTML
  • Support for compiled languages
  • Use services provided by the .NET Framework
  • Graphical Development Environment
  • Update files while the server is running
  • XML-Based Configuration Files

12) What is the concepts of Globalization and Localization in .NET?

Answer: Localization means “process of translating resources for a specific culture“, and Globalization means “process of designing applications that can adapt to different cultures“.

  • Proper Globalization: Your application should be able to Accept, Verify, and Display all global kind of data. It should well also be able to operate over this data, accordingly. We will discuss more this “Accordingly operations over the diff. culture data“. 

  • Localizability and Localization: Localizability stands for clearly separating the components of culture based operations regarding the user interface, and other operations from the executable code.

The .NET framework has greatly simplified the task of creating applications targeting the clients of multiple cultures. The namespaces involved in the creation of globalizing, localizing applications are:

  • System.Globalization
  • System.Resources
  • System.Text

13) What is the Web.config file in ASP?

Answer: Top 26 .NET Interview Questions And Answers: Configuration file is used to manage various settings that define a website. The settings are stored in XML files that are separate from your application code. In this way, you can configure settings independently from your code. Generally, a website contains a single Web.config file stored inside the application root directory. However, there can be many configuration files that manage settings at various levels within an application.

Usage of the configuration file

ASP.NET Configuration system is used to describe the properties and behaviors of various aspects of ASP.NET applications. Configuration files help you to manage the settings related to your website. Each file is an XML file (with the extension .config) that contains a set of configuration elements. Configuration information is stored in XML-based text files. 

Benefits of XML-based Configuration files:

  • ASP.NET Configuration system is extensible and application-specific information can be stored and retrieved easily. It is human readable.
  • You need not restart the web server when the settings are changed in the configuration file. ASP.NET automatically detects the changes and applies them to the running ASP.NET application.
  • You can use any standard text editor or XML parser to create and edit ASP.NET configuration files.

14) What is the difference between the Hash table and Array list?

Hash table stores data in the form of value pair and name while Array list stores only values.

You need to pass name to access value from the Hash table while in Array, you need to pass index number to access value.

In Array, you can store only a similar type of data type while in the Hash table you can store different type of data types. ex. int, string, etc.


15) What is the meaning of Immutable?

Immutable means once you create a thing, you cannot modify it.

For example: If you want to give new value to old value then it will discard the old value and create a new instance in memory to hold the new value.

16) List the events in page life cycle.

1) Page_PreInit
2) Page_Init
3) Page_InitComplete
4) Page_PreLoad
5) Page_Load
6) Page_LoadComplete
7) Page_PreRender
8) Render

17) Can we have a web application running without web. Config file?

Yes

18) Is it possible to create web application with both webforms and mvc?

Yes. We have to include below mvc assembly references in the web forms application to create hybrid application.

System.Web.Mvc

System.Web.Razor

System.ComponentModel.DataAnnotations

19) Can we add code files of different languages in App_Code folder?

No. The code files must be in same language to be kept in App_code folder.

20) What is Protected Configuration?

It is a feature used to secure connection string information.

21) What is HTTPhandler?

HttpHandler is a low-level request and response API which is made to service incoming Http request. Every incoming Http request received by ASP.NET is ultimately processed by an instance of a class that implements HttpHandler.


22) What is .NET Framework and what are the main components of it?

.NET Framework facilitates the developer to develop, run and deploy the applications like a console application, window Forms applications, web applications, web services, window services, etc. It also provides the environment to create sharable components to be used in distributed computing architecture.

Main components of .Net Framework:

  • Class library
  • Common Language Runtime (CLR)
  • Dynamic Language Runtime (DLR)
  • Application Domains
  • Runtime Hosts
  • Cross-language interoperability
  • Framework security
  • Profiling etc.

23) What is manifest in .NET Framework?

Top 26 .NET Interview Questions And Answers: Manifest is used to store assembly metadata. It contains all the metadata which are necessary for the following things.

  • Version of assembly
  • Security identity
  • Scope of the assembly
  • To resolve references to resources and classes

24) What are the memory-mapped files?

Memory-mapped files are used to map the content of a file to the logical address of an application. It makes you able to run multiple processes on the same machine to share data with each other. To obtain a memory mapped file object, you can use the method MemoryMappedFile.CreateFromFiles( ). It represents a persistent memory-mapped file from a file on disk.


25) Which method is used to enforce garbage collection in .NET?

System.GC.Collect() method.

26) Can we have multiple web config files for an asp.net application?

Yes.

27) What is the difference between web config and machine config?

The web config file is specific to a web application whereas the machine config is specific to a machine or server. There can be multiple web config files into an application whereas we can have only one machine config file on a server.

Top 26 .NET Interview Questions And Answers PDF Download 2019