DOT NET Developer

600+ DOT NET Developer Interview Questions and Answers

Updated 3 Jul 2025
search-icon

Asked in Yovant

2w ago

Q. What is Primary key? Can it be null? Can we have multiple primary key?

Ans.

Primary key uniquely identifies each record in a table. It cannot be null and there can be only one primary key.

  • Primary key ensures each record in a table is unique

  • Primary key cannot have null values

  • Only one primary key can be defined for a table

  • Primary key can be a single column or a combination of columns

Asked in Chetu

1w ago

Q. What are the differences between stored procedures and functions, and what are the benefits of using each?

Ans.

Stored procedures are precompiled SQL queries stored in the database, while functions are user-defined routines that return a value.

  • Stored procedures are used for performing specific tasks or operations on the database, while functions are used to return a single value.

  • Stored procedures can contain multiple SQL statements and can have input and output parameters, while functions are more limited in their functionality.

  • Stored procedures are generally used for complex business ...read more

Asked in FIS

2w ago

Q. How can you divide an array into two halves and sort each half in ascending order without using a new array?

Ans.

Divide array in two halves and keep each half in ascending order without using new Array.

  • Use Array.sort() method to sort the original array

  • Use Array.slice() method to divide the array into two halves

  • Use Array.reverse() method to reverse the second half of the array

1w ago

Q. What are HTML helpers? Can we create custom HTML Helpers?

Ans.

HTML helpers are methods that help in rendering HTML in a view. Yes, we can create custom HTML helpers.

  • HTML helpers are methods that generate HTML markup in a view.

  • They help in reducing the amount of HTML code that needs to be written in a view.

  • Custom HTML helpers can be created by defining extension methods on the HtmlHelper class.

  • Custom HTML helpers can be useful for generating reusable HTML components or complex HTML markup.

  • Example: Creating a custom HTML helper to generat...read more

Are these interview questions helpful?
1w ago

Q. Given a string, count the number of words in it. For example, for the input string "My Name is Nikhil", return 4.

Ans.

Count the number of words 'My Name is Nikhil'

  • Split the sentence into individual words

  • Count the number of words in the sentence

Asked in Globant

2d 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

DOT NET Developer Jobs

