.NET / ASP.NET Core interview questions
LiveDependency injection, the middleware pipeline, EF Core, auth and the questions every .NET backend loop asks.
Subtopics
- DI & service lifetimes10
- Middleware pipeline10
- Configuration & Options10
- EF Core change tracking10
- EF Core loading & N+110
- Migrations8
- Minimal APIs vs controllers10
- JWT auth10
- Model validation8
- Logging8
- Caching10
- Background services8
- Unit testing8
Sample questions
- CodingJuniorBackground services
A worker wakes up and has to decide which of its jobs are due. Each entry in
jobsis"<name> <lastRun> <interval>".Implement
DueJobs(List<string> jobs, int now)returning the names of - CodingJuniorBackground services
A
PeriodicTimerloop cannot overlap itself: ticks are at multiples of the period, and if a handler runs long the ticks that passed while it was working are simply skipped. - TheoryJuniorBackground services
What is a
BackgroundServicein ASP.NET Core? Describe its lifecycle and what you put inExecuteAsync. - TheoryJuniorBackground services
You inject a
DbContextinto the constructor of aBackgroundServiceand it either throws at startup or behaves strangely after a while. Explain why, and show me the right way. - CodingJuniorCaching
A cache key has to include everything the cached value depends on, and it has to be stable - two requests with the same inputs in a different order must produce the same key.
- CodingJuniorCaching
Trace a cache with absolute expiration against a fake clock. Each entry in
requestsis"<key> <time>", in non-decreasing time order.Implement
SimulateCache(List<string> requests, int ttl)returning