DOT NET Developer
70+ DOT NET Developer Interview Questions and Answers for Freshers
Q1. Can Two Primary keys can be made possible in Sql Table ?
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.
Q2. what is the components of dotnetframework which types
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
Q3. Tell Travelling Salesman Problem Optimal Solution Approach
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
Q4. Query to find 4th higesty salary
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
Q5. What are the SQL queries to delete and update records based on specific conditions?
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;
Q6. What are the uses of the SELECT, DELETE, and UPDATE queries in SQL?
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
Share interview questions and help millions of jobseekers 🌟
Q7. What are ViewBag, ViewData, and TempData in ASP.NET, and what are the differences between them?
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
Q8. what are the characteristics of singleton pattern and how to use
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; }}
DOT NET Developer Jobs
Q9. What is Object-Oriented Programming (OOP), and what are its applications?
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.
Q10. What is the process for inserting data in ASP.NET MVC?
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
Q11. Different between Abstract class and interface.
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
Q12. 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
Q13. 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
Q14. 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.
Q15. 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
Q16. 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
Q17. 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.
Q18. December between ienumerable and iqueryable
Difference between IEnumerable and IQueryable
IEnumerable is used for in-memory collections while IQueryable is used for querying data from a database
IEnumerable executes the query on the client-side while IQueryable executes the query on the server-side
IQueryable supports deferred execution while IEnumerable does not
Q19. What is model, view, controlar.
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 of the application
View is responsible for rendering the user interface
Controller handles user input and updates the model and view accordingly
MVC promotes separation of concerns and modularity
Example: ASP.NET MVC framework
Q20. Write a CRUD operation for input filed name , email and password
Create CRUD operations for name, email, and password input fields.
Create a form with input fields for name, email, and password.
Implement functions for Create, Read, Update, and Delete operations for each field.
Use a database to store and retrieve the data.
Example: Create operation - INSERT INTO users (name, email, password) VALUES ('John Doe', 'johndoe@example.com', 'password123');
Q21. what is difference between union and union all
Union combines and removes duplicates, Union All combines without removing duplicates.
Union removes duplicates from the result set, while Union All does not.
Union is slower than Union All because it has to perform an additional step to remove duplicates.
Union is used when you want to combine two result sets and remove duplicates, while Union All is used when you want to combine two result sets without removing duplicates.
Q22. Difference between abstract class and interface and their use in your project
Abstract class can have implementation while interface cannot. Abstract class can have constructors while interface cannot.
Abstract class can have method implementations while interface cannot.
Abstract class can have fields while interface cannot.
Abstract class can have constructors while interface cannot.
Interfaces are used for multiple inheritance in C#.
Abstract classes are used when some common functionality needs to be implemented for all derived classes.
Q23. A:B=3:4,C:B=5:4 ,C:D=10:9 then what will be A:D ?
A:D = 6:5
First, find the common ratio between A and B, which is 3:4
Then, use the ratios between B and C, and C and D to find the ratio between A and D
Calculate the ratio A:D using the ratios found in the previous steps
Q24. What is .NET, and what are its purposes?
NET is a software framework developed by Microsoft for building and running applications on Windows.
NET is used for developing web applications, desktop applications, mobile applications, and services.
It provides a large class library known as Framework Class Library (FCL) to support various programming languages.
It allows interoperability between different programming languages such as C#, VB.NET, and F#.
Examples of .NET technologies include ASP.NET, WPF, and Xamarin.
Q25. Finding minimum element in sorted and rotated array. (Binary search)
Binary search to find minimum element in sorted and rotated array.
Perform binary search to find the pivot element where the array is rotated.
Compare the pivot element with the first element to determine which half to search in.
Continue binary search in the appropriate half to find the minimum element.
Q26. What is dotnet?
dotnet is a software framework developed by Microsoft for building and running applications on Windows.
dotnet is a free, open-source framework
It supports multiple programming languages like C#, F#, and Visual Basic
It provides a common runtime environment for executing applications
It includes a large class library for various functionalities
dotnet Core is a cross-platform version of dotnet
Q27. what is the interfaces
Interfaces are a way to define a contract between classes, specifying methods and properties that must be implemented.
Interfaces allow for polymorphism and loose coupling
Classes can implement multiple interfaces
Interfaces can inherit from other interfaces
Examples include IDisposable, IEnumerable, and IComparable
Q28. What is java, collection frame work
Java is a programming language and Collection Framework is a set of classes and interfaces used to store and manipulate groups of objects.
Java is an object-oriented programming language used to develop applications for various platforms.
Collection Framework provides interfaces like List, Set, and Map to store and manipulate groups of objects.
Examples of Collection Framework classes are ArrayList, HashSet, and HashMap.
Q29. how to send bulk of data through db
Use bulk insert or batch processing to send large amounts of data through the database.
Use bulk insert operations provided by the database management system.
Consider using batch processing techniques to optimize performance.
Use stored procedures or parameterized queries for efficient data transfer.
Q30. Htmlfor vs html in mvc
HtmlHelper is used to generate HTML controls in MVC views, while html is used for static HTML markup.
HtmlHelper is a class in MVC that helps generate HTML controls with strongly-typed views
HtmlHelper provides intellisense support and compile-time checking for HTML controls
html is used for static HTML markup in MVC views
Q31. What is async and await in dot net?
Async and await are keywords in C# that allow for asynchronous programming, making it easier to write code that doesn't block the main thread.
Async is used to define a method as asynchronous, allowing it to run concurrently with other code.
Await is used within an async method to pause execution until a task is complete, without blocking the main thread.
Async and await are commonly used in scenarios such as making web requests, database operations, and file I/O.
Example: async ...read more
Q32. What is encapsulation?
Encapsulation is the process of hiding internal details and providing a public interface for accessing and manipulating data.
Encapsulation helps in achieving data abstraction and data hiding.
It allows for better control over the data by preventing direct access to it.
Encapsulation promotes code reusability and maintainability.
In object-oriented programming, encapsulation is implemented using classes and access modifiers.
Example: A class with private variables and public metho...read more
Q33. class and object programe Example
Class and object programming example
Classes are templates for objects
Objects are instances of classes
Classes define properties and methods
Objects can access and modify properties and methods
Example: Class - Car, Object - Honda Civic
Q34. Difference between mvc vs webapi
MVC is a web application framework for building web pages, while WebAPI is a framework for building HTTP services.
MVC is used for building web applications that return HTML views to the client.
WebAPI is used for building HTTP services that return data in JSON or XML format.
MVC has a view engine that generates HTML output, while WebAPI does not.
MVC has a controller that handles user input and updates the model, while WebAPI has a controller that handles HTTP requests and retur...read more
Q35. Write an SQL query for finding second maximum
SQL query to find the second maximum value in a table
Use the MAX function to find the maximum value in the table
Use the WHERE clause to exclude the maximum value
Use the MAX function again to find the second maximum value
Q36. What is value type and reference type
Value types store data directly, while reference types store a reference to the data
Value types are stored on the stack and include simple types like int, float, struct
Reference types are stored on the heap and include classes, interfaces, arrays
Changing a value type variable does not affect other variables, while changing a reference type variable can affect other variables
Example: int is a value type, while string is a reference type
Q37. What is oops concept why is used
OOPs (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.
Encapsulation: Bundling data and methods that operate on the data into a single unit.
Inheritance: Allowing a class to inherit properties and behavior from another class.
Polymorphism: The ability of different classes to be treated as instances of the same class through a common interface.
Abstraction: Hidin...read more
Q38. What is sql?
SQL stands for Structured Query Language. It is a programming language used for managing and manipulating relational databases.
SQL is used to create, modify, and retrieve data from databases.
It is a standard language for interacting with databases.
SQL statements are used to perform tasks such as inserting, updating, and deleting data.
Examples of SQL commands include SELECT, INSERT, UPDATE, and DELETE.
SQL is not case-sensitive, meaning keywords can be written in uppercase or l...read more
Q39. give some scenario in sql server about joins
SQL Server joins are used to combine rows from two or more tables based on a related column between them.
Inner Join: Returns rows when there is at least one match in both tables.
Left Join: Returns all rows from the left table and the matched rows from the right table.
Right Join: Returns all rows from the right table and the matched rows from the left table.
Full Outer Join: Returns rows when there is a match in one of the tables.
Self Join: Joining a table with itself to combin...read more
Q40. What is an object?
An object is an instance of a class that encapsulates data and behavior.
An object is created from a class blueprint.
It has state (data) and behavior (methods).
Objects can interact with each other through method calls.
Example: A car object can have properties like color and speed, and methods like start and stop.
Q41. How to authenticate MVC application
MVC application authentication can be achieved using various methods like Forms Authentication, Windows Authentication, OAuth, etc.
Use Forms Authentication for username/password based authentication
Implement Windows Authentication for intranet applications
Utilize OAuth for third-party authentication like Google, Facebook, etc.
Q42. Minimum jumps to reach end of an array.
Minimum jumps to reach end of an array can be calculated using dynamic programming approach.
Use dynamic programming to keep track of minimum jumps needed to reach each index.
Iterate through the array and update the minimum jumps for each index based on previous jumps.
Return the minimum jumps needed to reach the end of the array.
Q43. what are the selectors in css
Selectors in CSS are patterns used to select the elements you want to style on a web page.
Selectors can target elements based on their tag name, class, ID, attributes, and more.
Examples include: element selector (p), class selector (.example), ID selector (#example), attribute selector ([type='text']), etc.
Q44. what is the methode
Method is a block of code that performs a specific task and can be called by other parts of the program.
Methods are used to break down complex programs into smaller, more manageable pieces.
They can take input parameters and return values.
Examples of methods in C# include Console.WriteLine() and Math.Max().
Q45. What is interface
An interface is a contract that defines a set of methods and properties that a class must implement.
An interface is a blueprint for a class
It contains only the signatures of methods, properties, and events
It does not provide implementation
A class can implement multiple interfaces
Interfaces are used to achieve abstraction and polymorphism
Q46. Why inheritance used in projects
Inheritance is used in projects to promote code reusability, reduce redundancy, and improve maintainability.
Inheritance allows for the creation of a hierarchy of classes where common attributes and methods can be defined in a base class and inherited by subclasses.
It helps in promoting code reusability by allowing subclasses to inherit properties and methods from a base class, reducing redundancy in code.
Inheritance also helps in improving maintainability as changes made to t...read more
Q47. Explain logic of prime number
Prime numbers are numbers that are only divisible by 1 and themselves.
Start with 2, check if number is divisible by any number less than itself
If not divisible, it is a prime number
Use a loop to check all numbers less than the given number
1 is not a prime number
Q48. what is constructor chaining
Constructor chaining is the process of calling one constructor from another constructor within the same class.
Allows for reusing code and avoiding duplication
Can be achieved using 'this' keyword in the constructor
Example: public MyClass(int x) : this(x, 0) {}
Q49. what is CTE and explain
CTE stands for Common Table Expressions, which is a temporary result set that can be referenced within a SELECT, INSERT, UPDATE, or DELETE statement.
CTEs are defined using the WITH keyword in SQL.
They help improve readability and maintainability of complex queries.
CTEs can be recursive, allowing for hierarchical data querying.
Example: WITH CTE AS (SELECT * FROM table_name) SELECT * FROM CTE;
Example: WITH RECURSIVE CTE AS (SELECT * FROM table_name UNION ALL SELECT * FROM CTE) ...read more
Q50. what is the extension method
Extension methods allow adding new methods to existing types without modifying the original type
Extension methods are static methods that can be called as if they were instance methods of the extended type
They are defined in static classes and must be in the same namespace as the extended type
They are commonly used to add functionality to existing types or interfaces without modifying them directly
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