Questions every good .NET developer should be able to answer?

.Net

.Net Problem Overview


My company is about to hire .NET developers. We work on a variety of .NET platforms: ASP.NET, Compact Framework, Windowsforms, Web Services. I'd like to compile a list/catalog of good questions, a kind of minimum standard to see if the applicants are experienced. So, my question is:

What questions do you think should a good .NET programmer be able to respond?

I'd also see it as a checklist for myself, in order to see where my own deficits are (there are many...).

alt text

*UPDATE: It want to make clear that we're not testing only for .NET knowledge, and that problem solving capabilities and general programming skills are even more important to us.

.Net Solutions


Solution 1 - .Net

Basic questions include:

I think it usually helps to ask your applicants to complete a simple coding exercise such as:

  • Write your own linked list class without using the built-in classes.
  • Write your own hashtable class without using the built-in classes.
  • Write a class that represents a binary tree. Write a method that traverses all nodes of the tree.
  • Write a method to perform a binary search on an array without using built-in methods.
  • Draw a database schema for a blog. Each user only has one blog, each blog has many categories, each category has many posts, and each post can belong to more than one category. Ask your applicant to write queries to pull specific information out.

Next, look for specific technical know-how:

  • (Event handlers) Create a class with a custom event handler, create another class which hooks onto the custom event handler.
  • (XML) Load an XML document and select all of the nodes with properties x, y, and z.
  • (Functional programming) Create a function that accepts another function as a parameter. A Map or Fold function works really good for this.
  • (Reflection) Write a function which determines if a class has a particular attribute.
  • (Regex) Write a regular expression which removes all tags from a block of HTML.

None of these are particularly difficult questions for a proficient C# programmer to answer, and they should give you a good idea of your applicants particular strengths. You may also want to work in a few questions/code sample that make use of specific design patterns.

[Edit for clarification]:

