BLOG

.NET INTERVIEW QUESTIONS AND ANSWERS

.Net Interview Questions

An increase in the job opportunities for .Net developers has caused the jobs to become more competitive. This means that companies are looking to hire professionals who are proficient in their work. To help you with your job interview, we have sorted the .Net interview questions according to your experience level. 

.Net is a cross-platform, open software developer platform that has been developed by Microsoft. It consists of a large library, called the Framework Class Library (FCL). Programs that are written in .Net are executed in a software environment called the Common Language Runtime (CLR), which is an application virtual machine. Any computer codes written in the .Net framework are referred to as a managed code; the FCL and CLR are a part of the .Net framework.

Top .Net Questions and Answers for Fresh Graduates

Being a fresh graduate, you would be expected to know all the basics of .Net. These questions are nothing too complicated, just simple questions that help the interviewer to check your basic skills and concepts.

The .Net interview questions for fresh graduates include the following:

1. What is the .Net framework?

.Net is a cross-platform started by Microsoft. Its main use is to help develop various applications using Windows. It is also capable of developing classes, libraries, and APIs. It also helps in running, debugging, and deploying code onto web services and applications form. .Net supports multiple languages, including C#, VB, Pearl, and so many other options.

2. Name some common components of .Net?

The .Net framework is made up of numerous components. A few of the components are:

  • Profiling
  • Application domain
  • Language runtime
  • .Net Framework
  • .Net Class Library

3. What does JIT stand for?

The full form of JIT is Just in Time, which is a compiler used in the conversion of intermediate code into native code without any difficulties.

During execution, the code is converted into the native language, called the byte code. The CPU processes it, and the framework helps in its conversation.

4. What does MSIL mean?

MSIL stands for Microsoft Intermediate Language, which is used to provide instructions that are required for various operations, such as exception handling. MSIL can also provide instructions to initialize and store values and methods without any hassle.

5. What is CTS and what does it stand for?

CTS stands for Common Type System. It is a set of rules that decide what data type should correspond to the values given by a user. It describes all the data types that are used in the application by the user. CTS provides the user with an option of using a variety of languages, allowing them to build their own set of rules.

6. What is CLS?

CLS stands for Common Language Specification. The main purpose of CLS is to ensure inter-language operations are available for the user. It can be reused within all .Net compatible languages.

7. What does CLR stand for?

In .Net, CLR stands for Common Language Runtime. It provides the basics for running many applications on it, becoming an important part of .Net. CLR works with the following aspects:

  • Memory management
  • Thread management
  • Libraries for loading
  • Security protocols

After these basic .Net interview questions, the main question related to differences is asked:

8. What are the differences between managed code and unmanaged code in .Net?

Managed Code:

  • Managed by CLR
  • Dependent on the .Net framework for its execution
  • Garbage collection is used to manage memory

Unmanaged Code:

  • Runs independently
  • Not dependent on the .Net framework for its execution
  • Runtime environment is responsible for the management

9. How are managed codes executed in the .Net framework?

Managed code is executed in the following steps:

  • Selection of a compiler that helps in the execution of the code written by the user
  • Code converse into an Intermediate language (IL) with the help of a compiler
  • IL is pushed to CLR, which converts it to its native language with the help of JIT
  • The native code is then executed using .Net

10. What does state management mean?

It is the constant monitoring and maintenance of the state of objects in the runtime. An example of an object is a web page or controller.

There are two types of state management. They are:

  1. Client-side: Used to store information on the client’s machine. Mainly formed of reusable and simple objects.
  2. Server-side: stores information on the server, allowing easier management, and helps to preserve all the information on the server.

11. What is the difference between an object and a class?

Object:

  • An example of class
  • After instantiation, a class becomes an object
  • Used to access properties from a class

Class:

  • Definition of an object
  • Basic scaffolding of an object
  • Description of methods and properties

12. What is the difference between system.stringbuilder and system.string in .Net?

system.stringbuilder

  • Mutable
  • Supports using append

system.string

  • Immutable
  • Cannot use the append keyword

13. What is caching?

The feature of caching in the .Net framework allows quick access due to data stored in memory. This improves the system performance by enhancing scalability, and making data access much quicker, even if the data source is temporarily unavailable.

14. How many types of caching are there in .Net?

There are three types of caches in the .Net framework;

  1. In-Memory cache
  2. Persistent in-process cache
  3. Distributed cache

15. What is the main difference between constants and read-only variables?

Constants are created using the const keyword and they remain the same throughout the program. Const is a compile-time constant. On the other hand, read-only file variables are created with the help of a read-only keyword, allowing their value to be changed. Read-only is a runtime constant.

16. What is the difference between Stack and Heap?

The main difference between stack and heap is that stack is used for static memory allocation, allowing fast access to its memory. Its memory is easy to keep track of. Heap, on the either hand, is much more complex and slower than stack. It is mainly used for dynamic memory allocation. Memory allocation to variables happens at run time.

17. What is the difference between Stack and Queue?

