Screening C# Candidates: Let’s Play 20 Questions!

Over the past year I was involved in the process of interviewing candidates for both mid and senior level developer positions.  We would bring them in for a face-to-face interview, sometimes with multiple interviewers, only to find out they were unable to answer the most basic technical questions concerning C# and .NET.  I’m of the persuasion that every .NET developer should understand basic concepts, such as C# language syntax, inheritance, generics, memory management, threading, etc. Without such an understanding, a developer can end up writing apps that are shot-through with problems that make the code difficult to debug and maintain.

Furthermore, I’m looking for a developer with a thirst for knowledge.  The technical landscape is constantly shifting, and developers need to come up to speed quickly if they are going to be able to leverage latest enhancements to the platform.  In addition, the breadth of the technical spectrum is mind-boggling, and a developer needs the capacity to absorb vast quantities of knowledge from various parts of the framework.  For example, someone might be called upon to build a WPF app retrieving data from a WCF service that queries a SQL database using Entity Framework with Ninject for dependency injection and MOQ for unit testing.  If a developer has a grasp of the fundamentals of C# and .NET, it tells me they are motivated to dig deeper to understand how things work under the covers, and take the time to acquire technical expertise both through reading and hands-on coding.

In a face-to-face interview, I can take time to ask probing questions and get a fairly good feel for a candidate’s technical prowess.  However, there needs to be a process to screen out candidates who lack even the most basic understanding of .NET fundamentals.  This is the purpose of the technical phone screen.  It should take no more than 15 minutes to conduct, and ideally it can be administered by a non-technical person, such as a project manager or technical recruiter.  For this purpose I have composed a list of 20 Questions, each of which has a one or two word answer.  Here is the list of questions without answers, which you can use to quiz yourself (see the end of the post for the answers).

C# Phone Screen Questions (without Answers)

1. What kind of type is a string?
2. What kind of type is a double?
3. What keyword defines a custom value type?
4. Can a class have more than one direct base class?
5. What keyword makes a member visible to inherited classes?
6. What keyword makes a class visible only within its assembly?
7. What keyword allows a method to be overridden?
8. What keyword requires a method to be overridden?
9. What keyword prevents a class from being used as a base class?
10. What keyword returns true if a cast will succeed?
11. What keyword returns null if a cast will not succeed?
12. What keyword ensures code execution even if an exception occurs?
13. What keyword calls IDisposable.Dispose?
14. What keyword constrains a generic type argument to derive from a particular class?
15. What two keywords used together return IEnumerable<T>?
16. What keyword would you use to define an inline variable in a LINQ query?
17. What keyword brings an extension method into scope?
18. What keyword do you add to a delegate to force subscribers to use += or –=?
19. What method do you call on a delegate to run it on a background thread?
20. What keyword provides thread synchronization?

The nice thing about this approach is that is should not take just a few minutes to administer, it can be given by anyone regardless of technical background, and the answers are fairly cut and dried.  Of course, the questions are not meant to be exhaustive and are only scratching the surface of CLR and C# fundamentals.  Just because someone can answer them does not mean they have a firm grasp of the .NET type system, garbage collection mechanics, JIT compilation issues, or multi-threading synchronization techniques.  Neither do the questions touch on any of the “pillars” of the .NET Framework API, such as data access (Entity Framework), web services (WCF), or presentation platforms (WPF, SL, ASP.NET MVC).  Nor do they attempt to ascertain logical or critical thinking ability. The only way to test for those things is to perform an in-depth technical interview performed by a senior technical specialist.  This is not to say that a mid-level developer will know all there is to know. What you are really looking for is not raw knowledge per se, but the capacity to absorb and integrate technical knowledge and the desire to know how things work.  If a person has ever bothered to read a book or technical article or taken a training course, their answers will set them apart from the crowd of folks who don’t make time for ongoing professional development.

