Core OOP concepts, C# OOP language features and the design judgement senior .NET engineers are expected to show.
-
What is the difference between a class and an object in C#? Explain how an object is created with new, where it lives, what instance and static members belong to, and how object identity differs from object equality.
Classes as blueprints and objects as runtime instances: creation, memory, instance versus static members, identity and lifetime.
Junior
Theory
Core OOP
Β· π 3 follow-ups
-
How do constructors work in C#? Explain default and parameterised constructors, chaining with this() and base(), the order of initialisation in a class hierarchy, static constructors, primary constructors (C# 12) and required members, and why calling virtual methods from a constructor is dangerous.
Everything about object construction in C#: kinds of constructors, chaining, initialisation order, static and primary constructors, required members and pitfalls.
Mid-Level
Theory
Core OOP
Β· π 2 follow-ups Β· π 1 real-world
-
Does C# have destructors? Explain finalisers, how the garbage collector runs them, why they are non-deterministic and costly, and how they relate to IDisposable, the dispose pattern and SafeHandle.
Finalisers in .NET: syntax, the finalisation queue, costs and risks, and why IDisposable and SafeHandle are the real tools for clean-up.
Senior
Theory
Core OOP
Β· π 3 follow-ups Β· π 1 real-world
-
What is encapsulation, and how do you apply it well in C#? Show the difference between a class that exposes its data and one that protects its invariants.
Encapsulation as protecting invariants: hiding state, exposing behaviour, and the C# tools that support it.
Junior
Theory
Core OOP
Β· π 2 follow-ups
-
What is abstraction in object-oriented programming, and how is it different from encapsulation? How do you design a good abstraction in C#, and what does a leaky or premature abstraction look like?
Abstraction as hiding complexity behind a simpler model, how it differs from encapsulation, and how to avoid leaky and premature abstractions.
Mid-Level
Theory
Core OOP
Β· π 3 follow-ups Β· π 1 real-world
-
How does inheritance work in C#? Explain single inheritance of classes, what a derived class inherits, base calls, member hiding with new versus overriding, protected members, and the problems that deep or misused inheritance causes.
Class inheritance in C#: mechanics, base calls, hiding versus overriding, protected access, the Liskov principle and common pitfalls.
Mid-Level
Theory
Core OOP
Β· π 2 follow-ups Β· π 1 real-world
-
What is polymorphism in C#? Explain compile-time (overloading, generics) and run-time (virtual dispatch, interfaces) polymorphism, how virtual dispatch works under the hood, and how pattern matching relates to it.
Polymorphism in C#: the kinds, how virtual and interface dispatch work, and when to use polymorphism versus pattern matching.
Mid-Level
Theory
Core OOP
Β· π 2 follow-ups Β· π 1 real-world
-
What is composition in object-oriented design? Show how a C# class can be built from smaller objects that it owns and delegates to, and explain the benefits for change, testing and reuse.
Composition as building objects from owned parts and delegating to them, with strategies and decorators as common forms.
Mid-Level
Theory
Core OOP
Β· π 2 follow-ups Β· π 1 real-world
-
What is association between classes in object-oriented design? Explain multiplicity, direction (unidirectional versus bidirectional), how associations appear in C# code and EF Core, and the problems bidirectional associations cause.
Association as the general structural link between objects: multiplicity, navigability, C# and EF Core representation, and pitfalls.
Mid-Level
Theory
Core OOP
Β· π 2 follow-ups Β· π 1 real-world
-
What is aggregation, and how does it differ from composition? Use examples to explain shared versus owned parts, lifetimes, deletion and cascade rules, and how the difference shows up in C# code and EF Core mappings.
Aggregation versus composition: whole/part relationships with shared or owned parts, and the consequences for lifetimes, deletes and persistence.
Mid-Level
Theory
Core OOP
Β· π 2 follow-ups Β· π 1 real-world
-
What is a dependency relationship between classes, and how is it different from association? Explain how dependencies appear in C# code, why direction matters (Dependency Inversion Principle), and how dependency injection manages them.
The 'uses' relationship: temporary dependencies versus stored associations, dependency direction and inversion, and DI in .NET.
Mid-Level
Theory
Core OOP
Β· π 2 follow-ups Β· π 1 real-world
-
How do interfaces work in modern C#? Explain what an interface can contain today (default interface methods, static abstract members), explicit implementation, how interface calls are dispatched, and the boxing trap with structs.
Interfaces as contracts in C# 14: members allowed, default implementations, static abstract members for generic math, explicit implementation, dispatch cost and struct boxing.
Mid-Level
Theory
C# OOP Features
Β· π 3 follow-ups Β· π 1 real-world
-
What is an abstract class in C#, and when would you use one? Explain abstract members, constructors and state in an abstract class, the template method pattern, and how abstract classes evolve compared with interfaces.
Abstract classes in C#: abstract versus virtual members, constructors and shared state, the template method pattern, BCL examples and versioning trade-offs.
Mid-Level
Theory
C# OOP Features
Β· π 3 follow-ups Β· π 1 real-world
-
What are virtual methods in C#? Explain why members are non-virtual by default, how a virtual call is dispatched at run time, what it costs, when the JIT can devirtualise it, and what can and cannot be virtual.
Virtual members in C#: opt-in virtuality, method tables and slots, callvirt, performance cost, devirtualisation with sealed and PGO, and the rules on what can be virtual.
Mid-Level
Theory
C# OOP Features
Β· π 3 follow-ups Β· π 1 real-world
-
How does method overriding work in C#? Explain override versus new (hiding), sealed override, calling base, covariant return types, the rules an override must follow, and the bugs that hiding and default parameter values cause.
Overriding in C#: override versus new, CS0108/CS0114 warnings, sealed override, base calls, C# 9 covariant returns, signature rules, and the default-parameter trap.
Mid-Level
Theory
C# OOP Features
Β· π 2 follow-ups Β· π 1 real-world
-
What does sealed mean in C#, and should application classes be sealed by default? Explain sealed classes and sealed overrides, the performance benefits, the effect on testing and mocking, and the versioning rules.
Sealed classes and members in C#: what they prevent, why sealing helps the JIT and type checks, CA1852, testing trade-offs, and why unsealing is safe but sealing is breaking.
Mid-Level
Theory
C# OOP Features
Β· π 2 follow-ups Β· π 1 real-world
-
What is a static class in C#? Explain what it can contain, how it differs from a singleton, where extension methods and C# 14 extension members live, static state and thread-safety, and why heavy use of static classes hurts testability.
Static classes in C#: rules, static constructors, extension methods and C# 14 extension blocks, static versus singleton, shared state risks and testability.
Junior
Theory
C# OOP Features
Β· π 2 follow-ups Β· π 1 real-world
-
What are partial classes and partial members in C#? Explain how the parts are combined, why source generators depend on them, partial methods (classic and extended), partial properties (C# 13) and partial constructors and events (C# 14).
Partial types and members in C#: compile-time merging rules, generated code, partial methods, partial properties and C# 14 partial constructors and events.
Mid-Level
Theory
C# OOP Features
Β· π 2 follow-ups Β· π 1 real-world
-
What are nested types in C#? Explain how a nested class differs from a Java inner class, what it can access in the outer type, default accessibility, and when nested types are a good or a bad design choice.
Nested classes in C#: access to outer private members, no implicit outer instance, private default accessibility, generics, BCL examples and design guidelines.
Mid-Level
Theory
C# OOP Features
Β· π 2 follow-ups Β· π 1 real-world
-
What are records in C#? Explain record classes and record structs, what the compiler generates (value equality, ToString, Deconstruct, with-expressions), how equality works with inheritance, and where records are a poor fit.
C# records: positional syntax, generated members, value equality and EqualityContract, non-destructive mutation with `with`, record structs, and pitfalls such as collections and EF Core entities.
Mid-Level
Theory
C# OOP Features
Β· π 3 follow-ups Β· π 1 real-world