Skip to content

See it. Remember it. Explain it.

Visual Interview
Memory Lab

Learn C# and .NET with a visual memory cue, a simple flow, a one-line answer and an interview-ready explanation on every question card.

Visual memoryDiagram or flowOne-line answerInterview explanation

C# and .NET visual questions

30 free of 187 questions / lessons

1. What is a class and an object?

📐 Blueprint vs 🚗 real car
Class → creates → Object
One-line: A class is a blueprint; an object is its runtime instance.
Interview answer: A class defines data and behavior, while an object is an allocated instance of that class.

2. What is encapsulation?

🚗 Engine hidden under bonnet
Private State → Public Methods
One-line: Encapsulation protects state and exposes controlled behavior.
Interview answer: I keep fields private and expose operations through methods or properties so callers cannot create an invalid state.

3. What is abstraction?

🎛️ Steering wheel hides mechanics
Caller → Contract → Hidden Implementation
One-line: Abstraction shows what an object does and hides how it works.
Interview answer: Interfaces and abstract types expose essential behavior while hiding implementation complexity.

4. What is inheritance?

🌳 Child inherits family features
Base Class → Derived Class
One-line: Inheritance lets a derived class reuse and specialize a base class.
Interview answer: It models an is-a relationship, although I prefer composition when behaviors must vary independently.

5. What is polymorphism?

🔌 Same socket, different devices
Interface → Implementation A / B / C
One-line: One contract can execute different implementations.
Interview answer: Runtime polymorphism is commonly achieved through interfaces or virtual method overriding.

6. Interface vs abstract class?

📜 Contract vs 🏠 parent house
Interface = capability | Abstract = shared base
One-line: An interface defines a contract; an abstract class can share state and implementation.
Interview answer: I use interfaces for loose coupling and capabilities, and abstract classes for closely related types with common behavior.

7. Overloading vs overriding?

🚪 Multiple entrances vs rebuilt room
Same name + different parameters | Base → Derived
One-line: Overloading changes parameters; overriding replaces inherited virtual behavior.
Interview answer: Overloading is compile-time polymorphism, while overriding is runtime polymorphism.

8. Value type vs reference type?

📦 Value vs 🏷️ address card
Value copied | Reference copied
One-line: Value types contain data directly; reference types point to objects.
Interview answer: Assignment copies a value for value types, while reference-type assignment normally copies the reference.

9. Single Responsibility Principle?

👷 One employee, one job
Type → One focused reason to change
One-line: A class should have one focused responsibility.
Interview answer: I separate responsibilities that change for different business reasons.

10. Open Closed Principle?

🔌 Add plug-in, do not rewire
Stable Core + Extension
One-line: Software should be open for extension and closed for unnecessary modification.
Interview answer: I extend behavior through strategies, interfaces, or composition rather than repeatedly changing stable code.

11. Liskov Substitution Principle?

🔁 Replace without surprise
Base Contract ⇄ Valid Subtype
One-line: A subtype must preserve the expectations of its base contract.
Interview answer: Replacing the base type with a subtype should not break behavior or invariants.

12. Interface Segregation Principle?

🍽️ Small menu
Large Interface → Focused Interfaces
One-line: Clients should depend only on methods they actually use.
Interview answer: I split large interfaces into role-specific contracts to avoid forcing unrelated members on consumers.

13. Dependency Inversion Principle?

🎮 Remote depends on protocol
Business Logic → Interface ← Infrastructure
One-line: High-level logic should depend on abstractions, not concrete details.
Interview answer: Business logic and infrastructure communicate through contracts, improving testability and substitution.

14. Factory, Strategy, and Decorator?

🏭 Create, 🗺️ choose, 🎁 wrap
Factory = creation | Strategy = algorithm | Decorator = behavior layer
One-line: Factory creates, Strategy selects behavior, and Decorator adds behavior.
Interview answer: I choose the pattern based on the source of variation rather than applying patterns automatically.

15. Array vs List?