Stack values are processed by following the LIFO (Last-In, First Out) principle. All elements are inserted and dented from the top. Queue list items follow the FIFO (First-In, First-Out) principle, for insertion and deletion, both. This means that the elements are inserted from the rear end, and deleted from the front end.

18. What are EXE and DLL?

EXE is an executable file that works as an application. It consists of an entry point and runs individually. DLL (Dynamic Link Library) is a supportive file to other applications. This means it cannot be run individually.        

19. What is BCL?

BCL stands for Base Class Library that is a foundation for building .Net framework applications, components, and controls. It consists of classes, interface, and value types.

20. What is FCL?

FCL stands for Framework Class Library. It is a collection of reusable types of classes, interfaces, and data types of the .Net framework. It is used in developing applications.

Best .Net Questions and Answers for Intermediate Level

The .Net interview questions for the intermediate level contain some technical questions, along with some basic skill questions, that help to assess the technical caliber of the candidate. some of the common .Net questions for the intermediate level have been discussed below.

1. Discuss the design patterns in the .Net framework.

In total, there are 23 design patterns, that can be classified into 3 main categories. These categories are:

Creational Design Pattern

  1. Factory Method
  2. Abstract Factory
  3. Builder
  4. Protype
  5. Singleton

Structural Design Patterns

  1. Adapter
  2. Bridge
  3. Composite
  4. Decorator
  5. Facade
  6. Flyweight
  7. Proxy

Behavioural Design Patterns

  1. Chain of Responsibility
  2. Command
  3. Interpreter
  4. Iterator
  5. Mediator
  6. Memento
  7. Observer
  8. State
  9. Strategy
  10. Visitor
  11. Template Method

2. What is a MIME?

MIME stands for Multipurpose Internet Mail Extension. It was proposed by Bell communication in 1991 and helps in the exchange of data files on the internet. It is a supplementary protocol that allows non-ASCII data to be sent through SMTP.

3. What is a Hashtable?

It is a collection that stores key-value pairs. It helps in the organization of pairs that are based on the hash code of each key and uses it to access elements in the collection.

4. What is an Interface?

Interface is a declaration for a set of class members. It contains only abstract members such as events, methods, properties, etc.

5. What are the events and delegates?

When a desired action occurs in a class or object, events notify all the other classes and objects. Delegate is a type-safe function pointer that defines a method signature in CLI.

6. What is business logic?

It is a business processing layer that helps in the coordination of the User Interface Layer and the Data Access Layer.

7. What is role-based security?

It is a security measure that is implemented to provide security access based on the roles assigned to users. An example of role-based security includes the provision of access to users, administrators, and guests.

8. Mention some templates that are present in Repeater Control.

Some of the templates, that are widely used, in Repeater Control are:

  • AlternatingItem Template
  • ItemTemplate
  • HeaderTemplate
  • FooterTemplate
  • SeparatorTemplate

9. What are the functional and non-functional requirements?

The basic and mandatory facilities that are required by a system are the functional requirements. Non-functional requirements are quality-related attributes that must be delivered by the system.

10. What is Reflection?

To create type instances and obtain type information at runtime, reflection objects are used. Access to metadata of a running program is gained through the classes in the System.Reflection namespace.

11. What is the GAC?

The GAC stands for Global Assembly Cache. It is a machine-wide code that is stored in a folder of the Windows directory. It is responsible for storing all the .Net assemblies that are specifically designated to be shared by all the applications that are executed on the system.

12. What is ORM?

ORM stands for Object-Role Modeling. It is a conceptual level method for designing and querying information systems. It is a user-friendly description for non-technical users.

13. Define globalization and localization.

The designing and coding of culture and language-neutral applications is known as Globalisation. The customization of applications and the translation of UI based on specific cultures and regions is known as localization.

14. What is a constructor in C#?

A special method of the class that contains a series of instructions is called a constructor. It is automatically invoked when a class is created.

15. What are the different types of constructors in C#?

There are 5 types of constructors in C#. These are:

  1. Default constructor: without any parameters
  2. Parameterized Constructor: with one parameter
  3. Copy constructor: an object is created by copying variables from another object
  4. Static constructor: created with a static keyword and only invoked once for all the instances of class
  5. Private constructor: created with a private specifier and no other classes are derived from it, neither an instance is created from it

16. What is Method Overriding? 

This is a method that allows using the same name, return type, argument, and same functions from another class in the derived class.

17. What is Shadowing?

The method of making the parent class available to the child class, without using the override keyword, is known as shadowing. Shadowing is also known as method hiding.

18. What is the difference between shadowing and overriding?

Shadowing helps in providing a new implementation for the base class method. it also helps to protect against subsequent base class modification. With overriding, you can rewrite a base class function using a different definition and active polymorphism.

19. What is polymorphism?

It is a term used to describe one interface that offers multiple functions. To elaborate further, the same method can perform various actions, depending on the runtime type of instance that invokes it.

20. How many types of polymorphism are there?

There are two types of polymorphism. These are:

  • Static or compile-time polymorphism
  • Dynamic or runtime polymorphism

