Below are a set of common interview questions for a fresher .
NET Developer role (0–1 year
experience) along with sample answers. They’re tailored to the job description you provided
(Bangalore location, C#, .NET Framework/Core, SQL) .
1. Tell us about yourself and why you chose .NET
development.
Sample Answer:
“I recently graduated with a Bachelor’s in Computer Science, where I built several academic
projects in C# and ASP.NET. I enjoy .NET because of its strong typing, the productivity of
Visual Studio, and Microsoft’s ecosystem. During my internship/project, I developed a
simple CRM module in ASP.NET MVC, which sparked my interest in building scalable
enterprise applications.”
2. Explain the main differences between .NET
Framework and .NET Core.
Sample Answer:
Platform support: .NET Framework runs only on Windows; .NET Core is
cross-platform (Windows, Linux, macOS).
Performance: .NET Core generally offers better performance and lighter footprint.
Deployment: .NET Core supports self-contained deployments; Framework apps
require the right framework version on the host.
Modularity: .NET Core uses NuGet modular packages, whereas Framework is
monolithic.
3. What are the four pillars of Object-Oriented
Programming (OOP)? Give C# examples.
Sample Answer:
1. Encapsulation:
2. public class User {
3. private string password;
4. public string Password {
5. get { return “****”; } // hides actual
6. set { password = value; }
7. }
8. }
9. Inheritance:
10. public class Employee : User { /* gets User’s members */ }
11. Polymorphism:
12. public virtual void CalculateSalary() { … }
13. public override void CalculateSalary() { … }
14. Abstraction:
15. public interface IDataAccess { void Save(); }
4. How do you perform CRUD operations against SQL
Server in .NET?
Sample Answer:
“I’d typically use ADO.NET or an ORM like Entity Framework Core. With ADO.NET:
using(var conn = new SqlConnection(connString)) {
var cmd = new SqlCommand("INSERT INTO Users(Name) VALUES(@name)", conn);
cmd.Parameters.AddWithValue("@name", user.Name);
conn.Open();
cmd.ExecuteNonQuery();
}
For EF Core:
context.Users.Add(user);
context.SaveChanges();
```”
---
## 5. What is an ASP.NET MVC application’s request pipeline?
**Sample Answer:**
1. **Routing**: URL matched to route pattern.
2. **Controller instantiation**: MVC framework creates the controller.
3. **Action execution**: Controller action method runs.
4. **Result execution**: Returns a ViewResult, JSON, redirect, etc.
5. **View rendering**: Razor engine generates HTML.
---
## 6. Describe what a Web API is and when you’d use it.
**Sample Answer:**
“ASP.NET Web API is a framework for building HTTP services that can be
consumed by clients like browsers, mobile apps, or other servers. I’d use
it to expose RESTful endpoints—for example, a `GET /api/products` that
returns JSON, or a `POST /api/orders` to create an order.”
---
## 7. How do you manage exceptions in .NET?
**Sample Answer:**
“I use `try...catch` blocks around code that can throw, and `finally` for
cleanup. In ASP.NET Core, I’d also configure middleware like
`app.UseExceptionHandler()` to catch unhandled exceptions, log them, and
return a friendly error response.”
---
## 8. What is dependency injection (DI) and how is it supported in .NET
Core?
**Sample Answer:**
“DI is a pattern where dependencies are provided rather than created inside
a class, improving testability and loose coupling. In .NET Core you
register services in `Startup.ConfigureServices(IServiceCollection
services)`, e.g.:
```csharp
services.AddScoped<IUserRepository, UserRepository>();
Then inject IUserRepository via constructor in controllers or services.”
9. Can you explain the difference between IEnumerable<T> and
IQueryable<T>?
Sample Answer:
IEnumerable: In-memory enumeration, LINQ to Objects; filtering happens in the
application after data retrieval.
IQueryable: Builds an expression tree; LINQ to SQL/EF Core translates it to SQL so
filtering happens at the database server.
10. How would you optimize a slow database query in
your .NET application?
Sample Answer:
Analyze with SQL Profiler or EF Core’s logging to find the slow query.
Add appropriate indexes on filter/join columns.
Avoid SELECT *; fetch only needed columns.
Use pagination for large datasets.
For EF Core, use No-Tracking queries for read-only operations:
context.Users.AsNoTracking().Where(u => u.IsActive);
11. Tell us about a .NET project you’ve built—what
challenges you faced and how you solved them.
(Prepare a 1–2 minute story from your academic/internship project.)
12. What are some best practices you follow when writing
C# code?
Sample Answer:
Consistent naming: PascalCase for types/methods, camelCase for parameters.
SOLID principles: Single responsibility, open/closed, etc.
Code reviews: Engage in peer reviews to maintain quality.
Logging: Use ILogger<T> for structured logging.
Comments: Only where intent isn’t obvious; prefer clear code.