🧊 Fixed tray vs expandable shelf
Fixed length | Dynamic length
One-line: An array has fixed length; List<T> resizes dynamically.
Interview answer: I use arrays for fixed-size data and List<T> for general dynamic collections.

16. Dictionary vs List?

📖 Index vs shelf scan
Key → Value | Ordered items
One-line: Dictionary supports key lookup; List stores ordered items.
Interview answer: For repeated key lookup I prefer Dictionary; for ordered iteration I use List.

17. Queue vs Stack?

🎫 Ticket line vs 🍽️ plates
FIFO | LIFO
One-line: Queue is first-in-first-out; Stack is last-in-first-out.
Interview answer: Queue fits work scheduling, while Stack fits undo and depth-first processing.

18. IEnumerable vs IQueryable?

🏠 Local chef vs restaurant order
.NET iteration | Provider expression → SQL
One-line: IEnumerable iterates in .NET; IQueryable builds provider-translatable queries.
Interview answer: With EF Core, I keep filtering as IQueryable until query composition is complete, then materialize once.

19. Deferred execution?

📝 Recipe runs when cooked
Define Query → Enumerate → Execute
One-line: Many LINQ queries execute when enumerated, not when declared.
Interview answer: I materialize with ToList when I need a stable snapshot or must avoid repeated execution.

20. Delegate vs event?

📞 Phone number vs 🔔 controlled doorbell
Delegate = method reference | Event = publisher notification
One-line: A delegate references methods; an event restricts invocation to the publisher.
Interview answer: Events provide controlled publisher-subscriber communication built on delegates.

21. What does async/await do?

🍳 Waiter serves others while food cooks
Start I/O → Await → Continue
One-line: async/await expresses nonblocking asynchronous continuations over Tasks.
Interview answer: For I/O-bound work, await avoids blocking a request thread while the operation is pending.

22. Task vs Thread?

📋 Job ticket vs 👷 worker
Task = work | Thread = execution resource
One-line: A Task represents work; a Thread is an execution resource.
Interview answer: A Task may use a thread, but asynchronous I/O does not require a dedicated waiting thread.

23. Task.WhenAll?

🍽️ Serve when all dishes are ready
Task A + B + C → WhenAll
One-line: Task.WhenAll waits for multiple tasks to finish concurrently.
Interview answer: I use it for independent operations, while considering throttling and partial failures.

24. CancellationToken?

🛑 Shared stop signal
Caller → Token → All layers
One-line: CancellationToken supports cooperative cancellation.
Interview answer: I pass it through cancellable layers and stop safely rather than terminating work abruptly.

25. What is a deadlock?

🚗 Circular traffic gridlock
A waits for B ↔ B waits for A
One-line: A deadlock is a circular wait in which no participant can continue.
Interview answer: I avoid sync-over-async and maintain consistent lock ordering.

26. Garbage collection generations?

🌱 Young → mature → old
Gen 0 → Gen 1 → Gen 2
One-line: GC groups objects by survival age to optimize collection.
Interview answer: Short-lived objects normally die in Gen 0; surviving objects are promoted.

27. What causes a managed memory leak?

🪝 Forgotten event hook
GC Root → Unwanted retained object
One-line: A leak occurs when unwanted objects remain reachable.
Interview answer: I inspect event subscriptions, static collections, caches, timers, and retained object graphs.

28. Explain the request pipeline.

🚇 Request travels through stations
Request → Middleware → Endpoint → Response
One-line: Ordered middleware processes an HTTP request and response.
Interview answer: Each middleware can run before and after the next component or short-circuit the pipeline.

29. What is middleware?

🛂 Airport checkpoint
HTTP → Cross-cutting behavior → Endpoint
One-line: Middleware handles cross-cutting HTTP behavior.
Interview answer: Common uses include exception handling, logging, correlation, authentication, and security headers.

30. What is dependency injection?

🚚 Delivery system
Container → Controller → Service → Repository
One-line: The DI container supplies registered dependencies to consumers.
Interview answer: DI reduces coupling, centralizes object composition, and improves testability.
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Pro only
Compare Pro accessOpen the original C# and .NET guide