If you’re reading this blog post and want to know where to begin, my first suggestion would be to run, not walk, to nearest bookseller or online bookstore and pick up Jeffrey Richter’s CLR via C#, which is presently in its third edition.  My short list for the books on various .NET API’s is Programming Entity Framework by Julie Lerman, Programming WCF Services by Juval Lowy, Essential WPF by Chris Anderson, Silverlight 4 in Action by Pete Brown, and Pro ASP.NET MVC by Steve Sanderson.

Best of luck on your career development!

C# Phone Screen Questions (with Answers):

1. What kind of type is a string?
    > reference
2. What kind of type is a double?
    > value
3. What keyword defines a custom value type?
    > struct
4. Can a class have more than one direct base class?
    > no
5. What keyword makes a member visible to inherited classes?
    > protected
6. What keyword makes a class visible only within its assembly?
    > internal
7. What keyword allows a method to be overridden?
    > virtual
8. What keyword requires a method to be overridden?
    > abstract
9. What keyword prevents a class from being used as a base class?
    > sealed
10. What keyword returns true if a cast will succeed?
    > is
11. What keyword returns null if a cast will not succeed?
    > as
12. What keyword ensures code execution even if an exception occurs?
    > finally
13. What keyword calls IDisposable.Dispose?
    > using
14. What keyword constrains a generic type argument to derive from a particular class?
    > where
15. What two keywords used together return IEnumerable<T>?
    > yield return
16. What keyword would you use to define an inline variable in a LINQ query?
    > let
17. What keyword brings an extension method into scope?
    > using
18. What keyword do you add to a delegate to force subscribers to use += or –=?
    > event
19. What method do you call on a delegate to run it on a background thread?
    > BeginInvoke
20. What keyword provides thread synchronization?
    > lock

About Tony Sneed

Married with three children.
This entry was posted in Technical and tagged . Bookmark the permalink.

