preloader
.NET Interview Questions

Top .NET Interview Questions and Answers, Prepare Dot Net Here

author image

Here we have covered .net interview questions that were asked by many companies in their technical interviews. If you are preparing for .net interview questions and answers then this page is surely helpful to you. On this page, you’ll find dot net interview questions and answers for freshers and experienced professionals which help them in cracking the technical interviews of the different companies.

About .Net: .NET framework is made by Microsoft which gives an environment to execute, debug and deploy code onto web services and applications by utilizing tools and functionalities such as classes, libraries, and APIs. .NET framework utilizes object-oriented programming.

Also, prepare for ASP .Net Core interview questions, Networking interview questions, and other language interview questions from here.

.NET Interview Questions

1. Explain the .NET framework?

2. Name some components of .NET?

3. Explain CTS?

4. Explain CLR?

5. What is CLS?

6. Explain JIT?

7. Why is the use of Response.Output.Write()?

8. Differentiate between unmanaged and managed code?

9. Differentiate between an object and a class?

10. Name the factors that control the connection pooling behaviors?

11. Explain BCL?

12. Tell all the versions of the .NET framework?

13. Differentiate between namespace and assembly?

14. Explain LINQ?

15. Explain MSIL?

16. In which base class all web Forms are inherited?

17. Describe the different parts of the assembly.

18. How do you avoid a class from being inherited?

19. Tell the types of constructors in c#?

20. Explain types of assemblies?

21. Explain MDI and SDI?

22. Explain garbage collector?

23. Explain caching?

24. Explain is CAS?

25. What are localization and globalization?

26. Explain the application domain?

27. Explain delegate in .NET?

28. Differentiate a stack and a heap?

29. Explain various validators in ASP.NET?

30. What are EXE and DLL?

31. Differentiate function and stored procedure?

32. Make a list of the events in the page life cycle.

33. Write a code to send an email by using an ASP.NET application?

34. Tell the event handlers used for Global.asax file?

35. What is role-based security?

36. Explain cross-page posting?

37. Write a code to apply themes to an ASP.NET application?

38. What is passport authentication?

39. Explain ASP.NET security controls?

40. Name the templates of the Repeater control.

41. Explain the appSettings section in the web.config file?

42. Explain MIME?

43. Explain HTTP Handler?

44. Explain types of cookies in ASP.NET?

45. Differentiate between ExecuteScalar and ExecuteNonQuery?

46. Differentiate between int and Int32?

47. Explain CoreFx?

48. Explain the IGCToCLR interface?

49. Tell the reason for generating SQL scripts in the .NET core?

50. Are ‘debug’ and ‘trace’ the same?


Learn More Interview Questions Here:


.NET Interview Questions And Answers

1. Explain the .NET framework?

The .NET framework uses an object-oriented style that helps in building applications on Windows. It helps different languages like C#, Cobol, VB, Perl, etc. It has a broad variety of tools and functionalities such as APIs, class, library, which helps in building, deploy and performing web services and several applications.

2. Name some components of .NET?

Common Language run-time Application Domain Common Type System .NET Class Library .NET Framework Profiling

3. Explain CTS?

CTS full form is a Common Type System. It obeys some rules through which a data type is declared and utilized in the program code. CTS also defines the data types which will be used in the application. By following CTS rules we can create our classes and functions which helps in invoking the data type declared in one program language by different programming languages.

4. Explain CLR?

CLR full form is Common Language Run-time. It is a vital component of the .NET framework. It is used as a building block of many applications and gives a secure performing environment for applications.

5. What is CLS?

CLS Stands for Common language specification. It helps the programmers to use the elements that are compatible with other programming languages by following certain rules that come with Common language specifications. It also helps in reutilizing the code in other .NET compatible languages.

6. Explain JIT?

JIT stands for Just-In-Time is a compiler used in .NET. This compiler converts the intermediate code into the inherent language. During the run, the intermediate code is transformed into the native language.

