C# interview questions for web devs
Just a list of subjects, topics, and questions that I believe developers at junior, middle, and senior levels should know. You can use it as a roadmap, to prepare for an interview, or to conduct one 🙃.
Enjoy 😉
Code conventions
junior
- knows programming language’s conventions
middle
- can introduce changes to the codebase without breaking existing conventions
senior
- can set up linting to automate code conventions (Roslyn Analysers, StyleCop, FxCop, SonarLint)
Refactoring
junior
- what is Refactoring?
- what is Clean Code?
- can simplify
if/else
statement
middle
- refactoring techniques (extract method, rename method, etc)
- code smells (long methods, long class, primitive obsession, etc)
senior
- knows code metrics (depth of inheritance, coupling, cyclomatic complexity)
Debugging
junior
- debugging in Visual Studio
- settings breakpoints
- conditional breakpoints
- changing runtime values
middle
Stopwatch
senior
- remote debugging
- knows how to debug multi-thread app
Git
junior
- GitHub
- basic operations (
init
,clone
,fetch
,pull
,commit
,push
) - branching
.gitignore
middle
- stash
- rebase vs merge
- branching models (GitFlow, GitHub Flow, etc)
- git blame
senior
.gitattributes
- checkout on a commit
- cherry-pick
- squash
Source Code Review
junior
- knows what a Pull Request is
middle
- knows how to conduct code review and provide useful and understandable feedback
senior
- can set up, drive, and control code review practices within a team
- has a check-list for PR review
- writes architecture tests to sustain conventions
- automatization of code review
Data Structures
junior
- array
- matrix
- linked list
- LIFO vs FIFO
- stack
- queue
- binary tree
middle
- hash table. how does a hash table behave when there is a collision?
- hash function. what happens when mutable fields are used in the hash function? what is a collision in hash tables?
senior
- graph
Algorithms
junior
- O notation, space/time complexity
- swap values in an array
- min, max, average in an array
- recursion
- sorting (bubble sort, insertion sort, selection sort)
- searching (linear search, binary search, knows precondition for binary search)
middle
- quick sort
senior
- tree traversal (with queue, with stack, NLR, LRN, RLN)
- divide-and-conquer algorithms
Object Oriented Programming
junior
- Abstraction, Encapsulation, Inheritance, Polymorphism
- can explain OOD Principles in examples
- DRY
- KISS
- YAGNI - primitive obsession issue
middle
- Association, Aggregation, Composition
- knows OOD concepts
- low coupling
- high cohesion - SOLID
senior
- aspect-oriented programming. how to implement cross-cutting concerns?
Functional Programming
junior
middle
senior
.NET
junior
- what .NET is
- can create a custom library
middle
- .Net CLI
- difference between compile time and runtime
senior
global.json
dotnet-tool.json
- can create custom nuget
- CLR, CIL, CTS, CLS, GAC, DLL, EXE
Core C#
junior
- basic types, enums, value types vs reference types
struct
vsclass
string
,StringBuilder
, interpolation,string.Format()
- boxing, unboxing
- type casting (
is
,as
, type conversion operator) - method overload vs method optional parameters, named parameters
in
,ref
,out
,params
interface
vsabstract class
, inheritance- access modifiers (
public
,private
,protected
) virtual
vsnew
vsoverride
static class
and static class members- indexers and properties
- generics, generic constraints
- exceptions,
finally
- linq.
First()
vsFirstOrDefault()
vsSingle()
vsSingleOrDefault()
- garbage collection,
IDisposable
vs Finalizer,using
statement
middle
- what’s new in C#?
sealed class
,partial class
- access modifiers (
internal
) tuple
, namedtuple
, deconstructionconst
vsstatic readonly
- understand regex and its usage
Equals()
, inheritEqualityComparer<T>
,Comparer<T>.Default
GetHashCode()
,HashCode.Combine()
- rethrowing exception (
throw ex
vsthrow
),when
in a catch clause - deferred linq execution
- basic of working with files.
File
,FileInfo
, Streams (Stream
,FileStream
, etc)
senior
- dynamic
- can work efficiently with time and timezones (
DateTime
,TimeSpan
,DateTimeOffset
,DateOnly
,TimeOnly
,TimeZoneInfo
) - string interning, string culture,
StringComparer
- invariance, covariance, contravariance
record
,readonly struct
- access modifiers (
protected internal
,private protected,
file
), nested classes access - streams in details (backing storage, decorators, adapters, working efficiently with
MemoryStream
) - garbage collection in details (stack, heap, large object heap)
- linq.
DefaultIfEmpty()
,Zip()
,Aggregate()
Collections
junior
- array
- generic collections (
List<T>
,LinkedList<T>
,Dictionary<K, V>
,HashSet<T>
,Stack<T>
,Queue<T>
,PriorityQueue<T, P>
)
middle
- interfaces (
ICollection<T>
,IList<T>
,IDictionary<K, V>
) - readonly interfaces (
IEnumerable<T>
,IReadOnlyList<T>
,IReadOnlyDictionary<K, V>
) ObservableCollection<T>
- iterators,
IEnumerator
(MoveNext()
,Current
,Reset()
)
senior
ILookup<K, V>
Enumerable.SequenceEqual()
- base classes for custom collections (
Collection<T>
,KeyedCollection<K, V>
) - readonly collections (
ReadOnlyCollection<T>
,ReadOnlyDictionary<K,V>
),Array.AsReadOnly()
- concurrent collections (
BlockingCollection<T>
,ConcurrentBag<T>
,ConcurrentDictionary<K, V>
,ConcurrentQueue<T>
,ConcurrentStack<T>
) - immutable collections
- frozen collections
- create empty collection (
Array.Empty<int>()
,Enumerable.Empty<int>(), ImmutableArray<T>.Empty
,ImmutableDictionary<TKey,TValue>.Empty
,FrozenDictionary<TKey,TValue>.Empty
, etc) yield return
in detailsIAsyncEnumerable
Delegates
junior
- delegates, lambda expressions
- understand events
Action
,Func
,Predicate
middle
- create custom delegate
- local functions
senior
- lambda closures
- combine delegates
- create event,
EventHandler
,EventArgs
- event forwarding (
add
,remove
keyword)
Reflection
junior
- basic understanding of reflection
- attributes
.GetType()
vstypeof()
middle
- create a custom attribute,
AttributeUsage
senior
- capable of applying reflection
- expression trees
Activator.CreateInstance<T>()
,Activator.CreateInstance(Type t)
- invoking instance’s methods, invoking static methods
Multithreading
junior
- being able to use
Task
middle
- difference between parallel and asynchronous execution
- knows a variety of timers and the differences between them
- understand synchronization issues (deadlock and race condition)
- using
lock
Task.WhenAll()
CancellationToken
. Knows how to cancelTask
. Cancel HTTP request in ASP. Write own methods that support cancellation.async void
issues
senior
- synchronization primitives (
Mutex
,Monitor
,Semaphore
,SemaphoreSlim
) - difference between
Thread
andTask
- exception handling, exceptions in
Task.WhenAll()
.ConfigureAwait(false)
, synchronization context- distributed lock
- optimistic locking, pessimistic locking
- optimize IO/CPU bound operations
Libraries
junior
- what is nuget?
- Moq
- Swagger
Newtonsoft.Json
orSystem.Text.Json
- AutoMapper
middle
- FluentValidation
- Autofac, Scrutor (DI registration with assembly scanning)
- FluentAssertion
- Bogus
- Semantic Versioning
- Papercut-SMTP
- Temp Mail
senior
- Polly for fault handling (Retry, Circuit Break)
- BenchmarkDotNet
- SignalR
- Refit
- Ocelot
- Quartz vs Hangfire vs
BackgroundService
- NBomber
- ngrok
- T4 Templates
Networking
junior
- JSON and XML
- HTTP methods (
GET
,POST
,PUT
,DELETE
, etc).GET
vsPOST
- HTTP response groups (
1XX
,2XX
,3XX
,4XX
,5XX
) - HTTP headers
- REST
- knows the basic difference between HTTP and HTTPS
middle
- capable of issuing HTTP requests using Postman
senior
- can explain the basics of the HTTP request flow
- webhooks
- knows Postman in advance (creating the environment, using variables, etc)
- API Versioning
ASP .NET API
junior
- MVC pattern
- routing
- model validation with attributes
- dependency injection
- middleware
- swagger
- environment configurations (
appsettings.json
) - configuration binding,
IOptions
middle
- filters. filters vs middlewares
- FluentValidation
- environment configurations (
appsettings.dev.json
, user secrets, environment variables, command line arguments) IHostedService
/BackgroundService
. what lifecycle doesBackgroundService
have? how do you inject a service in theBackgroundService
?
senior
- run web service in the integration test
- configuration binding,
IOptionsSnapshot
,IOptionsMonitor
- can service with any lifecycle be injected any other? building dependency graph? when error visible (runtime vs on start)?
- advanced injection technique
-IServiceScopeFactory
- inject services regardless of lifecycle
- assembly scanning
- register service with multiple interfaces
- inject multiple services
-TryRegister
- resolve service with multiple implementations - minimal API
ASP.NET MVC
junior
- MPA
- understand ASP.Net MVC conventions
- creating a view, passing data between views and controllers
- razor syntax
middle
- partial views
FluentValidation
- environment configurations (
appsettings.dev.json
, user secrets, environment variables, command line arguments) IHostedService
/BackgroundService
- run web service in the integration test
senior
- configuration binding,
IOptionsSnapshot
,IOptionsMonitor
IServiceScopeFactory
Web Security
junior
- authorization vs authentication
- knows how to store passwords in DB (encryption, hashing, salt)
- knows what hash function is
- hashing vs encryption vs encoding vs serializing
middle
- knows basic auth schemes (Basic, Cookie, JWT, API key)
- role-based, policy, claims authorization
- JWT
- what claims are?
- registered claims vs custom claims
- issuer claim? audience claim?
senior
- two-factor authentication
- symmetric encryption vs asymmetric encryption
- what is an access token? refresh token? ID token? how those are used?
- OAuth 2.0
- client types
- authorization server endpoints
- authorization flows (code flow, implicit flow, client credentials). in which cases which should be used? - OpenID
- SSO
- Identity Server
- Active Directory
- self-contained vs reference token
- knows and can prevent vulnerabilities
- cross-site scripting attack (XSS)
- cross-site request forgery attacks
- SQL injection attacks
- cross-origin resource sharing (CORS) policies
- open redirect URL attacks
SQL Databases
junior
- data types
- relational model design (one-to-one, one-to-many, many-to-many)
CREATE
,ALTER
,DROP
INSERT
,UPDATE
,DELETE
SELECT
,WHERE
,LIKE
,ORDER BY
,GROUP BY
,HAVING
,DISTINCT
JOINS
AVG
,SUM
,COUNT
,MAX
,MIN
middle
- ACID
- CAP
- normalization (1NF, 2NF, 3NF)
- clustered and non-clustered indexes. should we create an index for a bool column? what about
IsDeleted
? Index sequential number vs GUID? - unique and foreign keys
- check constraints
- transactions
- views, materialized views
- cursors
- soft delete vs hard delete
senior
- i̶s̶o̶l̶a̶t̶i̶o̶n̶ l̶e̶v̶e̶l̶s̶ (probably the worst question that could be asked)
- SQL optimization, execution plan
- Common Table Expressions (CTE)
- stored procedures
- triggers
- indexes in details
- composite index
- covering index
- filtered index
- why would you use a covering index instead of a composite index? - denormalization. when should be done?
char
vsnchar
char
vsvarchar
- DB partition vs sharding
NoSQL Databases
junior
- NoSQL concepts
middle
- SQL vs NoSQL. Advantages/disadvantages of NoSQL Databases over Relational Databases
senior
- BASE
- can review and use NoSQL databases based on a project needs
- has experience with
MongoDb
/Elasticsearch
/Redis
etc
Entity Framework
junior
- what is
DbContext
- configuring the db model. data annotations vs FluentAPI
- EF approaches (Code First, Database First, Model First)
- implement CRUD
- one-to-one, one-to-many, many-to-many relations conventions
- configure relations with FluentAPI
- load data: lazy vs explicit vs eager
IEnumerable
vsIQueryable
- create and apply a migration
middle
- change tracker,
AsNoTracking()
- update/delete data in disconnected scenarios
- owned entities
- shadow property
- backing fields
- value conversions
- global filters. how to implement soft delete in EF?
senior
- inheritance strategies (TPH, TPT, TPC)
- raw SQL queries
- working with stored procedures
- working with views
- transactions, transaction in
SaveChanges()
,TransactionScope
- interceptors
- unit test code with
DbContext
- view generated SQL (
.ToString()
, log, profiler) - linqpad
Monitoring
junior
- benefits of logging
- can use
ILogger<T>
middle
- different log levels (
Trace
,Debug
,Info
,Warning
,Error
,Fatal
) - health checks
senior
- tools how to track events in cloud (
Grafana
,Prometheus
, etc). when to use? - diagnostic/health check
- trace identifier/correlation id
- structure log
- audit log
- monitoring on-premises systems (
Grafana
, ELK stack,Seq
, etc)
Performance
junior
- can find performance issues in the app?
middle
- can optimize algorithms
- can optimize memory usage
senior
- can detect and optimize IO/CPU bound operation
- benchmarking. understand statistics (mean, error, etc)
- SQL optimization, execution plan
- latency vs throughput. how those can measured?
Cache
junior
- understand what cache is
- can explain when we need caching and when we don’t
middle
IMemoryCache
vsIDistibutedCache
vsHybridCache
AbsoluteExpiration
vsSlidingExpiration
- Redis
- memoization
senior
- сaching strategies
- Cache-Aside (Lazy loading)
- Read-Through Cache
- Write-Through Cache
- Write-Around
- Write-Back - cache invalidation methods
- time-based invalidation (TTL)
- event-based invalidation
- version-based invalidation
- least recently used (LRU) invalidation
- manual invalidation - cache metrics
- cache hit ratio
- latency
- throughput
- cache size
- cache miss rate
Tests
junior
- unit tests
- unit test characteristics (quick, consistent, isolated, atomic, etc)
- Mock objects
- Arrange-Act-Assert (AAA) pattern
Assert
statement- TDD. knows when to apply
- unit test naming conventions
middle
- integration tests
- run web service in the integration test
- BDD
- Given-When-Then (GWT) pattern
- FluentAssertion
- Bogus
Assert
vsExpect
statement- Stub objects
senior
- testing pyramid
- e2e tests.
playwright
vsselenium
- PageObject pattern
- unit test code with
DbContext
- performance testing.
NBomber
- snapshot tests
- mutation testing.
Stryker.NET
- builder pattern in unit tests
- architecture tests
Design patterns
junior
- OOD Principles with examples
- DRY
- KISS
- YAGNI - basic patterns
- singelton
- strategy
- prototype
- etc - specialized patterns
- lazy loading
middle
- antipatterns
- service locator
- singelton
- etc - SOLID
- specialized patterns
- unit of work and repository
- marker interface
senior
- design patterns inside the .NET?
- knows how to use and apply patterns in your work?
- advanced patterns
- visitor
- builder for unit tests
- state
- bridge
- etc - specialized patterns
- specification pattern
- MVC vs MVP vs MVVM
- null object (special case pattern)
Architecture
junior
- breaking a problem into multiple functions
middle
senior
- dependency inversion
- onion architecture
- MVC vs MVP vs MVVM
- vertical slice architecture
- screaming architecture
- multitenant architecture
- event sourcing. snapshotting events.
- how an entity can be deleted?
- can we delete the event?
- what if the event’s structure changed? - CQRS
- state machine
- Domain Driven Design
- architecture tests to measure non-functional requirements
- architecture tests to measure functional requirements
- architecture tests to sustain conventions
Domain Driven Design
junior
- entity
- dto
- factory pattern
middle
senior
- ubiquitous language
- business invariant
- aggregate root
- value object
- domain events. integration events
- rich vs anemic model
- validation. always-valid model vs not-always-valid-model
- specification pattern
- bounded context
- anti-corruption layer
- shared kernel
Microservices
junior
- 🤷♂️
middle
- what are microservices? what is the use-case for using them?
- microservice vs monolith
- can one microservice access another microservice’s database?
senior
- strong consistency vs eventual consistency
- synchronous communication (HTTP vs GraphQL vs gRPC)
- asynchronous communication (AMQP)
- what is a proxy server? API gateway? BFF? load balancers?
Ocelot
- load balancing strategies. sticky session
- message brokers, pull vs push models. publish/subscriber
- message queues. dead-letter queues
- transactions management. SAGA (orchestration vs choreography), state machine, compensation events
- vertical vs horizontal scaling. which to choose? what are the limits?
- distributed locks
- distributed cache
- idempotency in microservices
- queue-based load leveling
- inbox pattern
- outbox pattern
- messaging guarantees
- at most once (uniqueness)
- at least once (delivery)
- exactly once (delivery, uniqueness) - circuit breaker
- retry HTTP calls.
how to avoid a self-inflicted DDoS Attack? exponential backoff.
which HTTP status codes should be retried and which shouldn’t? - ETL
Cloud computing
junior
- 🤷♂️
middle
- on-premise vs cloud deployment
- benefits and drawbacks of going cloud
- cloud models (PaaS vs IaaS vs SaaS)
senior
- serverless concept
- vertical/horizontal scaling
- cold start problem in lambdas
- blob storage
types of resources (an account, a container, a blob)
access tiers (hot, cool, cold, archive) - vendor lock-in
DevOps
junior
- 🤷♂️
middle
senior
- shell scripts, .ps1 scripts
- CD strategies
- Recreate
- Blue/Green
- A/B
- Canary
- Feature Flag - can configure CI/CD pipeline
- can provision resources with Infrastructure as Code
- understand database migrations based on CD strategy
Containers
junior
- 🤷♂️
middle
- VM vs container
- docker
- dockerfile
- image
- container
- docker CLI
- image pull and push
- run an image in the container
- execute a command in the container
senior
- docker compose
- Docker Hub
- multi-stage build
- volumes
Software development methodologies
junior
- basics of work organization using ticket management software (i.e., Jira or Trello)
middle
- SCRUM basics: roles, meetings, processes, artifacts
- Kanban basics: Kanban board, tickets processing
- pair programming
- task hierarchy
- epic
- user story
- task
senior
- set-up Scrum or Kanban on the project
- work breakdown structure (WBS)
Estimation
junior
- knows fibonacci numbers
- knows T-shirt sizes
middle
- pocker estimation
senior
- critical path method
- three-point estimation
- knows when an investigation is required
- include in the estimate
- task estimate
- risk estimate
- tests
- investigation/documentation
Project documentation
junior
- functional specification
- can gather requirements from stakeholders
middle
- understand technical specifications (how to setup/configure project, development process, branch names)
- understand functional specification (sequence diagrams, use-case diagrams, etc)
- release-notes
- when task considered to be completed? acceptance criteria
- UML. different types of diagrams
senior
- non-functional specification
- deployment specification
- can write project documentation
- C4 model. Difference between Container and Components
- GDPR compliance
For the End
I hope I didn’t upset anyone because the list does not match their expectation 😅. It’s simply my personal perspective, and it’s perfectly fine if you have a different view.
Do not worry if you don’t know something, and do not get arrogant if you master a section before somebody else. Remember that everybody learns stuff at a different pace. The labels of junior, mid-level, and senior do not mean anything. As practice shows, what a junior developer has not learned yet, a senior developer has already forgotten 😁.
💬 Let me know in the comment sections what other topics deserve to be on the list
⬇️ Check out my other articles
👏 Don’t forget to clap
☕️ You can buy me a coffee with a link below
✅ Subscribe
🙃 And stay awesome