DOT NET Developer

90+ DOT NET Developer Interview Questions and Answers for Freshers

Updated 12 Jul 2025
search-icon

Asked in Infosys

2d ago

Q. What are the components of the .NET Framework and their types?

Ans.

The components of .NET Framework include Common Language Runtime, Class Library, and ASP.NET.

  • Common Language Runtime (CLR) - manages memory, security, and execution of code

  • Class Library - provides a set of reusable classes and types for building applications

  • ASP.NET - a web application framework for building dynamic web pages and web services

  • Other components include ADO.NET, Windows Communication Foundation (WCF), Windows Presentation Foundation (WPF), and Windows Workflow Fou...read more

Asked in Nagarro

5d ago

Q. Is it possible to have two primary keys in an SQL table?

Ans.

No, only one primary key can be defined in a SQL table.

  • Primary key ensures uniqueness of each record in a table.

  • A table can have only one primary key constraint.

  • However, a composite primary key can be created using multiple columns.

Asked in Globant

4d ago

Q. Write a query to find the 4th highest salary.

Ans.

Query to find 4th highest salary

  • Use the 'ROW_NUMBER' function to assign a rank to each salary

  • Order the salaries in descending order

  • Select the salary with rank 4

Q. How can you retrieve the employee names along with their corresponding manager names from a self-referencing employee table?

Ans.

Retrieve employee names with their managers from a self-referencing employee table using SQL queries.

  • Use a self-join on the employee table to link employees with their managers.

  • Example SQL query: SELECT e1.Name AS EmployeeName, e2.Name AS ManagerName FROM Employees e1 LEFT JOIN Employees e2 ON e1.ManagerID = e2.EmployeeID;

  • Ensure the table has a structure with EmployeeID and ManagerID columns.

  • Use LEFT JOIN to include employees without managers.

Are these interview questions helpful?
3d ago

Q. What are the uses of the SELECT, DELETE, and UPDATE queries in SQL?

Ans.

SELECT is used to retrieve data, DELETE is used to remove data, and UPDATE is used to modify data in SQL.

  • SELECT is used to retrieve specific data from a database table.

  • DELETE is used to remove specific data from a database table.

  • UPDATE is used to modify existing data in a database table.

  • Examples: SELECT * FROM table_name, DELETE FROM table_name WHERE condition, UPDATE table_name SET column_name = value WHERE condition

3d ago

Q. What are ViewBag, ViewData, and TempData in ASP.NET, and what are the differences between them?

Ans.

ViewBag, ViewData, and TempData are ways to pass data between controllers and views in ASP.NET.

  • ViewBag is a dynamic property that allows you to pass data from the controller to the view. It uses dynamic typing.

  • ViewData is a dictionary object that allows you to pass data from the controller to the view. It requires typecasting.

  • TempData is a dictionary object that allows you to pass data from one controller to another or from one action to another.

  • ViewBag and ViewData are used ...read more

DOT NET Developer Jobs

Capgemini logo
Azure .net developer 7-12 years
Capgemini
3.7
₹ 15 L/yr - ₹ 30 L/yr
Pune
Infosys logo
Dot Net Developer - Pan India 5-10 years
Infosys
3.6
Hyderabad / Secunderabad
Infosys logo
Dot Net Developer- (Pan India).-H 3-8 years
Infosys
3.6
Hyderabad / Secunderabad

Asked in Infosys

2d ago

Q. Write a LINQ query to fetch data from the 'students' database table, ordering the data by 'studentID' in ascending order.

Ans.

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.

Asked in Nagarro

2d ago

Q. Describe the optimal solution approach for the Traveling Salesman Problem.

Ans.

The optimal solution approach for the Travelling Salesman Problem involves using algorithms such as the Nearest Neighbor Algorithm and the 2-Opt Algorithm.

  • The Nearest Neighbor Algorithm starts at a random city and selects the nearest unvisited city as the next stop.

  • The 2-Opt Algorithm involves swapping two edges in the tour to see if it results in a shorter distance.

  • Other algorithms include the Genetic Algorithm and the Simulated Annealing Algorithm.

  • The optimal solution is no...read more

Share interview questions and help millions of jobseekers 🌟

man-with-laptop
2d ago

Q. What are the SQL queries to delete and update records based on specific conditions?

Ans.

