Interview Questions about project
1) Explain about your project? (V IMP)
2) How to solve performance issue in project? (V IMP)
3) How to handle an issue when two users are trying to modify a same data at a time in
project? (dot net core)
4) how to handle when two methods or functions conflict in dot net core project?
5) What is the Data base layer used in your project? (V IMP)
6) What is the Structure of the project?
7) What are the data based in project?
8) Can tell me about one class and the method names used in your project.
9) What are the OOPS concept used in your project?
10)
1) How to solve performance issue in project?
“In my recent project, we faced significant performance challenges, especially around
API response time, database bottlenecks, and high memory usage.
I approached the problem systematically using a measure → analyze → optimize
methodology.”
🔎 1. Identified Performance Bottlenecks
“I started by collecting diagnostics using:
Application Insights (slow dependency calls, SQL duration, CPU usage)
Dotnet Trace / PerfView
SQL Profiler & Execution Plans
BenchmarkDotNet for testing methods
Load testing using JMeter & Azure Load Testing
This helped me categorize issues as either CPU-bound, I/O-bound, or database-
blocking.”
2. Database Performance Optimization
“Most performance issues were DB-related, so I optimized SQL first.”
Key optimizations:
Added Clustered + Non-Clustered Indexes on high-traffic columns
Rewrote heavy LINQ queries into optimized Stored Procedures
Reduced expensive table scans by replacing LIKE '%text%' patterns
Added covering indexes for frequent JOIN queries
Reduced excessive joins by normalizing data
Applied caching for frequently accessed master data
Implemented partitioning for large tables (millions of rows)
Result:
“DB CPU dropped 40–50%, and query execution time dropped from seconds to
milliseconds.”
⚙️3. API & Code-Level Optimization
“I optimized the .NET Core application by focusing on code, threading, and async
operations.”
Code-level improvements:
Used Asynchronous programming (async/await) for all I/O operations
Removed unnecessary .ToList(), minimizing in-memory operations
Used Compiled queries for EF Core
Refactored heavy LINQ expressions into SQL-compatible queries
Avoided large object allocations and minimized boxing/unboxing
Implemented Cancellation Tokens to avoid long-running tasks
Added MemoryCache / Redis caching for static & semi-static data
Enabled Response Caching for GET requests
4. EF Core Optimization
“I tuned EF Core for high throughput:”
Disabled Lazy Loading to avoid N+1 query issues
Used Eager loading only where required (Include)
Applied AsNoTracking() for read-heavy queries
Used Bulk operations ([Link]) for inserts/updates
Avoided calling SaveChanges() inside loops
Used Database-first loading for huge data extracts
Result:
“Reduced DB round-trips by 60%.”
🌐 5. Architecture & Design-Level Improvements
“As a senior developer, I also improved the architecture.”
Major architecture-level enhancements:
Introduced CQRS pattern for read/write separation
Implemented Background services for long-running jobs
Used Outbox pattern to reduce transaction locks
Applied Circuit Breaker + Retry Policies using Polly
Implemented API gateway caching and Rate limiting
Introduced message queueing (RabbitMQ/Azure Service Bus) for heavy tasks
Enabled GZIP compression at middleware level
⚡ 6. Improved Application Startup & Hosting
Enabled Kestrel tuning (thread pool, limits)
Reduced middleware overhead
Enabled Response Compression Middleware
Containerized services and optimized Docker image layers
📈 7. Final Verification
“I validated performance improvements by:
Running the same load tests
Monitoring metrics using Application Insights dashboards
Setting alerts for high CPU, long SQL queries, dependency failures”
Final Result:
“We improved API response time from 3–5 seconds to under 400 ms, reduced DB
load by 50%, and improved overall system throughput by 2x.”
⭐ Short Version (If interviewer wants a quick answer)
“I fixed performance issues by analyzing API/SQL bottlenecks using Application
Insights and SQL Profiler, optimizing indexes, rewriting heavy queries, implementing
caching (Redis/In-memory), using async programming, disabling EF lazy loading,
optimizing LINQ, tuning Kestrel, and applying architectural improvements like CQRS
and background jobs.
These improvements reduced API response time from 3 seconds to < 400 ms.”
2) how to handle a issue when two users are trying to modify a same data at a time? in
dot net core.
✅ 1. Use Optimistic Concurrency (Most Common in .NET Core + EF Core)
This is used when conflicts are rare.
EF Core supports optimistic concurrency by using a RowVersion / Timestamp
column.
How it works
When a user loads data, EF stores the RowVersion.
When the user updates, EF checks if RowVersion is same in DB.
If someone else has already changed the row → EF throws
DbUpdateConcurrencyException.
Database Example
ALTER TABLE Employee
ADD RowVersion ROWVERSION;
C# Model Example
public class Employee
{
public int Id { get; set; }
public string Name { get; set; }
[Timestamp]
public byte[] RowVersion { get; set; }
}
Handling Concurrency Exception in .NET Core
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
// Someone else modified the record
throw new Exception("The record was updated by another user. Please refresh.");
}
Interview explanation:
“I implemented optimistic concurrency using a RowVersion column.
If two users try to update the same record, EF Core detects it and throws a
concurrency exception, which we handle gracefully by showing a message like ‘Data
has been modified by another user, please refresh and try again.’”
✅ 2. Use Pessimistic Concurrency (Locking Data)
Used in banking, finance, inventory—when conflicts MUST be prevented.
How it works
You lock the row while updating:
SELECT * FROM Employee WITH (UPDLOCK, ROWLOCK)
WHERE Id = 10;
This prevents other users from updating the row.
Interview explanation:
“In critical modules where data consistency was mandatory, we used pessimistic
locking (UPDLOCK, HOLDLOCK) to lock the record while one user was updating. This
avoids simultaneous writes.”
✅ 3. Application-Level Prevention (UI Lock / API Lock)
Disable edit button if someone else is editing
Use “Check-out / Check-in” mechanism
Use distributed lock like Redis if multiple servers
⭐ Perfect Answer for Interviews
“In .NET Core, we handle simultaneous updates using Optimistic Concurrency with a
RowVersion column.
Whenever a user tries to update a record, Entity Framework compares the original
RowVersion with the current one in the database.
If someone else has already changed the data, EF throws a
DbUpdateConcurrencyException, and I return a message asking the user to refresh.
For critical operations (like financial transactions), I use Pessimistic Concurrency with
SQL locks (UPDLOCK) to ensure only one user can update the record at a time.”
3)