Best .Net Questions and Answers for Advanced Level

.Net Interview questions for advanced or experienced level candidates consist of more complex questions. These questions have been discussed below.

1. What design principles are used in .Net?

.Net uses the SOLID design principle:

  • Single Responsibility Principle (SRP)
  • Open-Closed Principle (OCP)
  • Liskov Substitution Principle (LSP)
  • Interface Segregation Principle (LSP)
  • Dependency Inversion Principle (DIP)

2. What type of cookies are present in ASP.Net?

There are two types of cookies available:

  • Session cookies: present only for a single session on a client machine
  • Persistent cookies: have an expiry date and are present on the user machine

3. Mention some security controls that are present in ASP.Net.

Five types of security controls are present in ASP.Net. They are:

  • <asp: PasswordRecovery>: used to send emails to users after a password reset operation has been performed
  • <asp: Login>: provides the provisions of login controls with ID and password to allow users to log in through their credentials
  • <asp: LoginName>: displays the name of the user who has logged into the system
  • <asp: LoginStatus>: denotes the authentication flag of the logged-in user
  • <asp: LoginView>: provides a variety of views depending on the themes for the user

4. List the events that take place during a page life cycle.

Eight events take place to successfully render a page:

  • Page_PreInit
  • Page_Init
  • Page_InitComplete
  • Page_PreLoad
  • Page_Load
  • Page_LoadComplete
  • Page_PreRender
  • Render

5. How do you check the status of a DataReader?

The status of DataReader can be checked with the property “IsClosed.” It will indicate if the DataReader is closed or opened. If it is open, a false value is returned, and if it is closed, a true value is returned.

6. What is cross-page posting?

PostBackUrl helps you to achieve cross-page posting. If data is stored on a different page and linked to the current page, it is referred to as a cross-page post. Seen in situations when there is a submit button on a webpage.

7. How many elements can a tuple hold?

It can hold up to eight elements. If there are more than eight elements at the same time, each of the extra elements will get defined into a depart tuple.

8. What type of framework is .Net?

.Net is an OOP framework, making encapsulation and inheritance its main features.

9. What is multithreading?

When multiple threads perform different activities within a single process it is known as multi-threading. .Net supports multithreading in the following ways:

  • Using ThreadStart delegates to start threads
  • Using the ThreadPool class with asynchronous methods

10. What is the role of ErrorProvider Control?

It is used to identify and indicate invalid data to the user, while the data is being entered into the entry form. When an invalid data entry is detected, an error message is displayed next to the control.

11. What are the fundamental objects in ADO.Net?

ADO.Net has two fundamental objects. They are:

  • DataReader: connected architecture
  • DataSet: disconnected architecture

12. What is serialization?

To help transport or persist the state of an object, the state of an object is converted into another form (a stream of bytes). This is known as serialization. The opposite of serialization is known as deserialization. These processes allow the transfer and storage of data.

13. What is the difference between dataset.clone and dataset.copy?

Dataset.clone does not copy any data of the DataSet. It only copies the structure of the DataSet that only includes DataTable schemas, relations, and constraints. On the other hand, dataset.copy is a deep copy of the DataSet, and it duplicates the structure and data both.

14. What is ADO?

ADO stands for ActiveX Data Objects which is an application program used for writing Windows applications. It helps in providing access to relational or non-relational database providers. These database providers include Microsoft and others.

15. What is MEF?

MEF stands for Managed Extensibility Framework which is a library that allows the host application, without any configuration requirement, to consume external extensions.

16. Rate yourself on a scale of 1 to 10 on your proficiency with .Net?

You must give an honest answer to this question. The interviewer wants to know what you think is your proficiency level with .Net. One thing to remember is: honesty is the best policy.

17. Why do you want to apply for a .Net developer role in our company?

When the interviewer asks you this question, he is keen on finding out about your goals and careers in this field, and how their company would benefit from you.

18. What skills are required by a successful .Net Developer?

You must mention the following qualities:

  • .Net core
  • Client-side web development
  • Database handling
  • Net MVC architecture

19. How has your college degree helped you with your .Net development?

The interviewer is trying to assess your learning experience. You should talk about how you plan on using the skills learned at college in your new job role.

20. Have you been earned certification from other sources to help boost your .net developer career?

The interviewer is trying to find out if you have been willing to run the extra mile for your profession. It would always be beneficial for you if you have any additional certifications from reliable institutes, in addition to your main college degree. 

Final Thoughts

By the end of this post, you would have a better idea of the .Net interview questions for the position of a .Net developer. All the questions have been segregated according to the experience of the candidate.

FAQs

What is .Net used for?

.Net is a software development platform that helps in services, such as networking, security, type-safety, and memory management.

Is .Net better than Java?

If you are a Windows user then you will not have any issues running .Net on your operating system, since .Net runs primarily on Windows. However, Java can run on any device and any operating system. It depends on the user’s preference.

What is the latest .Net technology?

The company had announced that in the latest version, .Net Core 3.1 will be separated from .Net products. There will be a single release for .Net 5.

No Comments

Leave a Comment