SQL queries for deleting and updating records based on specific conditions

  • For deleting records based on specific conditions: DELETE FROM table_name WHERE condition;

  • For updating records based on specific conditions: UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition;

Q. What is asynchronous programming, and how is the 'async' and 'await' keywords used in this context?

Ans.

Asynchronous programming allows tasks to run concurrently, improving application responsiveness using 'async' and 'await' keywords.

  • Asynchronous programming enables non-blocking operations, allowing other tasks to run while waiting for a task to complete.

  • The 'async' keyword is used to declare a method as asynchronous, allowing it to use 'await' within its body.

  • The 'await' keyword pauses the execution of the async method until the awaited task completes, without blocking the ma...read more

Asked in Sensiple

2d ago

Q. What are design patterns in Dot net, How to handle multiple request at same time?

Ans.

Design patterns in Dot net are reusable solutions to common problems in software design. To handle multiple requests at the same time, we can use asynchronous programming and multithreading.

  • Design patterns in Dot net include Singleton, Factory, Observer, and more.

  • To handle multiple requests at the same time, we can use asynchronous programming with async/await keywords.

  • Another approach is to use multithreading to process multiple requests concurrently.

  • Using Task Parallel Libr...read more

Asked in Infosys

2d ago

Q. What are the characteristics of the singleton pattern and how do you use it?

Ans.

Singleton pattern ensures a class has only one instance and provides a global point of access to it.

  • Characteristics include private constructor, static instance variable, static method to access instance, lazy initialization, and thread safety.

  • Example: public class Singleton { private static Singleton instance; private Singleton() {} public static Singleton getInstance() { if (instance == null) { instance = new Singleton(); } return instance; }}

1d ago

Q. What is the difference between UNION and UNION ALL in SQL?

Ans.

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

Q. How can I retrieve the employee count from the table categorized by their respective cities?

Ans.

Use SQL to group employees by city and count them for retrieval from the database.

  • Use SQL query: SELECT City, COUNT(*) AS EmployeeCount FROM Employees GROUP BY City;

  • Ensure the 'Employees' table has 'City' column for accurate grouping.

  • This query returns a list of cities with their corresponding employee counts.

Q. What is LINQ, and how can pagination be applied using it?

Ans.

LINQ (Language Integrated Query) is a .NET feature for querying collections in a concise and readable manner.

  • LINQ allows querying of various data sources like arrays, collections, databases, and XML.

  • It provides a unified syntax for querying different types of data.

  • Pagination can be implemented using methods like Skip() and Take().

  • Example: var pagedResults = data.Skip(pageNumber * pageSize).Take(pageSize);

  • This retrieves a specific page of results based on the page number and s...read more

Q. What is reflection in programming, and how do we create an instance and access properties using it?

Ans.

Reflection allows inspection and manipulation of object types and members at runtime in .NET.

  • Reflection is part of the System.Reflection namespace.

  • You can create an instance of a class using Activator.CreateInstance().

  • Example: var myObject = Activator.CreateInstance(typeof(MyClass));

  • Access properties using PropertyInfo class: PropertyInfo prop = myObject.GetType().GetProperty('MyProperty');

  • Set or get property values using prop.SetValue() and prop.GetValue().

Q. What is the difference between a function, a stored procedure, and a view?

Ans.

Functions return values, stored procedures perform actions, and views present data in a specific format.

  • Functions: Can return a single value or a table, used in SELECT statements. Example: SELECT dbo.CalculateTax(1000);

  • Stored Procedures: Execute a series of SQL statements, can return multiple results. Example: EXEC dbo.UpdateEmployeeSalary;

  • Views: Virtual tables based on SELECT queries, used to simplify complex queries. Example: CREATE VIEW EmployeeView AS SELECT Name, Salary ...read more

Q. What is the difference between a table variable and a temporary table?

Ans.

Table variables are scoped to a batch, while temporary tables can be scoped to a session or a connection.

  • Table variables are declared using the DECLARE statement, e.g., DECLARE @TableVar TABLE (ID INT).

  • Temporary tables are created using CREATE TABLE #TempTable (ID INT).

  • Table variables have a limited scope and are cleaned up automatically at the end of the batch.

  • Temporary tables can be indexed and can have constraints, while table variables cannot.

  • Temporary tables can be used ...read more

