At companies like Microsoft or Shopify, interviewers use this question to test whether you understand execution models, abstraction boundaries, and performance trade-offs in collection processing.
Explain the difference between IEnumerable and IQueryable in C#. Your answer should cover:
Also discuss deferred execution, expression trees vs delegates, and the practical impact on performance and maintainability.
The interviewer expects more than a definition. You should compare behavior under the hood, describe common use cases, mention typical pitfalls such as premature materialization, and explain why the wrong choice can lead to unnecessary memory usage or slower execution.