UST GLOBAL TECHNOLOGY SERVICES logo
.NET Developer (C#, .NET, MVC, JavaScript) 5-7 years
UST GLOBAL TECHNOLOGY SERVICES
3.8
₹ 8 L/yr - ₹ 14 L/yr
(AmbitionBox estimate)
Mumbai
Genpact logo
Dot Net Developer 3-8 years
Genpact
3.8
Bangalore / Bengaluru
Infosys logo
Dot Net Developer -{ENG - Infosys @ Pan India -G} 4-9 years
Infosys
3.6
Hyderabad / Secunderabad
2w ago

Q. Can a static constructor have multiple arguments?

Ans.

No, static constructors cannot have multiple arguments.

  • Static constructors in C# do not take any arguments.

  • They are used to initialize static data members or perform any necessary setup for the class.

  • Example: public static MyClass() { // constructor code }

3d ago

Q. Can we write multiple stored procedures Inside Stored Procedures? Can we write functions inside stored procedures?

Ans.

Yes, we can write multiple stored procedures inside stored procedures. Functions can also be written inside stored procedures.

  • Yes, you can call one stored procedure from another stored procedure.

  • You can also define and call functions inside a stored procedure.

  • Example: CREATE PROCEDURE spOuter AS BEGIN CREATE PROCEDURE spInner AS ... END; END;

  • Example: CREATE PROCEDURE spOuter AS BEGIN CREATE FUNCTION fnInner() RETURNS ... AS ... END; END;

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Asked in Capgemini

1w ago

Q. How many sessions can an application have?

Ans.

The number of sessions in an application is not fixed and can vary based on the application's design and requirements.

  • The number of sessions in an application can depend on factors such as user activity, server capacity, and session management techniques.

  • For example, a simple web application may have a limited number of sessions based on the server's capacity, while a complex enterprise application may have a larger number of sessions to handle multiple users and tasks.

  • Sessio...read more

2w ago

Q. What is globalization? How to support multiple languages in application?

Ans.

Globalization is the process of designing and developing applications that can be used in multiple languages and cultures.

  • Use resource files to store text in different languages

  • Use Unicode encoding to support different character sets

  • Use culture-specific formatting for dates, times, and numbers

  • Test the application with different languages and cultures to ensure proper functionality

Asked in Infosys

4d ago

Q. What is the difference between a data table and a dataset?

Ans.

Data table is a single table while dataset is a collection of tables.

  • Data table is a single table that represents a single database table.

  • Dataset is a collection of tables that can hold multiple tables from different databases.

  • Data table can be used to store and manipulate data from a single table.

  • Dataset can be used to store and manipulate data from multiple tables.

  • Data table is a part of dataset.

  • Dataset can hold multiple data tables.

2w ago

Q. How do you integrate a third-party web API into our project?

Ans.

Integrating third party web APIs involves obtaining API key, making HTTP requests, parsing responses, and handling errors.

  • Obtain API key from third party provider

  • Make HTTP requests to the API endpoints

  • Parse the JSON/XML response data

  • Handle errors and exceptions gracefully

1d ago

Q. What will be the output of the following C# code? static void Main() { int val = 5; Show(val); Console.WriteLine("Value of val is " + val); } internal class Show { public static void Show(int i) { i *= i; Conso...

read more
Ans.

The code snippet demonstrates a simple program in C# that declares a variable, calls a method to square its value, and then prints the updated value.

  • The 'show' method takes an integer parameter and squares its value before printing it.

  • The 'val' variable is passed to the 'show' method, which updates its value to 25.

  • The final output will display the updated value of 'val' as 25.

1w ago

Q. What is Compile-time binding and Runtime binding?

Ans.

Compile time binding occurs during compilation while runtime binding occurs during execution.

  • Compile time binding is also known as early binding, where the method to be called is determined at compile time based on the type of the object.

  • Runtime binding is also known as late binding, where the method to be called is determined at runtime based on the actual type of the object.

  • Compile time binding is faster as it is done during compilation, while runtime binding is slower as i...read more

1w ago

Q. How can you change the layout page during runtime?

Ans.

You can change the layout page during runtime by dynamically setting the layout property in the code behind.

  • Set the layout property in the code behind based on certain conditions or user input.

  • Use conditional statements to determine which layout page to use.

  • Example: if(userRole == 'admin') { Layout = '~/Views/Shared/_AdminLayout.cshtml'; } else { Layout = '~/Views/Shared/_UserLayout.cshtml'; }

Asked in Mphasis

1w ago

Q. What is Inheritance and what are the different types of Inheritance?

Ans.

Inheritance is a mechanism in OOP where a class inherits properties and behaviors from another class.

  • Inheritance allows a class to reuse code from another class.

  • Types of inheritance include single inheritance, multiple inheritance, multilevel inheritance, hierarchical inheritance, and hybrid inheritance.

  • Example: Class B inheriting from Class A - B is a subclass of A.

Asked in TCS

1w ago

Q. What is method overloading and method overriding?

Ans.

Method overloading is when multiple methods have the same name but different parameters. Method overriding is when a subclass provides a specific implementation of a method that is already provided by its parent class.

  • Method overloading allows a class to have multiple methods with the same name but different parameters.

  • Method overriding occurs in a subclass when a method has the same name and parameters as a method in its superclass.

  • Method overloading is resolved at compile t...read more

Asked in Cognizant

1d ago

Q. What is the difference between Delete and Truncate?

Ans.

Delete removes rows one by one and can be rolled back, while Truncate removes all rows at once and cannot be rolled back.

  • Delete is a DML command while Truncate is a DDL command.

  • Delete can be rolled back using a transaction, while Truncate cannot be rolled back.

  • Delete fires triggers on each row deletion, while Truncate does not fire triggers.

  • Delete is slower as it removes rows one by one, while Truncate is faster as it removes all rows at once.

  • Delete maintains the identity of ...read more

Asked in NeoSOFT

1d ago

Q. What are the differences between .NET Core, .NET Framework, and .NET?

Ans.

NET core is a cross-platform, open-source framework for building modern, cloud-based, internet-connected applications. NET framework is a Windows-only framework for building Windows desktop applications. NET is a general term encompassing both .NET core and .NET framework.

  • NET core is cross-platform and open-source, while .NET framework is Windows-only.

  • .NET core is modular and lightweight, allowing for faster performance and easier updates.

  • .NET core is designed for building mo...read more

Asked in Capita

5d ago

Q. What is the difference between a clustered and a non-clustered index?

Ans.

Clustered index physically reorders the data in the table while non-clustered index creates a separate structure.

  • Clustered index determines the physical order of data rows in a table.

  • Non-clustered index creates a separate structure to store the index data.

  • A table can have only one clustered index but multiple non-clustered indexes.

  • Clustered index is faster for retrieval but slower for insert and update operations.

  • Non-clustered index is slower for retrieval but faster for inse...read more

Q. What is MVC , Life cycle of MVC

Ans.

MVC stands for Model-View-Controller. It is a software architectural pattern used in web development.

  • MVC separates the 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, updates the model, and interacts with the view.

  • MVC follows a specific life cycle: Request is received, routing determines the appropria...read more

Asked in HCLTech

1w ago

Q. What are the types and number of constraints in your specific context?

Ans.

There are various types of constraints in DOT NET development, including primary key, foreign key, unique, check, and default constraints.

  • Primary key constraints ensure each record in a table is unique.

  • Foreign key constraints enforce referential integrity between tables.

  • Unique constraints ensure that all values in a column are distinct.

  • Check constraints validate the data before it is inserted or updated.

  • Default constraints provide a default value for a column if no value is s...read more

Asked in HCLTech

1w ago

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

Ans.

Independent class can be instantiated while abstract class cannot be instantiated directly.

  • Independent class can be directly instantiated using the 'new' keyword.

  • Abstract class cannot be instantiated directly, it can only be used as a base class for other classes.

  • Independent class does not require any derived class to implement its members.

  • Abstract class can have abstract methods that must be implemented by derived classes.

Asked in FIS

1w ago

Q. What are interfaces, and why do we need them?

Ans.

Interfaces are contracts that define a set of methods and properties that a class must implement.

  • Interfaces provide a way to achieve abstraction and polymorphism in object-oriented programming.

  • They allow for loose coupling between classes and promote code reusability.

  • Interfaces can be used to define common behavior across multiple classes.

  • Example: IDisposable interface in C# ensures that an object can be properly disposed of when it is no longer needed.

  • Example: IComparable in...read more

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

1w 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

2w ago

Q. Stored procedure. String vs String builder, Triggers and how it helps. How to improve query performance. Indexes, types and uses. Validations. Common Table Expression.

Ans.

Stored procedures, string vs string builder, triggers, query performance, indexes, validations, and common table expressions in DOT NET development.

  • Stored procedures are precompiled SQL queries stored in the database for reuse and performance optimization.

  • String builder is more efficient for concatenating large strings compared to regular string concatenation.

  • Triggers are database objects that automatically perform actions when certain events occur in the database.

  • Query perfo...read more

Asked in Nagarro

2w 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

1w ago

Q. What are access Modifiers? What are its types?

Ans.

Access modifiers are keywords in programming languages that define the accessibility of classes, methods, and other members.

  • Types of access modifiers in C# are public, private, protected, internal, protected internal.

  • Public - accessible from any other class.

  • Private - accessible only within the same class.

  • Protected - accessible within the same class or derived classes.

  • Internal - accessible within the same assembly.

  • Protected Internal - accessible within the same assembly or der...read more

6d ago

Q. What was the most recent interesting task in your current project?

Ans.

Implementing a new feature to automate data migration process

  • Developing a custom data migration tool using C# and SQL Server

  • Creating scripts to extract data from legacy system and load into new system

  • Testing the tool with sample data to ensure accuracy and efficiency

Previous
1
2
3
4
5
6
7
Next

Interview Experiences of Popular Companies

TCS Logo
3.6
 • 11.1k Interviews
Accenture Logo
3.8
 • 8.6k 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

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

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