Q. What is the query to retrieve the second highest salary from the employees table?

Ans.

To retrieve the second highest salary, use SQL queries with subqueries or the DISTINCT keyword.

  • Use a subquery to find the maximum salary that is less than the highest salary.

  • Example: SELECT MAX(salary) FROM employees WHERE salary < (SELECT MAX(salary) FROM employees);

  • Alternatively, use the DISTINCT keyword to filter unique salaries.

  • Example: SELECT DISTINCT salary FROM employees ORDER BY salary DESC LIMIT 1 OFFSET 1;

Q. What is the SQL query to retrieve the distinct top three salaries from the employees table?

Ans.

Retrieve distinct top three salaries from the employees table using SQL query.

  • Use the DISTINCT keyword to get unique salary values.

  • Use the ORDER BY clause to sort salaries in descending order.

  • Use the LIMIT clause (or FETCH FIRST) to restrict the result to three records.

  • Example SQL query: SELECT DISTINCT salary FROM employees ORDER BY salary DESC LIMIT 3;

Asked in Sensiple

4d ago

Q. What are filters , Routing and caching in MVC? , How to achieve Authorization in API?

Ans.

Filters, routing, and caching are important concepts in MVC. Authorization in API can be achieved using authentication mechanisms.

  • Filters in MVC are used to perform logic before or after an action method is executed.

  • Routing in MVC is used to map URLs to controller actions.

  • Caching in MVC is used to store data temporarily to improve performance.

  • Authorization in API can be achieved using authentication mechanisms like JWT tokens or OAuth.

  • Example: Using [Authorize] attribute in A...read more

Asked in Infosys

4d ago

Q. What are the differences between an abstract class and an interface?

Ans.

Abstract class is a class that cannot be instantiated and can have both abstract and non-abstract methods. Interface is a contract that a class must adhere to.

  • Abstract class can have fields, constructors, and non-abstract methods, while interface cannot.

  • A class can inherit only one abstract class, but can implement multiple interfaces.

  • Abstract class can provide default implementations for some methods, while interface cannot.

  • Abstract class is used when there is a need for com...read more

Asked in OSP Labs

1d ago

Q. Sarah covers a 600m street in 5 minutes. What is Sarah's speed in km/h?

Ans.

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

Asked in Nagarro

2d ago

Q. What is the difference between an abstract method and an interface?

Ans.

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.

5d ago

Q. What is Object-Oriented Programming (OOP), and what are its applications?

Ans.

OOP 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 reusable and modular code by organizing data and behavior into objects.

  • Key principles of OOP include encapsulation, inheritance, and polymorphism.

  • Examples of OOP languages include Java, C++, and C#.

  • Applications of OOP include software development, game development, and web development.

2d ago

Q. What is the process for inserting data in ASP.NET MVC?

Ans.

The process for inserting data in ASP.NET MVC involves creating a model, a view, and a controller to handle the data insertion.

  • Create a model class to represent the data you want to insert

  • Create a view with form fields to input the data

  • Create a controller action method to handle the form submission and insert the data into the database

  • Use Entity Framework or other data access technologies to interact with the database

Asked in Sensiple

1d ago

Q. What is extension in c#, Tell me about how to initialise session in MVC, What is middleware in API

Ans.

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

Asked in Infosys

3d ago

Q. What is the difference between an abstract class and an interface?

Ans.

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

Asked in Capgemini

6d ago

Q. What is the difference between .NET Core and .NET Framework?

Ans.

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

Q. Write a program to replace the vowels in a string with their corresponding vowels from the end of the string.

Ans.

This program replaces vowels in a string with their corresponding vowels from the end of the string.

  • Identify vowels in the string: a, e, i, o, u.

  • Create a list of vowels from the end of the string.

  • Replace each vowel in the original string with the corresponding vowel from the end.

  • Example: 'hello' becomes 'holle'.

  • Example: 'programming' becomes 'prigremmang'.

1
2
3
4
Next

Interview Experiences of Popular Companies

TCS Logo
3.6
 • 11.1k Interviews
Accenture Logo
3.7
 • 8.7k Interviews
Infosys Logo
3.6
 • 7.9k Interviews
Wipro Logo
3.7
 • 6.1k Interviews
Capgemini Logo
3.7
 • 5.1k Interviews
View all
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories
DOT NET Developer Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits