DOT NET Developer
500+ DOT NET Developer Interview Questions and Answers
Q101. How to transfer value from controller to view in .net?
Value can be transferred from controller to view in .NET using ViewBag, ViewData, and Model.
ViewBag is a dynamic object that can be used to transfer data from controller to view.
ViewData is a dictionary object that can be used to transfer data from controller to view.
Model is a strongly typed object that can be used to transfer data from controller to view.
Example: ViewBag.Message = "Hello World!";
Example: ViewData["Message"] = "Hello World!";
Example: return View(model);
Q102. Sarah cover 600 m streat in 5 minutes.what is the speed of Sarah in km/h?
Sarah's speed is 7.2 km/h.
Convert 600 meters to kilometers (600m = 0.6 km)
Calculate the speed using the formula: Speed = Distance / Time
Speed = 0.6 km / 5 minutes = 0.12 km/min
Convert minutes to hours (1 hour = 60 minutes)
Speed = 0.12 km/min * 60 min/hour = 7.2 km/h
Q103. What is extension in c#, Tell me about how to initialise session in MVC, What is middleware in API
Extensions in C# allow adding new methods to existing types without modifying the original source code. Sessions in MVC can be initialized using Session_Start method in Global.asax file. Middleware in API is software that acts as a bridge between an operating system or database and applications, managing communication and data processing.
Extensions in C# allow adding new methods to existing types without modifying the original source code
Sessions in MVC can be initialized usi...read more
Q104. Difference between Union And Union All in SQL?
Union combines and removes duplicates, Union All combines all rows including duplicates.
Union merges the results of two or more SELECT statements into a single result set.
Union All returns all rows from all SELECT statements, including duplicates.
Union requires the same number of columns in all SELECT statements, while Union All does not.
Union sorts the result set and removes duplicates, while Union All does not.
Union is slower than Union All because it performs additional pr...read more
Q105. Security mechanism apart from authorisation and Authentication
Data encryption, firewalls, intrusion detection and prevention systems.
Data encryption
Firewalls
Intrusion detection and prevention systems
Q106. How do you integrate .NET core code in .NET framework?
You can integrate .NET Core code in .NET Framework by creating a .NET Standard library.
Create a .NET Standard library project in .NET Core
Reference the .NET Standard library in your .NET Framework project
Use the functionality provided by the .NET Standard library in your .NET Framework project
Share interview questions and help millions of jobseekers 🌟
Q107. How to use transaction in EF Core?
EF Core supports transactions using the DbContext class.
Create a new instance of DbContextTransaction using BeginTransaction method of DbContext.
Perform database operations within the transaction using SaveChanges method of DbContext.
Commit the transaction using Commit method of DbContextTransaction or rollback using Rollback method.
Example: using (var transaction = context.Database.BeginTransaction()) { ... }
Q108. What is Entity Framework how to use
Entity Framework is an ORM tool that simplifies database programming in .NET applications.
Entity Framework is used to map database tables to .NET classes.
It provides a set of APIs to perform CRUD operations on the database.
It supports LINQ queries to retrieve data from the database.
It supports different database providers like SQL Server, MySQL, Oracle, etc.
It has three different approaches: Database First, Model First, and Code First.
It generates SQL queries automatically ba...read more
DOT NET Developer Jobs
Q109. What is OOPs? What are its types?
OOPs stands for Object-Oriented Programming. It is a programming paradigm based on the concept of objects.
OOPs focuses on creating objects that contain both data and methods to manipulate that data.
The four main principles of OOPs are Inheritance, Encapsulation, Abstraction, and Polymorphism.
Types of OOPs include Class-based and Prototype-based.
Examples of OOPs languages include Java, C++, and Python.
Q110. What is the Function of Object?
The function of an object is to store data and behavior related to a specific entity in a program.
Objects store data in the form of properties
Objects can have methods which define behavior
Objects can be used to model real-world entities like cars, employees, etc.
Objects can be instantiated from classes or created dynamically
Q111. What are Filters and their types?
Filters are used in ASP.NET MVC to perform logic before or after an action method is executed.
Filters are attributes that can be applied to controllers or action methods.
There are four types of filters in ASP.NET MVC: Authorization filters, Action filters, Result filters, and Exception filters.
Authorization filters are used to perform authentication and authorization before executing an action method.
Action filters are used to perform logic before and after an action method i...read more
Q112. What are sealed class? When it is use?
Sealed class is a class that cannot be inherited. It is used to prevent derivation of a class.
Sealed classes are declared using the 'sealed' keyword.
They are often used when a class is not intended to be inherited or overridden.
Sealed classes can have private constructors to prevent instantiation.
Example: 'sealed class MyClass {}'
Q113. In the context of Dot Net Framework, What is DotNet vs Dot Net Framework? Why do use it? What is role of DI,Service Lifetime scope ?
DotNet is a platform while Dot Net Framework is a software framework built on top of it.
DotNet is a platform that provides a runtime environment for executing applications.
Dot Net Framework is a software framework built on top of DotNet platform.
Dot Net Framework provides a set of libraries and tools for developing and running applications.
Dependency Injection (DI) is a design pattern used to implement Inversion of Control (IoC) in applications.
DI is used to decouple the comp...read more
Q114. How do you test features after implementation?
I test features after implementation by conducting unit tests, integration tests, regression tests, and user acceptance tests.
Conduct unit tests to ensure individual components work correctly
Perform integration tests to check interactions between components
Run regression tests to verify that new features do not break existing functionality
Conduct user acceptance tests to ensure the feature meets user requirements
Q115. What is Filter ? What is the order of filter classes ?
Filter is a feature in ASP.NET that allows you to execute logic before or after an action method is called.
Filters are used to perform logic before or after an action method is called in ASP.NET MVC.
There are five types of filter classes in ASP.NET: Authorization filters, Action filters, Result filters, Exception filters, and Resource filters.
The order of filter classes is: Authorization filters, Action filters, Result filters, Exception filters, and Resource filters.
Q116. Registration form Flow example of MVC
Registration form flow in MVC involves creating a view for the form, handling user input in the controller, and storing data in the model.
Create a view for the registration form using HTML and Razor syntax
Handle user input in the controller using HttpPost attribute and model binding
Validate user input using data annotations and ModelState
Store data in the model using Entity Framework or other data access technology
Q117. How would you implement Authorization in a ASP.NET Core web API??
Authorization in ASP.NET Core web API can be implemented using various methods such as JWT, OAuth, and Identity.
Use JWT (JSON Web Tokens) for token-based authentication and authorization.
Implement OAuth for third-party authentication and authorization.
Utilize ASP.NET Core Identity for role-based authorization.
Configure authentication and authorization middleware in the ASP.NET Core pipeline.
Use attributes like [Authorize] to restrict access to specific endpoints.
Q118. write a linq to fetch the data from db table(students) and data (studentid) should be in asending rder
Use LINQ to fetch data from the 'students' table in ascending order of 'studentid'.
Use LINQ query syntax or method syntax to retrieve data from the 'students' table.
Order the data by 'studentid' in ascending order using the 'OrderBy' or 'OrderByDescending' method.
Ensure that the LINQ query is executed against the database to fetch the data.
Q119. Explain about this model View and controller?
MVC is a software design pattern that separates an application into three interconnected components: Model, View, and Controller.
Model represents the data and business logic
View displays the data to the user
Controller handles user input and updates the model and view accordingly
MVC helps in separating concerns and makes the code more maintainable
Example: ASP.NET MVC framework
Q120. Difference between Abstract Class and Interface?
Abstract class can have both abstract and non-abstract methods, while interface can only have abstract methods.
Abstract class can have constructor, fields, and methods, while interface cannot have any implementation.
A class can inherit only one abstract class but can implement multiple interfaces.
Abstract class is used to provide a common base for multiple derived classes, while interface is used to define a contract for classes to implement.
Example: Abstract class 'Shape' wi...read more
Q121. Difference between Stored Procedure and Function?
Stored Procedure is a precompiled set of SQL statements while Function is a reusable code block that returns a value.
Stored Procedure can perform multiple operations and can return multiple values, while Function returns only one value.
Stored Procedure can have input and output parameters, while Function can only have input parameters.
Stored Procedure can call a Function, but a Function cannot call a Stored Procedure.
Stored Procedure is stored in the database and can be execu...read more
Q122. What is Object Oriented Programming?
Object Oriented Programming is a programming paradigm based on the concept of objects, which can contain data in the form of fields and code in the form of procedures.
OOP focuses on creating objects that interact with each other to solve problems.
It involves concepts like classes, objects, inheritance, polymorphism, and encapsulation.
Example: In a banking application, you can have classes like Account, Customer, and Transaction, each with their own properties and methods.
Q123. How to handle exception in JavaScript?
Use try-catch block to handle exceptions in JavaScript.
Wrap the code that may throw an exception inside a try block.
Catch the exception using catch block and handle it appropriately.
Use finally block to execute code that should run regardless of whether an exception was thrown or not.
Throw custom exceptions using throw keyword.
Use console.log() to log the error message for debugging purposes.
Q124. 1. What is request pipeline? What is the order of the classes in Request pipeline. 3. Access Specifiers in C#.
Request pipeline is the sequence of classes and modules that process an incoming HTTP request in ASP.NET.
Request pipeline in ASP.NET is responsible for handling incoming HTTP requests and generating responses.
The order of classes in the request pipeline includes modules like URL routing, authentication, authorization, and finally the handler that generates the response.
Access specifiers in C# are keywords used to specify the accessibility of classes, methods, and other member...read more
Q125. write sql query about join, and pseudo code with array
SQL query with join and pseudo code with array
SQL query with join: SELECT column_name(s) FROM table1 INNER JOIN table2 ON table1.column_name = table2.column_name
Pseudo code with array: for each element in array, do something
Q126. What are the versions of Dot Net?
The versions of Dot Net include .NET Framework, .NET Core, and .NET 5.
.NET Framework is the original version of Dot Net, primarily used for Windows applications.
.NET Core is a cross-platform version of Dot Net, used for developing applications that can run on Windows, macOS, and Linux.
.NET 5 is the latest version of Dot Net, which combines the features of .NET Core and .NET Framework.
Other versions include .NET Standard, which is a set of APIs that all .NET implementations mu...read more
Q127. What is your experience in .NET development, particularly with MVC?
I have 5 years of experience in .NET development, with a focus on MVC.
Developed multiple web applications using ASP.NET MVC framework
Strong understanding of Model-View-Controller architecture
Experience in implementing RESTful APIs and integrating with front-end technologies
Proficient in using Entity Framework for database interactions
Q128. What is Layout page in MVC?
Layout page in MVC is a shared template that defines the structure of the final output HTML.
Layout page contains common elements like header, footer, navigation menu, etc.
It allows for consistent design across multiple views.
Can be used to define sections that can be overridden by individual views.
Q129. Explain how dependency injection works in. .NET core
Dependency injection in .NET Core allows for the injection of dependencies into a class or method.
In .NET Core, dependency injection is achieved through the built-in DI container.
Services are registered in the DI container during application startup.
Dependencies are injected into classes or methods through constructor injection, property injection, or method injection.
The DI container resolves dependencies and provides them to the consuming classes or methods.
Example: service...read more
Q130. Difference between abstract and interface
Abstract classes are partially implemented classes that can have both abstract and non-abstract members. Interfaces are fully abstract classes that define a contract for implementing classes.
Abstract classes can have constructors, fields, and non-abstract methods, while interfaces cannot.
A class can inherit from only one abstract class, but it can implement multiple interfaces.
Abstract classes can provide default implementations for some methods, while interfaces cannot.
Inter...read more
Q131. What is tha overriding in c# with example
Overriding in C# is a feature that allows a derived class to provide a different implementation of a method that is already defined in its base class.
Overriding is used to achieve runtime polymorphism.
The method in the derived class must have the same name, return type, and parameters as the method in the base class.
The 'override' keyword is used to indicate that a method is intended to override a base class method.
The 'base' keyword is used to call the base class implementat...read more
Q132. What is the difference between IEnumerable and IQueryable?
IEnumerable is used for in-memory collection operations, while IQueryable is used for database query operations.
IEnumerable is used for querying data from in-memory collections like arrays, lists, etc.
IQueryable is used for querying data from a database using LINQ to SQL or Entity Framework.
IEnumerable executes the query in-memory, while IQueryable executes the query on the database server.
IEnumerable is suitable for LINQ to Objects, while IQueryable is suitable for LINQ to E...read more
Q133. How to Debug Stored Procedures?
Debugging stored procedures involves using tools like SQL Server Management Studio, setting breakpoints, and analyzing query execution.
Use SQL Server Management Studio to debug stored procedures
Set breakpoints in the stored procedure code to pause execution at specific points
Analyze query execution using tools like SQL Profiler to identify issues
Use PRINT or SELECT statements to output intermediate results for debugging
Check for errors in the stored procedure code and fix the...read more
Q134. What is Overloading and Overriding?
Overloading is having multiple methods in the same class with the same name but different parameters. Overriding is implementing a method in a subclass that is already defined in the parent class.
Overloading allows a class to have multiple methods with the same name but different parameters.
Overriding is when a subclass provides a specific implementation of a method that is already defined in its parent class.
Example of overloading: having multiple methods named 'calculate' w...read more
Q135. What are the key concepts of Object-Oriented Programming (OOP)?
Key concepts of OOP include encapsulation, inheritance, polymorphism, and abstraction.
Encapsulation: Bundling data and methods that operate on the data into a single unit (class). Example: Class with private variables and public methods.
Inheritance: Creating new classes based on existing classes, inheriting their attributes and behaviors. Example: Subclass extending a superclass.
Polymorphism: Objects of different classes can be treated as objects of a common superclass. Examp...read more
Q136. What are the SOLID principles in software development?
SOLID principles are a set of five design principles in object-oriented programming to make software more maintainable, flexible, and scalable.
Single Responsibility Principle (SRP) - A class should have only one reason to change.
Open/Closed Principle (OCP) - Software entities should be open for extension but closed for modification.
Liskov Substitution Principle (LSP) - Objects of a superclass should be replaceable with objects of its subclasses without affecting the functiona...read more
Q137. What is ActionResult and ViewResult?
ActionResult and ViewResult are classes in ASP.NET MVC used to return responses to client requests.
ActionResult is a base class for action results in ASP.NET MVC.
ViewResult is a type of ActionResult that returns a view to the client.
ViewResult inherits from ViewResultBase class.
ActionResult can be used to return different types of responses like JSON, File, Redirect, etc.
Example: return View();
Q138. What is String and StringBuilder?
String is a sequence of characters, while StringBuilder is a mutable sequence of characters used for efficient string manipulation.
String is immutable, meaning once created, it cannot be changed. StringBuilder is mutable, allowing for efficient modifications.
String concatenation creates a new string object each time, while StringBuilder allows for efficient appending of characters.
String is used for constant strings, while StringBuilder is used for dynamic string manipulation...read more
Q139. What is difference between.net core and .net framework
The main difference is that .NET Core is cross-platform and open-source, while .NET Framework is Windows-only and closed-source.
NET Core is cross-platform, while .NET Framework is Windows-only
.NET Core is open-source, while .NET Framework is closed-source
.NET Core is modular, allowing developers to include only the necessary libraries, while .NET Framework is monolithic
NET Core is optimized for cloud-based applications, while .NET Framework is more suited for desktop applicat...read more
Q140. What approach you will used if their is an error on prod.
I will follow a systematic approach to identify, troubleshoot, and resolve the error on production.
First, identify the root cause of the error by checking logs and monitoring tools.
Next, prioritize the issue based on its impact on users and business operations.
Then, implement a temporary fix if possible to minimize downtime.
Finally, deploy a permanent solution after thorough testing to prevent future occurrences.
Q141. What is boxing and unboxing, Linq, entity framework, delegate, event etc
Boxing and unboxing are operations used in C# to convert value types to reference types and vice versa. Linq is a query language for collections. Entity Framework is an ORM tool. Delegate is a type that represents references to methods. Event is a notification sent by an object to signal the occurrence of an action.
Boxing is the process of converting a value type to an object type. Example: int i = 10; object obj = i;
Unboxing is the process of converting an object type back t...read more
Q142. What is Singleton Design Pattern?
Singleton Design Pattern ensures a class has only one instance and provides a global point of access to it.
Ensures a class has only one instance
Provides a global point of access to that instance
Commonly used in scenarios where only one instance of a class is needed, such as database connections or logging
Q143. 1. Final Year Project 2. The technologies used in project
My final year project was a web-based inventory management system using ASP.NET and SQL Server.
Developed a web-based inventory management system using ASP.NET and SQL Server
Implemented features like user authentication, product management, and order tracking
Used HTML, CSS, and JavaScript for front-end development
Integrated payment gateway for online transactions
Conducted testing and debugging to ensure smooth functioning
Received positive feedback from project supervisor and p...read more
Q144. What is the Difference Between Abstract and interface.
Abstract classes can have implementation while interfaces cannot. A class can implement multiple interfaces but only inherit from one abstract class.
Abstract classes can have constructors while interfaces cannot.
Abstract classes can have non-abstract methods while interfaces cannot.
Interfaces can only have public members while abstract classes can have private and protected members.
A class can implement multiple interfaces but only inherit from one abstract class.
Abstract cla...read more
Q145. How does Dependency Injection work in .NET core, why it is important?
Q146. What is inheritance? What are its types?
Inheritance is a concept in object-oriented programming where a class inherits properties and behaviors from another class.
Types of inheritance: Single inheritance, Multiple inheritance, Multilevel inheritance, Hierarchical inheritance, Hybrid inheritance
Example: Class B inheriting from Class A: class B : A {}
Q147. What is LINQ? What are types of LINQ?
LINQ (Language Integrated Query) is a feature in C# that allows querying data from different data sources using a uniform syntax.
LINQ provides a set of standard query operators that allow querying data from collections, databases, XML, and more.
Types of LINQ include LINQ to Objects, LINQ to SQL, LINQ to XML, and LINQ to Entities.
LINQ queries are written in C# and are executed at runtime, allowing for more flexibility and readability in code.
Example: var result = from num in n...read more
Q148. What is Encapsulation where you implement and why?
Encapsulation is the concept of bundling data and methods that operate on the data into a single unit, known as a class.
Encapsulation helps in hiding the internal state of an object and restricting access to it.
It allows for better control over the data by preventing direct access and manipulation from outside the class.
Encapsulation also promotes code reusability and modularity by grouping related data and methods together.
For example, in a class representing a bank account,...read more
Q149. Difference Abstract Method vs Interface ?
Abstract methods are methods without implementation in abstract classes, while interfaces are contracts that define methods.
Abstract classes can have both abstract and non-abstract methods, while interfaces can only have abstract methods.
A class can implement multiple interfaces, but can only inherit from one abstract class.
Abstract classes can have constructors, while interfaces cannot.
Interfaces can have properties, while abstract classes can have fields.
Q150. What is MVC and explain MVC Life cycle?
MVC is a software architecture pattern that separates an application into three interconnected components: Model, View, and Controller.
Model represents the data and business logic of the application
View is responsible for rendering the user interface
Controller handles user input and updates the model and view accordingly
MVC life cycle involves the following steps: Routing, Model Binding, Action Execution, Result Execution, and Rendering
Interview Questions of Similar Designations
Top Interview Questions for DOT NET Developer Related Skills
Interview experiences of popular companies
Calculate your in-hand salary
Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary
Reviews
Interviews
Salaries
Users/Month