23 Responses to Screening C# Candidates: Let’s Play 20 Questions!

  1. Pingback: Screening C# Candidates: Let’s Play 20 Questions! | Web | Syngu

  2. areshankar says:

    Question 17, Did you mean ‘this’ as the answer? Or is there more to ‘using’? Thanks!

    • Tony Sneed says:

      The “this” keyword is needed in front of the first parameter in order to a static method to function as an extension method. But the “using” directive is used to bring a set of extension methods into scope. The syntax is the same as a namespace import, but the effect is that extension methods can then be invoked as though they are instance methods.

      • areshankar says:

        ah..my bad…as I quickly skimmed the question!
        nice compilation and an enticing detour while checking out Simple MVVM :)

      • Bharath.TL says:

        My self is Bharath. in this week i cleared 3 rounds of interview with oracle .it was aptitude ,technical HR and also the HR.I cleared all the rounds but they told me to prepare for the telephonic round of interview on monday or tuesday.i had given interview on dotnet platform .So can any one of you help me what they can ask. and how i have to give answer .?

  3. Rory says:

    For my telephone Interviews I would usually ask
    1: Ten C# .Net basic questions.
    2: Five Design Pattern basic style questions
    3: Unit testing basics.
    No longer than 25 mins.
    I put more weight on the latter two, as anyone can remember key words etc.

    • Tony Sneed says:

      The 15 minute phone screen is designed to be administered by a non-technical person, such as a recruiter, and is just to screen out candidates whose resumes are something in between embellishment and fabrication. Once a person passes it, I would then conduct a 30 minute technical interview, usually over the phone, in which I would ask about specific areas, such as WCF and Silverlight, or design patterns and unit testing. During the technical phone interview I can usually probe deeper to see if a candidate has an understanding of the fundamentals, like the difference between reference and value types and explore areas such threading and memory management.

      I used to skip the 15 minute phone screen and just do the phone technical interview, but I found myself wasting a lot of time on people who lacked a basic understanding of .NET and C# fundamentals. The phone screen is not meant to take the place of a 30 minute technical interview, but instead it helps ensure that time spent doing the interview is not squandered on someone who is trying to fake their way into a job for which they are not qualified.

      The 15 minute phone screen should do a decent job of filtering out those types of people because the answers, while brief, should be somewhat difficult to guess, unless you’ve made some effort to learn the fundamentals. That usually requires taking a class or reading a book, and doing some coding to verify what you’ve learned. Too often people try to make it in software development by taking short-cuts and relying on search engines to find code they can copy and paste. But someone who loves to code, and has the desire to know how it all works under the covers, will make the effort to dig deeper. That’s the kind of person I want to hire and work with.

  4. dundane says:

    Honestly I think these are bad questions. Not horrible but bad. And here is why.

    1 there is more than one way to skin the proverbial cat and some of these questions have different answers which are equally valid.

    2 These questions don’t go in to how someone thinks. It’s like asking what year some event happened in history you really don’t get how they would use that information to make an informed decision.

    3 In addition your questions are very jargon filled. You don’t need to know your specific definitions for a term to know when to use a specific key word. What you have accomplished is simply finding out if they happened to have read the same book you got your definition from it gives you absolutely no sense of if they know how to practically apply those terms and key words.

    These questions also really are full of trivialities. Many of these keywords the average programmer quite simply doesn’t use on a daily basis and when they do use them they often have to refresh their memory on specific syntax when they do use them.

    Finally questions like how many classes can you inherit from are just worthless questions. You explained that your main concern was to keep people from making poor design decisions and then ask a question based off of something that is quite literally impossible to implement.

    • Tony Sneed says:

      Hello and thank you for your thoughtful response. This is admittedly one of my more controversial blog posts, so a negative appraisal isn’t entirely unexpected. The main thing to keep in mind is that the phone screen questions are not intended to be the only or final questions, but just the first step in a three-part interview process, followed by an optional 30 minute technical phone interview and a 45-60 minute in-person interview. The purpose of the initial phone screen is simply to filter out blatantly unqualified candidates, but its purpose is not to judge someone’s technical ability or critical thinking. Its purpose is simply to see if they’ve ever picked up a C# book or taken the time to learn some fundamental terms that every C# developer worth his or her salt should know. Yes, it’s a word-game of sorts, but it’s supposed to be administered by a non-technical person, such as a recruiter from HR. The reason why it’s necessary is that people exaggerate — even lie — on their resumes. Why spend 30 minutes of a senior developer’s time with someone like that? It was after having wasted a great deal of time on these kinds of people that I finally resorted to having a recruiter ask some admittedly trivial questions. Are they “bad”? Perhaps yes, but unfortunately, they’re necessary to screen out pretenders with dressed up resumes.

      Let me take on your points one-by-one.

      1. Most of the questions ask for a specific C# keyword, so there’s only one correct answer. Which question(s) are you referring to that could have more than one answer?

      2. These questions are not intended to determine how a person thinks, only whether or not they are familiar with C# terminology. Evaluating a person’s thinking ability should take place in a subsequent interview with a senior developer.

      3. Again, the purpose of the question is not to determine how they would use the term in question, only whether or not they are familiar with the term. We C# developers have our own jargon and terminology, just like medical doctors have their own jargon. But if you are part of the profession, you need to know the jargon. It’s not a matter of reading a particular book – these are from the C# spec.

      4. If you are not using these terms (protected, virtual, internal, abstract, sealed, using, finally, event, lock, etc) on a daily basis, then in my opinion you would not make a good hire. They are pretty important terms in the C# lexicon and you’d better know what they mean.

      5. It’s a fairly important principle that .NET does not support multiple inheritance. Other programming environments, such as native C++, do support multiple inheritance, so this is not impossible to implement. Is it a fair question? Maybe not entirely. While I would not fail someone if they do not answer a few of the questions correctly, they should be able to answer most of them.

      Cheers,
      Tony

      • Max says:

        I completely understand your desire to filter out those who doesnt understand the basics.
        But…
        1. On your question #4 – I would say “No but can on interfaces” – so your non-tecnical recruiter will filter me out. Do you realize that?
        2. I am a developer with 15+ years solid MS background (10+ years C++ plus lately c#/asp/sql/wpf/xml/etc…), but in my positions in the last 5 years was exposed to c# only on occasional projects. I’ve read books and went through several online trainings as I am looking for a .Net position.
        Despite that – I never use “using” for example. And have never met any explanations that it would invoke the Dispose. So did I read wrong books/took wrong trainings? :)
        And, I avoid using extentions, as I read MS does not recommend to use them plus I don’t see any use of them in my current work.
        As a result I don’t know much about them and most likely – will fail on these questions.
        Hovewer you should realise that I can get many things done faster than people who will answer these questions – just because experience, skills and set of technologies I know.

        so I think relying on these questions is not a best idea.
        At the same time I believe you realize all this and you are OK to leave aside some people who might be a good fit for your hirings.
        Frankly, too bad: with a bunch of technologies and limited possibilities to learn them – people like me often facing a situation of being cut off with similar questions when we’ve done a job that is required for the position and can successfully do it for you.

        Regards.

  5. korolei says:

    I’d agree with dundane that those questions just bad. They would give you candidates with good memory, but not necessary good analytical skills. I have over 10 years of consulting, but wouldn’t able to answer half of the questions over the phone. Although I’m using all of the keywords in my code and have good understanding where to use it. It’s just not on the tip of my tongue.
    So my point, you’re not saving time by delegating those questions to non-technical person. You’re still getting the same proportion of good and not so good candidates, in best case scenario.

    • Tony Sneed says:

      @ korolei, If you can answer about half the questions, then congratulations you passed! I wouldn’t require someone to be able to answer all of them, but if you can’t answer at least 50% then what it shows is that you are not familiar with some key C# terms that every developer worth his or her salt should know. How can you write decent software without knowing about virtual, protected, abstract, finally and using? If you are not familiar with the pillars of object-oriented programming and how they are implemented in C#, then you may be able to sling code, but you’re not the kind of developer I would want working for or with me.

      While that may sound harsh, I have undergone the rather painful experience of working with what I call the “search engine” developer. They may be smart and able to think analytically, but they lack a basic understanding of C# terminology and fundamental constructs. That’s not too bad, if they are willing to go out and learn these things, but it’s disastrous when they think there’s no need to learn them and can get by with copying and pasting code snippets from online samples and blog posts. The result is code that shot-through with problems that result from taking too many shortcuts.

      After reading your comment, I did a little experiment. I’m currently working on a consulting project with two other developers who I would consider to be competent. I rattled off the 20 questions, and they were able to answer about 90% correctly. What that tells me is that generally people who complain about the questions are the ones who don’t know the answers and — more importantly — don’t have the desire to learn what they need to know to answer them. It is precisely this kind of developer that the questions are designed to screen out.

      For those reading this post who do have the desire to learn from it, there is a place you can go to do so. I have posted an online C# tutorial, written by an instructor for DevelopMentor, that has lessons, exercises and quizzes on C# fundamentals. Check it out here: http://www.tonysneed.com/csharp/tutorial/coursebook.htm. Enjoy.

      Tony

      • Max says:

        > If you can answer about half the questions, then congratulations you passed! I

        heh..
        sorry, Tony, I should’ve read this first before submeetting my post above :)
        If that’s the guideline your non-tech uses – then it’s more or less decent test.

      • Tony Sneed says:

        Yes, because these are somewhat arcane technical questions on C# syntax, I would expect the average C# developer to answer about half of them correctly, which would then warrant a follow-up interview, either by phone or in person, with the candidate by an actual developer, who can more accurately probe the candidate on their knowledge of the .NET Framework API, their code-writing skills, and on their critical thinking ability.

        For developers like yourself who are looking for a .NET position, I would highly recommend reading the book, CLR via C# by Jeffrey Richter, which is in its third edition. There you’ll find a great explanation of keywords such as “is”, “as” and “using”, with examples of where and why to use them. (By the way, “using” is important for cleaning up non-managed resources, such as file handles or database connections, in a deterministic fashion.)

        With a little reading and research on C# syntax and usage, you’ll be in a much stronger position for your job search and distinguish yourself from the crowd of job seekers who cannot or will not spend time learning the fundamentals of C# and .NET. It’s very tempting for developers to copy and paste code from blogs without understanding how things work under the covers, but that strategy can backfire when poorly written code introduces memory leaks or performance issues. Clearly, there is much more to software development than basic C# syntax, but lacking a firm grasp of concepts such as inheritance, memory management, and threading, can lead to serious problems writing code that is clean, concise and maintainable. It’s not the only thing that is important, but it’s a good foundation to build on. All the best!

  6. Rachel Brown says:

    Great help, thanks Tony!

  7. likeu2000 says:

    I can see what sort of knowledge you wanted to check, but just the way you ask is a bit “unusual”, I would fail quite few not because I don’t know what they are, just simply they way you ask.
    i.e What keyword calls IDisposable.Dispose?
    I know “using” will dispose the object after finish, but the way you ask is a bit miss leading, if instead you ask what can you do to ensure a disposal of a object would make more sense.

  8. Marios Koumides says:

    I don’t see anything wrong with these questions. I have a list of questions I ask in interviews which are very similar to these ones.

  9. jeanfor says:

    What you need to ask are basic question on object oriented development, or for example why you should use stringbuilder or what is garbage collection, reflection…… Like some have said here, I would just fail the test because when I use C# I am not trying to answer a syntax question. This is just the way our brains are wired. You will probably hire a guy who has crammed some questions but who is not able to really solve a problem. I think phone interviews are just plain stupid and a waste of time. Better give the candidate a 100 multiple choice questions, like the questions that are given when taking the Microsoft exams.

    • Tony Sneed says:

      @jeanfor: You’re misunderstanding the questions if you think they’re about C# syntax. You’re also misunderstanding the nature of the screening test itself. As I’ve said in response to other comments, they are just the first step in a multi-step process and are intended to be administered by a non-technical person. If you can answer just half the questions, then you’ve passed by showing a minimal knowledge of some important terms. They are not intended to evaluate your qualifications as a programmer, only to weed out people who claim a knowledge of .NET which they do not indeed possess. The questions pertain, not to syntax, but to concepts of the .NET Framework, such as the type system (value vs reference), inheritance, type casting, exception handling, resource management, generics, delegates and threading. If as a candidate you are familiar with less than half of these terms, then it tells me your knowledge of .NET is superficial. If you are unfamiliar with important terminology, then how can you be familiar with the underlying concepts, and how can you be able to communicate with others programmers?

      There are plenty of programmers out there who know C# and can program using it, but who are ignorant of the fundamentals of the .NET Framework. These are what I like to call “search engine” developers, who know enough to copy and paste something from a blog post and make it compile and run, but who lack enough knowledge of the basics to write code that is going to be easy to maintain and extend. Before you can sing in an opera, you need to know your do re mi’s. And before you can write elegant and efficient code, you have to know the basics. While these questions are in themselves insufficient to determine if you are a good programmer, they can serve to weed out ones who are lacking basic knowledge of .NET fundamentals. And those are the ones I’m not interested in wasting time on with a face-to-face interview.

      • jeanfor says:

        Your questions seem all to be related to what is the keyword…. if this is not a syntax question then what is it? I think the problem about all those phone interviews is that there is no standard. In the same subject I remember that our company had hired a guy who had the MS certifications and could answers those type of questions and he was a terrible software developer. I am of those who think that you hire a brain first somebody who can solve problems and has a creative mind…. ask about GAC, CLR…..

      • Tony Sneed says:

        Again, you’re not understanding the screening question for what they are: screening questions. The decision to hire is not based on these questions. They are only a means of eliminating applicants who lack basic knowledge of .NET terminology and concepts. If they are unable to answer these kinds of questions, it shows they do not have enough familiarity with fundamental .NET terms. (C# syntax goes far beyond just a few keywords.) But if they can answer, it does not make them a good hire. They would have to pass a more thorough in-person interview by an experienced programmer. The reason why this type of screening is needed is so that the time of the interviewer is not wasted on applicants who lack basic knowledge. It’s possible a person could pass the screening questions, but then fail an in-depth interview.

  10. Pingback: Jon D Jones, Director Digital Prompt | Development : Some Great Resources For C# Job Interview Preparation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s