7. Why is the use of Response.Output.Write()?

To get the formatted output we use Response.Output.Write().

8. Differentiate between unmanaged and managed code?

Unmanaged code is not managed by CLR whereas managed code does. .NET framework is required to run managed code whereas unmanaged code is independent of the .NET framework. In managed code CLR copes memory management via garbage collection and Unmanaged code Own runtime environment for compilation and performance

9. Differentiate between an object and a class?

Class is the definition of an object whereas An object is an illustration of a class. Class is a model of the object and also a class doesn’t evolve as an object unless instantiated. Class defines all the properties, methods, etc whereas object access all those properties from the class.

10. Name the factors that control the connection pooling behaviors?

These 4 factors control the connection pooling behaviors: Connect Timeout Min Pool Size Max Pool Size Pooling

11. Explain BCL?

BCL stands for the base class library of interfaces, classes, and value types It is the base of .NET framework applications, controls, elements, and components. Easily available a wide number of familiar functions by encapsulating it for the programmers. It delivers functionality like threading, security, input/output, diagnostics, globalization, resources, etc. It also helps in the interaction between user and runtime It gives namespaces that are very frequently used like system, system.Activities, etc.

12. Tell all the versions of the .NET framework?

C# 1.0 .NET Framework 1.0/1.1 Visual Studio .NET 2002 C# 2.0 .NET Framework 2.0 Visual Studio 2005 C# 3.0 .NET Framework 3.0/3.5 Visual Studio 2008 C# 4.0 .NET Framework 4.0 Visual Studio 2010 C# 5.0 .NET Framework 4.5 Visual Studio 2012/2013 C# 6.0 .NET Framework 4.6 Visual Studio 2013/2015 C# 7.0 .NET CORE Visual Studio 2017

13. Differentiate between namespace and assembly?

An assembly is a physical bundle of logical units whereas namespace bundles classes and namespace can transit numerous assemblies as well.

14. Explain LINQ?

LINQ means Language integrated query introduced with visual studio 2008. It is a pack of features that open query abilities to the .NET framework language syntax that permits data manipulation irrelevant of the data source. Language integrated query fills the gap between the world of data and the world of objects.

15. Explain MSIL?

MSIL means Microsoft Intermediate Language; it gives directions for storing and initializing values, calling methods, memory & exception handling, etc. All the .NET codes firstly need to be compiled to Intermediate Language.

16. In which base class all web Forms are inherited?

In page class, all web forms are inherited.

17. Describe the different parts of the assembly.

Manifest: It has the details about the version of the assembly. Type Metadata: Contains the binary info of the program MSIL: Microsoft Intermediate Language Code Resources: List of related files

18. How do you avoid a class from being inherited?

By using the sealed keyword we can avoid a class from being inherited.

19. Tell the types of constructors in c#?

Default Constructor Parameterized constructor Copy Constructor Static Constructor Private Constructor

20. Explain types of assemblies?

There are two types of assemblies: Private Assembly: It can be accessed only by application and installed in the installation directory. Shared Assembly: It can be shared by various applications and installed in the GAC.

21. Explain MDI and SDI?

MDI (Multiple Document Interface): An MDI permits you to open multiple windows. It includes one parent window and multiple child windows. Menubar, toolbar, etc. are the elements are shared from the parent window. SDI (Single Document Interface): It opens every document in different windows. Each window has its elements like menubar, toolbar, etc. Therefore it is not controlled to the parent window.

22. Explain garbage collector?

This feature in .NET liberates the unused code objects in the memory. The memory head is split into 3 generations: Generation 0: To store short-lived objects. Generation 1: To store medium-lived objects. Generation 2: To store long-lived objects. Collection of garbage directs to the grouping of objects stored in the generations.

23. Explain caching?

Caching defines storing the data momentarily in the memory so that the data can be acquired from the memory rather than looking for it in the original location. It improves the efficacy of the application and also boosts its speed. Following are the types of caching: Page caching Data caching Fragment caching

