Senior .NET Developer
70+ Senior .NET Developer Interview Questions and Answers
Q1. Find indexes of two values in an array who's Sum is 8 or a dynamic value
Find indexes of two values in an array whose sum is 8 or a dynamic value
Iterate through the array and store the indexes of each element in a dictionary with the difference between the target sum and the element as the key
Check if the current element exists in the dictionary, if so, return the indexes of the two elements
Handle cases where the target sum is dynamic by replacing 8 with a variable
Q2. what are Microservices? How to manage load balancing in Microservices?
Microservices are a software architecture design where applications are broken down into smaller, independent services that communicate with each other through APIs.
Microservices are designed to be small, focused, and independently deployable services.
Each microservice typically performs a single function or task within the application.
Microservices communicate with each other through APIs, often using lightweight protocols like HTTP or messaging queues.
Load balancing in micr...read more
Senior .NET Developer Interview Questions and Answers for Freshers
Q3. what is extension method ,value type and reference type ,migration in codefirst approach,Configure menthod in dotnet core ,
Extension methods allow adding new methods to existing types, value types store data directly, reference types store references to data, migration in code-first approach involves updating database schema, Configure method in .NET Core configures services and middleware.
Extension methods are static methods that can be called as if they were instance methods on an existing type.
Value types store data directly on the stack, while reference types store references to data on the h...read more
Q4. What are the differences between .Net and .Net Core?
The main difference is that .NET Core is open-source and cross-platform while .NET Framework is Windows-only.
Both are used for building Windows applications, but .NET Core can also be used for web and cloud applications.
.NET Core has a smaller runtime and can be deployed as a single executable file.
.NET Core supports Docker containers and can be used on Linux and macOS.
.NET Framework has a larger runtime and requires installation on the target machine.
Some libraries and APIs ...read more
Q5. What is depandancy injection in. Net core and what toes of depandancy injection with example
Dependency injection in .NET Core is a design pattern where a class receives its dependencies from external sources rather than creating them itself.
Dependency injection helps in achieving loose coupling between classes.
Types of dependency injection in .NET Core include constructor injection, property injection, and method injection.
Example: Constructor injection involves injecting dependencies through a class's constructor.
Example: Property injection involves injecting depen...read more
Q6. what are Design Patters? What is DI?
Design patterns are reusable solutions to common problems in software design. DI stands for Dependency Injection, a design pattern used to inject dependencies into a class.
Design patterns are best practices for solving common software design problems.
DI is a design pattern where dependencies are injected into a class rather than created within the class.
Examples of design patterns include Singleton, Factory, and Observer.
Dependency Injection helps improve code maintainability...read more
Share interview questions and help millions of jobseekers 🌟
Q7. How to use DI in .Net Core
DI in .Net Core allows for loosely coupled and testable code.
Add services to the DI container in Startup.cs
Inject dependencies into classes using constructor injection
Use built-in DI or third-party libraries like Autofac
Configure lifetime of services with AddScoped, AddTransient, or AddSingleton
Q8. What are different ways to Inject services
Different ways to inject services in .NET
Constructor Injection: Services are injected through a class constructor
Property Injection: Services are injected through public properties
Method Injection: Services are injected as method parameters
Service Locator Pattern: Services are accessed through a central registry
DI Containers: Frameworks like Autofac, Unity, or Ninject manage service injection
Senior .NET Developer Jobs
Q9. What is the return type for controller actions
The return type for controller actions in .NET is typically ActionResult.
The return type for controller actions can be ActionResult, ViewResult, PartialViewResult, JsonResult, ContentResult, RedirectResult, RedirectToRouteResult, FileResult, HttpNotFoundResult, HttpStatusCodeResult, etc.
ActionResult is a base class for all action results in ASP.NET MVC.
Example: public ActionResult Index() { return View(); }
Q10. what are difference between put , patch and post
PUT is used to update or replace an existing resource, PATCH is used to partially update a resource, and POST is used to create a new resource.
PUT is idempotent, meaning multiple identical requests will have the same effect as a single request.
PATCH is not necessarily idempotent and is used to make partial updates to a resource.
POST is used to create a new resource on the server.
Q11. Difference between function and stored procedure in SQL
Functions return a single value while stored procedures can perform multiple operations and return multiple values.
Functions return a single value while stored procedures can return multiple values.
Functions are used for computations and return values, while stored procedures are used for executing a sequence of statements.
Functions can be called from within SQL statements, while stored procedures are called using the EXECUTE statement.
Functions cannot modify the database sta...read more
Q12. Write a code for pop node from stack data structure.
Code to pop a node from a stack data structure in C#.
Create a method to remove and return the top element from the stack.
Check if the stack is empty before popping the node to avoid errors.
Decrement the top index after popping the node to update the stack.
Q13. How JWT authentications work in Web API
JWT authentication in Web API involves generating a token with user credentials and validating it on subsequent requests.
JWT stands for JSON Web Token, which is a compact and self-contained way for securely transmitting information between parties as a JSON object.
In Web API, a JWT token is generated upon successful authentication and is sent to the client.
The client includes the JWT token in the Authorization header of subsequent requests to access protected resources.
The We...read more
Q14. Cursor is memory taken than why we used
Cursors are used in databases to retrieve and manipulate data, despite consuming memory.
Cursors are used to iterate over a result set in a database query.
They allow for sequential processing of query results.
While they do consume memory, they are necessary for certain operations like updating rows in a specific order.
Cursors should be used judiciously to avoid excessive memory consumption.
Q15. What is middelware in. Net core.
Middleware in .NET Core is software components that are assembled into an application pipeline to handle requests and responses.
Middleware components are executed in the order they are added to the pipeline.
Middleware can perform tasks like authentication, logging, error handling, etc.
Examples of middleware in .NET Core include UseAuthentication, UseMvc, UseStaticFiles.
Q16. Difference between stored procedure and Stored functions
Stored procedures are used to perform a set of actions, while stored functions return a single value.
Stored procedures can perform multiple actions and can return multiple result sets.
Stored functions are used to return a single value and cannot perform DML operations.
Stored functions can be used in SELECT statements, while stored procedures cannot be used in SELECT statements.
Q17. What are the dot net components?
Dot net components are reusable software building blocks that provide functionality for various aspects of application development.
Common Language Runtime (CLR) - provides a runtime environment for executing .NET applications
Framework Class Library (FCL) - a collection of reusable classes, interfaces, and value types
ASP.NET - a web application framework for building dynamic web sites, web applications, and web services
ADO.NET - a set of classes that expose data access service...read more
Q18. What is managed and unmanaged code?
Managed code is code that is executed by the Common Language Runtime (CLR) while unmanaged code is executed directly by the operating system.
Managed code is written in languages like C#, VB.NET, and F# that are compiled into Intermediate Language (IL) and executed by the CLR.
Unmanaged code is written in languages like C and C++ that directly interact with the operating system and hardware.
Managed code provides automatic memory management, exception handling, and security feat...read more
Q19. DB schema creation for cinducting an online test
DB schema for online test
Create tables for questions, answers, users, and results
Use foreign keys to link tables together
Include fields for question type, difficulty level, and time limit
Store user responses and calculate scores
Consider security measures to prevent cheating
Q20. Ho to add validation in MVC
Validation in MVC
Use data annotations for server-side validation
Use jQuery validation for client-side validation
Customize validation messages using ErrorMessage property
Use ModelState.IsValid to check if validation passed
Use ModelState.AddModelError to add validation errors
Q21. Ho to Use Transactions in Sql
Transactions in SQL ensure data consistency and integrity during multiple operations.
Transactions group multiple SQL statements into a single unit of work.
They ensure that all statements are executed or none are executed.
They provide data consistency and integrity during multiple operations.
Transactions can be started with BEGIN TRANSACTION and committed with COMMIT or rolled back with ROLLBACK.
They are useful in situations where multiple operations need to be performed atomi...read more
Q22. What are Middleware and filters
Middleware and filters are components in ASP.NET Core that allow you to handle requests and responses in the pipeline.
Middleware are components that are added to the request pipeline to handle requests and responses.
Filters are used to implement cross-cutting concerns like logging, exception handling, and authorization.
Middleware can be used to modify the request or response before it reaches the controller action.
Filters can be applied globally, at the controller level, or a...read more
Q23. Difference between Entity Framework and ADO.Net
Entity Framework is an ORM that simplifies data access in .NET applications, while ADO.Net is a low-level data access technology.
Entity Framework is an Object-Relational Mapping (ORM) framework that allows developers to work with databases using .NET objects.
ADO.Net is a set of classes that allows developers to interact with data sources like databases directly using SQL commands.
Entity Framework provides higher level of abstraction and reduces the amount of code needed for d...read more
Q24. How to store two values in same html tag
Use data attributes to store multiple values in the same HTML tag
Use data attributes like data-value1 and data-value2 to store two values in the same HTML tag
Access the values using JavaScript by querying the data attributes
Q25. Ho to call DI in controller
To call DI in controller, inject the required service in the constructor of the controller.
Add required service in ConfigureServices method of Startup.cs
Inject the service in the constructor of the controller
Use the service in the controller methods
Q26. What are the Design patterns?
Design patterns are reusable solutions to common software development problems.
Design patterns provide proven solutions to recurring problems in software development.
They help in creating code that is more flexible, reusable, and maintainable.
Some common design patterns include Singleton, Factory, Observer, and Decorator.
Design patterns can be categorized into three types: Creational, Structural, and Behavioral.
Q27. What is Dependency Injection?
Dependency Injection is a design pattern that allows objects to receive dependencies rather than creating them internally.
DI is a way to achieve loose coupling between objects
It helps in creating more testable and maintainable code
DI can be implemented using constructor injection, property injection, or method injection
Example: Instead of creating a database connection object inside a class, we can inject it from outside
Example: ASP.NET Core uses DI to inject services into co...read more
Q28. What is the Expected CTC?
Expected CTC depends on various factors such as experience, skills, location, and company policies.
Expected CTC can vary based on the candidate's experience and skills.
Location can also play a role in determining the Expected CTC.
Company policies and budget can also impact the Expected CTC.
It is important to research industry standards and negotiate based on market rates.
Providing a specific number may limit negotiation opportunities.
Q29. How to Use Webapi
WebAPI is a framework for building HTTP services that can be consumed by a broad range of clients.
Create a new WebAPI project in Visual Studio
Define API endpoints using HTTP verbs (GET, POST, PUT, DELETE)
Use attribute routing to map URLs to actions
Return data in JSON format
Secure the API using authentication and authorization
Q30. Difference between single & first in linq
Single returns the only element of a sequence, or a default value if the sequence is empty. First returns the first element of a sequence, or a default value if the sequence contains no elements.
Single throws an exception if the sequence contains more than one element, while First does not.
Single is useful when you expect only one element in the sequence, while First is used when you just need the first element.
Example: var singleElement = list.Single(); var firstElement = li...read more
Q31. Write a query to join two tables using LINQ
Join two tables using LINQ
Use the join keyword to combine two tables based on a common field
Specify the fields to be joined using the equals keyword
Select the desired fields from both tables using the select keyword
Q32. Clustered vs Non-Clustered
Clustered indexes determine physical order of data, non-clustered indexes are separate structures.
Clustered indexes sort and store data rows in the table based on their key values.
Non-clustered indexes have a separate structure that includes the indexed columns and a pointer to the data row.
Tables can have only one clustered index, but multiple non-clustered indexes.
Clustered indexes are faster for retrieving large amounts of data, while non-clustered indexes are faster for r...read more
Q33. Query Optimization in Sql
Query optimization in SQL
Use indexes to speed up queries
Avoid using SELECT *
Use JOINs instead of subqueries
Avoid using functions in WHERE clauses
Use EXPLAIN to analyze query performance
Q34. Dot net core vs dot net
Dot net core is the open-source, cross-platform version of .NET, while .NET is the traditional framework for Windows applications.
Dot net core is open-source and cross-platform, allowing for development on Windows, macOS, and Linux.
.NET is the traditional framework for Windows applications, providing a wide range of libraries and tools.
Dot net core is more lightweight and modular, making it easier to deploy and maintain applications.
Both Dot net core and .NET support C#, F#, ...read more
Q35. write code for event and Delegate
Event and Delegate code example in C#
Create a delegate with the signature of the method you want to subscribe to
Define an event using the delegate type
Subscribe to the event by adding methods to the event delegate
Raise the event to notify subscribers
Q36. How to handle error in SQL
Errors in SQL can be handled using try-catch blocks, error handling functions, and logging mechanisms.
Use try-catch blocks to catch and handle errors in SQL queries
Utilize error handling functions like @@ERROR, ERROR_MESSAGE(), and ERROR_NUMBER() to retrieve error information
Implement logging mechanisms to track and monitor errors for troubleshooting
Consider using transactions to ensure data integrity and rollback changes in case of errors
Q37. Can you rollback triggers
Yes, triggers can be rolled back in SQL Server.
Triggers can be rolled back using the ROLLBACK statement in SQL Server.
Rolling back a trigger will undo any changes made by the trigger.
Example: ROLLBACK TRANSACTION;
Q38. What is the OOP concepts?
OOP concepts are the fundamental principles of Object-Oriented Programming.
Encapsulation - bundling of data and methods that operate on that data
Inheritance - ability of a class to inherit properties and methods from a parent class
Polymorphism - ability of objects to take on multiple forms or have multiple behaviors
Abstraction - hiding of complex implementation details and showing only essential features
Examples: class, object, inheritance, encapsulation, polymorphism, abstra...read more
Q39. Difference between ref & out keyword
ref is used for passing a variable by reference, out is used for returning a value from a method
ref keyword is used to pass a variable by reference, allowing the method to modify the variable
out keyword is used to return a value from a method, the variable passed must be assigned a value within the method
ref parameters must be initialized before passing to the method, out parameters do not need to be initialized
Q40. What is Private Constructor
A private constructor is a constructor that can only be accessed within the class in which it is defined.
Private constructors are used to prevent the instantiation of a class from outside the class itself.
They are commonly used in classes that contain only static members and do not need to be instantiated.
Private constructors are also used in singleton design pattern to ensure that only one instance of a class can be created.
Q41. What is encapsulation
Encapsulation is the process of hiding internal implementation details and exposing only necessary information to the outside world.
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.
Example: In a class, private variables can be encapsulated and accessed through public methods.
Q42. What is model-view-model
Model-View-ViewModel (MVVM) is a software architectural pattern that separates the development of the graphical user interface (the view) from the business logic (the model) using a mediator called the view model.
MVVM is commonly used in the development of desktop and mobile applications.
The model represents the data and business logic of the application.
The view is responsible for displaying the user interface.
The view model acts as a bridge between the view and the model, p...read more
Q43. What is MVC Architecture
MVC Architecture is a software design pattern that separates an application into three main components: Model, View, and Controller.
Model represents the data and business logic of the application.
View is responsible for displaying the user interface.
Controller handles user input, updates the model, and interacts with the view.
MVC promotes separation of concerns, making the application easier to maintain and test.
Example: In a web application, the model could be a database, th...read more
Q44. Advantage of dotnet core over dotnet
Dotnet core is faster, cross-platform, open-source and modular compared to dotnet.
Dotnet core is faster and more efficient than dotnet.
Dotnet core is cross-platform, meaning it can run on Windows, Linux, and macOS.
Dotnet core is open-source, allowing developers to contribute to its development and customize it to their needs.
Dotnet core is modular, allowing developers to use only the components they need, reducing the size of the application.
Examples of companies using dotnet...read more
Q45. Explain Angular hooks or lifecycle
Angular hooks or lifecycle are methods that allow developers to tap into key moments in a component's lifecycle.
Angular components have several lifecycle hooks such as ngOnInit, ngOnChanges, ngDoCheck, ngOnDestroy, etc.
These hooks allow developers to perform actions at specific points in a component's lifecycle, such as initialization, change detection, and destruction.
For example, ngOnInit is used to initialize data in a component when it is first created, while ngOnDestroy ...read more
Q46. Dependency injection in .net core
Dependency injection in .NET Core allows for loosely coupled components and easier testing.
Dependency injection is a design pattern where components are given their dependencies rather than creating them internally.
In .NET Core, dependency injection is built-in and can be configured in the ConfigureServices method of the Startup class.
Services are registered in the ConfigureServices method and can be injected into controllers, services, or other components.
Example: services.A...read more
Q47. On which port .Net runs
The .NET framework does not run on a specific port. It runs on top of the operating system and uses the underlying network protocols.
The .NET framework does not have its own port number.
It relies on the operating system's network stack to handle network communication.
Applications built with .NET can listen on any available port specified by the developer.
For example, a web application built with ASP.NET can listen on port 80 for HTTP traffic.
Q48. What is WCF throttling
WCF throttling is a mechanism to control the number of concurrent requests and resources used by a WCF service.
WCF throttling helps prevent resource exhaustion and performance degradation.
Throttling settings can be configured in the WCF service configuration file.
Throttling parameters include maximum concurrent calls, sessions, and instances.
Examples of throttling settings are maxConcurrentCalls, maxConcurrentSessions, and maxConcurrentInstances.
Q49. Inner vs Outer Join
Inner join returns only matching records while outer join returns all records from both tables.
Inner join is used to retrieve records that have matching values in both tables.
Outer join is used to retrieve all records from both tables, even if there are no matching values.
Left outer join returns all records from the left table and matching records from the right table.
Right outer join returns all records from the right table and matching records from the left table.
Q50. drop ,delete and truncate difference
Drop, delete, and truncate are SQL commands used to remove data from a table, but they have different functionalities.
DROP: Used to remove an entire table or database
DELETE: Used to remove specific rows from a table
TRUNCATE: Used to remove all rows from a table, but keeps the table structure
Interview Questions of Similar Designations
Top Interview Questions for Senior .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