Posted By: splattne
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…).
*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.
Basic questions include:
- Whats the difference between an abstract class and interface? When would you want to use them?
- What’s the difference between a left join and an inner join?
- What’s the difference between viewstate and sessionstate?
- What’s the difference between overriding and overloading a method? Explain how both are done.
- What’s the difference between protected and internal? What about “protected internal”?
- How do short-circuited operators work?
- Explain what the StringBuilder class is and why you’d want to use it?
- What’s the difference between a static method and a non-static method?
- What does the “volatile” keyword in C# mean?
- Explain what happens when you pass a “ref” or “out” parameter into a method. What’s the difference between those two keywords?
- What’s a weakreference? When would you want to use one?
- What’s the difference between a DataTable and a DataReader?
- What’s the difference between a value-type and a reference type?
- What does the “readonly” keyword in C# mean?
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.