Seems that a lot of people don't understand why I'd ask these types of questions. Let me touch on a few peoples comments (I'm not quoting directly, but paraphrasing instead):


Q: When was the last time anyone used volatiles or weak references?

A: When I give technical interviews, I look to see whether a person understands the high-level and low-level features of .NET. Volatiles and weak references are two low-level features provided by .NET -- even if these features aren't used often in practice, answers to these questions are extremely revealing:

  • A good understanding of volatiles demonstrates that a person understands how compiler optimizations change the correctness of code, how threads keep local copies of shared state which may be out of sync at any given time, and is minimally aware of some of the complexities of multithreaded code.

  • A good understanding of weak references demonstrates that a person knows about the intimate details of the garbage collector and how it decides when to free memory. Sure, you could ask candidates "how does a garbage collector work", but asking about weak references gets a much better, more thoughtful reply.

.NET is a fairly abstract language, but star developers almost always have a deep understanding of the CLR and the low-level details of .NET's runtime.


Q: Why would anyone need to implement their own hashtable or linked list?

A: I'm not implying that the Dictionary class is inferior or that people should roll their own hashtable. This is a basic question which tests whether a person has a minimal understanding of datastructures. Thats what these questions test for: bare minimum understanding.

You learn about these hashtables and linked lists on the first day of Data Structures 101. If someone can't write a hashtable or a linked list from scratch, then they have a huge gap in their technical knowledge.


Q: Why are these questions so crud-oriented?

A: Because the title of this thread is "questions every good .NET developer should know". Every .NET developer begins their career writing crud apps, and 90% of all application development people do for a living is concerned with line-of-business applications.

I think questions testing a persons knowledge of line-of-business apps are appropriate in most cases, unless you're looking for developers in very specific niches, such as compiler development, game-engine development, theorem-proving, image processing, etc.

Solution 2 - .Net

I found these lists on Scott Hanselman's blog:

Here are what I think are the most important questions from these posts divided into categories. I edited and re-arranged them. Fortunately for most of these questions there is already a good answer on Stack Overflow. Just follow the links (I will update them all ASAP).

Platform independent .NET questions

ASP.NET

Solution 3 - .Net

This might not be what you want to hear, but I would recommend not focusing on narrow technologies, but on general programming and problem solving skills. Solid developers can learn whatever you want them to do quickly.

I, for instance, am not a Compact Framework guy, so I might fail your interview if you went that direction. But if I needed to use it I could do some research and jump right in.

Joel's book, http://www.amazon.com/Smart-Gets-Things-Done-Technical/dp/1590598385/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1229190954&sr=8-1">Smart and Gets Things Done, has great advice for hiring devs and there are large juicy sections about the kinds of questions to ask. I highly recommend it.

Solution 4 - .Net

I think if I were interviewing someone who had LINQ experience, I'd possibly just ask them to explain LINQ. If they can explain deferred execution, streaming, the IEnumerable/IEnumerator interfaces, foreach, iterator blocks, expression trees (for bonus points, anyway) then they can probably cope with the rest. (Admittedly they could be "ok" developers and not "get" LINQ yet - I'm really thinking of the case where they've claimed to know enough LINQ to make it a fair question.)

In the past I've asked several of the questions already listed, and a few others:

  • Difference between reference and value types
  • Pass by reference vs pass by value
  • IDisposable and finalizers
  • Strings, immutability, character encodings
  • Floating point
  • Delegates
  • Generics
  • Nullable types

Solution 5 - .Net

I'm with the guys that are looking for problem-solving abilities rather than the sort of thing you can look up and memorise from '101 top .NET interview Qs and As".

Just to cite myself as an example, I tend to 'know' the things I need to use from day to day. I tend to forget (and later have to re-look up) things that I use rarely.

If you wanted to trip me up in an interview, it would be very easy.

Nevertheless, I have architected and coded much of the infrastructure for a system that uses identical Business Objects and Data layers for its WinForms and ASP.NET incarnations, and our codebase is robust and reusable enough for us to be able to support and develop 20+ differently configured versions of the web site, as well as an increasing number (currently 5) of the WinForms application...

... with a development team of two.

I used to work on a team as a tech lead, and my job involved quite a lot of recruiting and interviewing. My most spectacular mistake was hiring a guy that knew more about the technology we were using than all the rest of us put together, including me, and I counted myself as an expert. He knew everything...

... except how to write code that either met the requirements, or could be understood by anyone except himself. When I eventually persuaded the PM not to renew his contract, every single thing he wrote had to be rewritten.

Structure your interviews wisely...

Solution 6 - .Net

Who is Jon Skeet?

Solution 7 - .Net

Good questions I have been asked are

  • What do you think is good about .NET?
  • What do you think is bad about .NET?

It would be interesting to see what a candidate would come up with and you'll certainly learn quite a bit about how he/she uses the framework.

Solution 8 - .Net

I would always look for the soft skills myself - no pun intended. So good OO design, test driven development, a good multi (programming) lingual background and all round general smartness (and getting-things done-ness I guess!).

An intelligent developer should not have any trouble learning the individual technologies that you need them to know even if they have never looked at them before - so I wouldn't worry too much about specific questions around WCF/compact framework and the like.

I would have them write some code - best way to find out what they know and how they work. Anyone can memorise the answer to 'What's the difference between a reference type and a value type?'

Solution 9 - .Net

Honestly?

"What is .NET?"

If they can give you a clear answer as to what .NET is and what it isn't, how it's used, what elements it's composed of, etc... If they can convince you they know what it is, then chances are they know it pretty well.

The fact of the matter is, many people don't really know what .NET is. Even those who write programs for it.

Solution 10 - .Net

None, really. There are probably very simple questions that the smartest people in the world do not know the answers to. Not because they are hard, but simply because they just haven't come across it. You should be looking at the whole package and the skill of the developer, not whether they can answer an arbitrary question.

If the question is easy enough to be answered in a short sentence or two, it's easy enough to just tell someone who doesn't know. You should be looking for their understanding of concepts and reasoning capability, not their ability to answer questions "every .NET developer should be able to answer."

Solution 11 - .Net

Know the difference between reference and value types.

Know that events are stored as hard references (i.e. remember to unregister events or the application will leak memory).

Strings are immutable.

Solution 12 - .Net

Martin Fowler prefers design skills over platform knowledge. On the other hand you can ask a question which will show knowledge of design patterns and .NET platform like this:

  • Name design patterns and principles you know and how they are utilized in .NET Framework?

Solution 13 - .Net

I suggest enquiring about blogs that they read on a regular basis and personal programming projects that they have worked on as this will show a willingness to learn and a passion for programming.

Solution 14 - .Net

Here are some I've used to filter programmers applying for jobs as C# programmers:

What's the difference between a reference type and a value type?

Explain the IDisposable interface, which C# language construct requires it and how you would implement it.

Which exception would you throw if a null is passed as an argument to a method which has a contract that doesn't allow nulls for that parameter?

Solution 15 - .Net

"Which of the ASP:whatever controls would you ever use in production and why?"

That will tell you quickly whether your subject has ever actually built and maintained a large project for long enough to get burned by DataGrids and LinkButtons, or whether he's still in the Drag/Drop "teach yourself in 21 days" phase.

(the answer is asp:Repeater, asp:PlaceHolder, asp:Literal, and asp:Content)

Solution 16 - .Net

What is a thread?

What is the GC?

Solution 17 - .Net

This is a bit of a variable question, and not really one you should be able to answer completely now, but one you should be able to answer when appropriate:

"What does the .NET framework offer to get task X done?"

Or more specifically:

"Does the .NET framework include an object that does X?"

For example, I recently spent a few hours developing an object that is optimized to store an array of Booleans and operate on it, such as doing a collection-wise NOT, OR, XOR, AND, set all values, etc. It wasn't until after I finished writing all my unit tests and tweaking it for the best performance possible that I realized my "BoolArray" object already existed in the .NET framework under the name "BitArray".

This can be a tough one to answer since many times the best answer on what object / helpers to use is the one you do not know or fully understand. How wonderful the .NET world would be if everyone actually knew about even the simple StringBuilder, a basic tool that can increase performance significant amounts.

Solution 18 - .Net

I'd not ask those "know something from the textbook" questions, but rather ask some tinkering stuff like:

  • What does the foreach loop do in plain C#? (Expecting him to write a iterator loop.)
  • What's a singleton?
  • Let him/her parse a String to Datetime (expecting him/her to use TryParse instead of try/catch)
  • Implement the singleton, strategy and command patterns
  • Let him/her Refactor a piece of code for testing. Expecting him/her to abstract the external services away from the Unit under Test and implement his own Test-double of the service (providing no mocking framework)

These are not 100% sure, depending on the person I may ask them:

  • let him/her guard a method from null input (expecting him/her to use multiple returns to reduce nesting)
  • how does a object initializer work (Expecting him/her to write the thread-safe assignment)

Also I'd ask him how he/she learned his/her stuff and what he/she is reading (what blogs, books).

Solution 19 - .Net

I will suggest some questions focus on understanding of the programming concepts using dotnet like

What is the difference between managed and unmanaged enviroment? GC pros and cons JIT pros and cons If we need to develop application X can we use dotnet?why? (this will identify how he see the dotnet)

I suggest also to write small methods and ask him to rewrite them with better performance using better dotnet classes or standard ways. Also write inccorrect methods (in terms of any) logical or whatever and ask him to correct them.

Solution 20 - .Net

I'm a fan of the following in addition to some of the questions already mentioned:

  • What's a delegate?
  • What's the app domain?
  • When would you use the lock keyword?
  • Are the standard library generic collection classes thread safe?
  • What's an extension method?
  • What's the difference between XmlDocument and XmlReader ?
  • How do you read in configuration settings from the application config file?

Solution 21 - .Net

A few more:

  1. Partial classes. And its limitations?
  2. Sealed classes
  3. How localization can be done in .NET?
  4. Database connectivity
  5. Various configuration files
  6. Delegates vs events
  7. Unmanaged dll access
  8. Reflections
  9. Generic classes
  10. Hottest in .NET 3.5
  11. Unit testing frameworks you have used.

Solution 22 - .Net

This is interesting, and at the risk of getting this down-voted for putting in my opinion, as I am born deaf, being asked a question like that would require more effort in communicating my thoughts on my part personally.

To be blunt, I really would not read too much of the typical questions, as the underlying paradigm is 'How well can you vocalize your thoughts and understanding?', that is really what the interviewer is looking for. Communicating is always my biggest weakness due to the way I am and can get frustrated quite easily.

It would be ideal to have the knowledge and be the know-it-all type but unfortunately, there are some things I don't know, but not to be afraid if you actually don't know the answer and admit it rather than bluff through it. If an interviewer asked me a question like one of the above, that I would not be sure of or mis-understand/mis-interpret the question, I would say it upfront, which can personally be embarrassing, but have learnt to handle that.

You would be surprised at how many would actually waffle on and bluff through it in which at the end of the day get caught out with their 'pants down' metaphorically speaking.

My 2cents, Best regards, Tom.

Solution 23 - .Net

A few more:

What are the limitations of garbage collection.

Know about finalizers and IDisposable.

Be aware of the thread pool and when to use it.

If you're doing GUI applications - be aware that Windows GUI is single threaded.

Use foreach (I see a lot of people doing MoveNext etc.)

Solution 24 - .Net

I think it shouldn't be just questions, I know a few guys who are brilliant when you interview them but once they get to the real thing they are too much perfectionist I would say that they fail to code the task miserably.

I've been once interviewed and I kinda liked the approach where first employer gave me a technical questionnaire to fill in 30 minutes. If one is successful then he'll be called for a 1 hour interview covering Personality Judgement and Character finding questions plus technical jargons.

Then I've been asked to develop a three page web application in 6 hours time. The constraints impose in application was smartly covering major aspect of application development like a small ERD, Layerd Design, UI Consistency, controls specific problems like using Radio buttons in GridView and Fetching and displaying image types from DB on a web page, one algorithm development, security, Encryption, Hashing, Data representation and manipulation.

Then Next day they followed by a 30 minutes discussion on the developed application covering performance bottleneck areas and improvements on design and used algorithms. And 1 hour optional test to improve your algorithm developed in previous step with a specific condition.

So it took a fair amount of time but this way you can make sure that the person you are hiring knows at-least those concepts which are essential for a good developer to be.

Solution 25 - .Net

I would prefer giving him a problem and asking him to solve it using the features of .net you know and why do you think it is best solution.

This will crack almost all the capabilities of a candidate in terms of technical, analytical and problem solving skills along with his approach for solving a problem.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionsplattneView Question on Stackoverflow
Solution 1 - .NetJulietView Answer on Stackoverflow
Solution 2 - .NetsplattneView Answer on Stackoverflow
Solution 3 - .NetBrian MacKayView Answer on Stackoverflow
Solution 4 - .NetJon SkeetView Answer on Stackoverflow
Solution 5 - .NetChrisAView Answer on Stackoverflow
Solution 6 - .NetSteven A. LoweView Answer on Stackoverflow
Solution 7 - .NetChris JamesView Answer on Stackoverflow
Solution 8 - .NetJenniferView Answer on Stackoverflow
Solution 9 - .NetErik FunkenbuschView Answer on Stackoverflow
Solution 10 - .NetGene RobertsView Answer on Stackoverflow
Solution 11 - .NetBrian RasmussenView Answer on Stackoverflow
Solution 12 - .NetDzmitry HubaView Answer on Stackoverflow
Solution 13 - .NetNicholasView Answer on Stackoverflow
Solution 14 - .NetMike ScottView Answer on Stackoverflow
Solution 15 - .NetJason KesterView Answer on Stackoverflow
Solution 16 - .NetStingyJackView Answer on Stackoverflow
Solution 17 - .NetSpodiView Answer on Stackoverflow
Solution 18 - .NetTigraineView Answer on Stackoverflow
Solution 19 - .NetAhmedView Answer on Stackoverflow
Solution 20 - .NetsegyView Answer on Stackoverflow
Solution 21 - .NetRameshVelView Answer on Stackoverflow
Solution 22 - .Nett0mm13bView Answer on Stackoverflow
Solution 23 - .NetBrian RasmussenView Answer on Stackoverflow
Solution 24 - .NetS M KamranView Answer on Stackoverflow
Solution 25 - .NetJPReddyView Answer on Stackoverflow