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.
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.
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?
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, 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.
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?'
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.)
Good questions I have been asked are
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.
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...
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:
Basic questions include:
I think it usually helps to ask your applicants to complete a simple coding exercise such as:
Next, look for specific technical know-how:
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.
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.
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:
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).
a.Equals(b)
and a == b
?Assembly.LoadFrom
or Assembly.LoadFile
be appropriate?Finalize()
and Dispose()
? (external article)Debug.Write
and Trace.Write
? When should each be used?catch (Exception e) {throw e;}
and catch (Exception e) {throw;}
?typeof(foo)
and myFoo.GetType()
? q=
except where q=5
(as in http://localhost/page.aspx?q=5
)?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.
I'd not ask those "know something from the textbook" questions, but rather ask some tinkering stuff like:
These are not 100% sure, depending on the person I may ask them:
Also I'd ask him how he/she learned his/her stuff and what he/she is reading (what blogs, books).
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."
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.
I'm a fan of the following in addition to some of the questions already mentioned:
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.
"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)
Remember, you need to know how to reverse a string, and there is no String.Reverse :) lol
though, there is an Array.Reverse :)
I'm glad they at least gave me a coding question.
A few more:
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.
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.
Interesting thread. I think one should have a website for fresh, intermediate and experienced developers so that they could pass those atleast to be able to get a detailed technical interview. 2nd interview should be either a scenario or a practical test in my humble opinion. You may find some good ones at Asp.net Interview Questions
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.