24. Explain is CAS?

CAS means Code Access Security, which is a part of a security model that stops illegal access to the resources. Code Access Security also allows the users to set authorizations for the code. CLR then runs the code based on the permissions. CAS can only be accessed by managed code. If an assembly uses Code Access Security it is counted as partially trusted.

25. What are localization and globalization?

Localization: It simply means altering the already globalized application to accommodate a specific language or culture. Microsoft.Extensions.Localization is used to localize the application content. Globalization: It is a process of making applications to support multiple languages. By using globalization, existing applications can also be transformed to support multiple languages.

Know the Interview Criteria of these MNCs!!!

.NET Framework Interview Questions

26. Explain the application domain?

ASP.NET presents an idea of the application domain or AppDomain. It is a lightweight process that actions like container and boundary. For data and cod, .NET run-time utilizes the AppDomain as a container. The CLR permits multiple .NET applications to perform in a single AppDomain.

27. Explain delegate in .NET?

In .NET, a delegate is the same as a function pointer in different programming languages like C or C++. It permits the user to encapsulate the contact of a method in a delegate object. After that, a delegate object is passed in a program, which is said the referenced method. To make a custom event in a class we can even use a delegate method.

28. Differentiate a stack and a heap?

Stack stored-value type whereas Heap stored reference type A stack keeps track of every executing thread and its location whereas a heap keeps track of more precise data or objects.

29. Explain various validators in ASP.NET?

Client-side validation: When the validation is done on the client-side browser then it is called client-side validation. for example JavaScript Server-side validation: When the validation is done on the client-side then it is called server-side validation. It is a secure validation because if the user ignores the client-side validation we can still catch it in server-side validation.

30. What are EXE and DLL?

DLL and EXE are assembly executable modules. EXE: It is an executable file that executes the application for which it is developed. When we create an application, an exe file is developed. Thus the assemblies are loaded instantly when we run an exe. But an exe file is not being shared with different applications. DLL: It means a dynamic link library that includes code that ought to be hidden. The code is captured in this library; an application can have multiple DLL and can also be shared with different applications.

31. Differentiate function and stored procedure?

The function must return a single value whereas stored procedure used to execute a specific task Function can only use input parameter whereas stored procedure can use both output and input parameters In function exception control is impossible using a try-catch block whereas it can be done in the stored procedure. A function can be called from a procedure but a stored procedure is not be called from a function

32. Make a list of the events in the page life cycle.

Page_PreInit Page_Init Page_InitComplete Page_PreLoad Page_Load Page_LoadComplete Page_PreRender Render

33. Write a code to send an email by using an ASP.NET application?

mail message = new mail(); message.From = “abc@gmail.com”; message.To = “xyz@gmail.com”; message.Subject = “Test”; message.Body = “hello”; SmtpMail.SmtpServer = “localhost”; SmtpMail.Send(message);

34. Tell the event handlers used for Global.asax file?

Application Events: Application_Start, Application_End, Application_AcquireRequestState, Application_AuthenticateRequest, Application_AuthorizeRequest, Application_BeginRequest, Application_Disposed, Application_EndRequest, Application_Error, Application_PostRequestHandlerExecute, Application_PreRequestHandlerExecute, Application_PreSendRequestContent, Application_PreSendRequestHeaders, Application_ReleaseRequestState, Application_ResolveRequestCache, Application_UpdateRequestCache Session Events: Session_Start, Session_End

35. What is role-based security?

Role-based security is operated to enforce security measures on the basis of the role allotted to the users in the organization. Then we can allow users on the basis of their roles in the organization. For example, windows have a role-based operation like a user, administrators, and guests.

36. Explain cross-page posting?

When we click on a submit option on a page, the data is kept on the exact page. But if the data is kept on a separate page, then it is called cross-page posting. It can be attained by using the POSTBACKURL property which yields the postback. FindControl method can also be used to get the values that are broadcasted on this page.

