I'm preparing a LINQ section in interview questions for senior programmers. What are the most interesting questions in LINQ to include? And why?


8 Answers 8


Some of the things you can ask would be like.

  • Why the var keyword is used and when it is the only way to get query result ?
  • What is Deferred Execution ?
  • Explain Query Expression syntax, Fluent Syntax, Mixed Queries.
  • What are Interpreted Queries ?
  • Use of IQueryable and IEnumerable interfaces.
  • Use of let and into keyword, and how they help in making Progressive queries but still keep Deferred execution
  • What are Expression Trees ?


For Detailed answers see this nice post by Oleksii

  • 8
    Great questions. I might be tempted to give code examples and say "what does this do?" as I'm not totally convinced that you need to know what the term Fluent Syntax is to use and understand it.
    – user23157
    Apr 20, 2011 at 12:07
  • hmmm, And if they Google those topics before hand and memorise it, how does this approach tell you that they can actually do any real world LINQ?
    – Darknight
    Apr 20, 2011 at 21:57
  • then as BTyler said above... you can complement above questions with code samples. Apr 20, 2011 at 22:03
  • 1
    This guy blogged about the solutions to all of these questions: blog4work.com/?tag=/LINQ Jul 17, 2011 at 16:36
  • Just saw the post, nice work :) Jul 17, 2011 at 23:49

Ask them to give examples of times when they would tend to not use LINQ and why, even though it would be possible (and ReSharper excitedly suggests it).


You could start but asking what language features that were introduced in C# 3 are needed to support LINQ. Does the candidate understand how features like the var keyword as well as anonymous types, lambda expressions and extension methods were needed to enable LINQ?

  • For my own curiousity why are anonymous types necessary? They can be used for select results as a convenience but you could equally well define your own classes with named properties can't you?
    – Rup
    Apr 20, 2011 at 11:09
  • @Rup | Its just a matter of convenience and a syntactic sugar .. you can of-course create Well Defined Classes (anyway compiler does that for you behind the scene). but while Using LINQ queries you instantly need a type to contain the results... now this doesn't seem productive to keep creating classes for each type and this may lead to more code to and difficult to maintain if result set changes later. Apr 20, 2011 at 13:07
  • That's not correct. Anonymous types are required for linq-to-Sql projections, for example to select only certain columns from a table/entity.
    – joniba
    Dec 9, 2013 at 21:51

How about some coding questions, like:

  • Give then non-LINQ code that would be better done in LINQ and get them to translate it.
  • Give them some LINQ and get them to unravel and re-write in plain C# (better yet, find an example where the non-LINQ version is better or more easily understood)
  • Ask them to solve some problem and show with/without LINQ and get them to explain which is better, and why.

Text book questions are fine (e.g. why use var), but to really find out if they understand just get them to write code.


If you're looking for a question to which you'd get "interesting" answers, you could ask them why they think most linq examples assign using the "var" keyword on the LHS... there's no right answer and you could probably get some understanding of the type of person they are from what they say.


Ask them about expression trees. How the linq transforms into sql on the database server the difference between linq extension methods and linq query's

Depends what you are trying to get out of them.

  • what are situations where you would use First and when to use FirstOrDefault?

  • what problem does LINQ solve?

  • what happens when you wrap the query in .ToList?

  • allows deferred execution.
    – linquize
    Jun 19, 2012 at 9:06
  • reduce the chance of using for / foreach loop to improve readability
    – linquize
    Jun 19, 2012 at 9:07

Ask them to build a small rules engine, using Func[]rules{}. Each rule has to be true, the array replacing case or if statements.

I just started on linq and lambdas but figure this is a nice test of problem solving and linq literacy.

In addition to the more qualified suggestions on here.

Not the answer you're looking for? Browse other questions tagged or ask your own question.