37. Write a code to apply themes to an ASP.NET application?

Use the web.config file to specify the themes <system.web> </system.web>

38. What is passport authentication?

At the time of passport authentication, it foremost checks the passport authentication cookie, if the cookie is available the application reverted to the passport sign-in page. Then it authorizes the details of the user on the sign-in page and if they are accurate, then it saves them on the client machine and then diverts the user to the requested page.

39. Explain ASP.NET security controls?

<asp: Login>: Provides a login ability that allows the users to enter their authorizations. <asp: LoginName>: This allows you to show the name of the logged-in user. <asp: LoginStatus>: Shows if the user is authorized or not. <asp: LoginView>: provides many login views based on the template that has been selected. <asp: PasswordRecovery>: Emails the users the lost passwords.

40. Name the templates of the Repeater control.

ItemTemplate AlternatingItemTemplate SeparatorTemplate HeaderTemplate FooterTemplate

41. Explain the appSettings section in the web.config file?

If we want to place the user-defined values for the full application, we can utilize the appSettings block in the web.config file. For example, the below-given code uses the ConnectionString throughout the task for the database connection:

42. Explain MIME?

MIME full form is Multipurpose Internet Mail Extensions, which is the extension of the e-mail protocol which allows users to use the procedure to interchange files over the internet. Servers insert the MIME header at the starting of the web transmission. Then the clients utilize this header to choose a suitable ‘player’ for the type of data that the header shows. Some of these players are constructed into the web browser.

43. Explain HTTP Handler?

Every request of the ASP.NET application is managed by a special component called an HTTP handler. It is the most vital component for managing ASP.NET application requests. It uses various handlers to serve separate files. The handler for the web page makes the page and handles objects, executes your code, and then generates the final HTML. Some default HTTP handlers for ASP.NET: Page Handler(.aspx): Handles web pages User Control Handler(.ascx): It handles web user control pages Web Service Handler(.asmx): Handles web service pages Trace Handler(trace.axd): It handles trace functionality

44. Explain types of cookies in ASP.NET?

Session Cookie: It works on the client machine side for a single session till the user logs out. Persistent Cookie: It resides on the user’s machine side for a term mentioned for its expiry. It might be an hour, a month, or never.

45. Differentiate between ExecuteScalar and ExecuteNonQuery?

ExecuteScalar returns the output value whereas ExecuteNonQuery doesn’t. ExecuteScalar is used to fetch a single value whereas ExecuteNonQuery is used to implement insert and update statements. ExecuteScalar doesn’t return the number of affected rows whereas ExecuteNonQuery does.

46. Differentiate between int and Int32?

Int and Int32 have no difference at all. Int32 is a type given by the .NET framework class and int is a nickname name for Int32 in the C# programming language.

47. Explain CoreFx?

CoreFX is the pack of class library implementations for .NET Core. It contains collection types, file systems, console, XML, async, JSON, etc. It is platform-neutral code, which means it can be transferred across all platforms. Platform-neutral code is executed in the form of a single portable assembly that can be used on all platforms.

48. Explain the IGCToCLR interface?

IGCToCLR interface will pass as an argument to the InitializeGarbageCollector() function and it is utilized for runtime communication. It includes a lot of built-in methods like RestartEE(), SuspendEE(), etc.

49. Tell the reason for generating SQL scripts in the .NET core?

It is used to develop a SQL script when you are attempting to debug or deploy your migrations to a production database. The SQL script can also be used for reviewing the precision of data and adjusted to fit the production database need.

50. Are ‘debug’ and ‘trace’ the same?

No, they are different. The Trace class is used for debugging and for build releases. It gives implementation plan and function timing details. Debug means moving via the program code flow during run-time. Debug and trace permit for monitoring the application for issues and exceptions without VS.NET IDE.

Want to prepare for these languages:

Recent Articles