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

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.

7 I think your list is a good way to probe for strengths and weaknesses but it is not "basic" knowledge. As Greg points out, I was tripped up by "short circuited" operators even though they are simple and I use them often: I had just forgotten the name. Would that disqualify me?

– Mark Brittingham Feb 27 '09 at 2:19 32 Similarly, I've never declared a variable "Volatile" and do very little with XML and so couldn't complete your programming task. And yet-I'm a published author, won a major programming contest, and have written 4 successful products that have won major awards. – Mark Brittingham Feb 27 '09 at 2:22 23 Thus, I don't necessarily disagree with your list - I just disagree with your characterization of the knowledge items as "Basic."

None are hard concepts - but some are just quite specific and won't be familiar to a good number of applicants. Still - again - please accept my apologies. – Mark Brittingham Feb 27 '09 at 2:28 38 Half the items on this list are trivia questions.

This won't help find good people, but it might annoy some of them enough to walk out on your interview. – Jason Kester Feb 27 '09 at 11:23 14 (Regex) Write a regular expression which removes all tags from a block of HTML. - I SMELL TROUBLE – BlueRaja - Danny Pflughoeft Feb 27 '09 at 20:42.

I found these lists on Scott Hanselman's blog: What Great . NET Developers Ought To Know (More . NET Interview Questions) ASP.NET Interview Questions 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 What is the difference between a thread and a process? What is the difference between an EXE and a DLL?

What is strong-typing versus weak-typing? What is the difference between a. Equals(b) and a == b?

What is boxing? Is string a value type or a reference type? What is the Global Assembly Cache (GAC)?

What problem does it solve? What is an Interface and how is it different from a Class? What is Reflection?

Conceptually, what is the difference between early-binding and late-binding? When would using Assembly. LoadFrom or Assembly.

LoadFile be appropriate? What is an Asssembly Qualified Name? Is it a filename?

How is it different? How is a strongly-named assembly different from one that isn’t strongly-named? What does this do?

Sn -t foo. Dll How does the generational garbage collector in the . NET CLR manage object lifetime?

What is non-deterministic finalization? What is the difference between Finalize() and Dispose()?(external article) What is the difference between in-proc and out-of-proc? What technology enables out-of-proc communication in .

NET? What is FullTrust? Do GAC’ed assemblies have FullTrust?

What is the difference between Debug. Write and Trace. Write?

When should each be used? What is the difference between a Debug and Release build? Is there a significant speed difference?

Why or why not? What is the difference between: catch (Exception e) {throw e;} and catch (Exception e) {throw;}? What is the difference between typeof(foo) and myFoo.GetType()?

What is the purpose of XML Namespaces? What is the difference between an XML "Fragment" and an XML "Document"?(XML Basics) How would you validate XML using . NET?ASP.

NET What is a PostBack? What is ViewState? How is it encoded?

Is it encrypted? Who uses ViewState? Why is it either useful or evil?

What Session State providers are available in ASP.NET? What are the pros and cons of each? What is the OO relationship between an ASPX page and its CS/VB code behind file?

How would one implement ASP. NET HTML output caching, caching outgoing versions of pages generated via all values of q= except where q=5 (as in http://localhost/page. Aspx?

Q=5)? What are HttpHandlers? What are HttpModules?

What is needed to configure a new extension for use in ASP. NET? For example, what if I wanted my system to serve ASPX files with a *.

Jsp extension? How do cookies work? What is an example of Cookie abuse?

What kind of data is passed via HTTP Headers? How does IIS communicate at runtime with ASP.NET? Where is ASP.

NET at runtime in the different versions of IIS (5 to 7)?

8 I know of developers knowing all this and still can't see further than the book. Open-Minded is very important, besides, don't try to get too much detail answers, just make sure they understand the concept. – Saif Khan Dec 29 '08 at 23:31 I agee, Saif.

But on the other hand, if you don't know the details, you won't be able to correctly apply the "concepts". – splattne Dec 30 '08 at 7:28 2 Some questions are really stupid, like what is difference between Debug and Release build. Yes, Visual Studio has predefined some build configurations but this is not a platform independent question.

Someone who compiles by command line or using Mono, might have no idea what you're talking about. – lubos hasko Feb 22 '09 at 12:46 3 Are you able to describe concepts that usually take 2 pages or even a chapter of a book, in an articulate way in an interview situation. I can't without rehearsing them beforehand – Chris S Feb 23 '09 at 12:57 1 Try not to ask people to define terms.

You'll end up with CS majors who had to memorize them for tests, but miss out on people who actually know how to program. I remember being asked once what "deferencing" was. I had not the first clue, even though I did it 30 times a day back then.

– Jason Kester Apr 11 '09 at 11:26.

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.

Maybe part of the hiring process should be a problem in Cardspace or something they have never looked at! – Jennifer Dec 13 '08 at 18:00 Maybe, but there's the problem of research, so I think that might be unfair. I'm more interested in seeing how they think through problems and maybe seeing them to code something abstract so I can find out if they speak code natively or not.

– Brian MacKay Dec 13 '08 at 18:08 If I could chose about two people who both have with general programming and problem solving skills, for practical reasons I HAVE to chose the one with better . NET knowledge and experience. – splattne Dec 13 '08 at 18:27 .

NET knowledge certainly, but when it comes down to the narrower technologies I think you can go with the programmer with the problem solving skills. – Jennifer Dec 13 '08 at 18:54 5 Yes, we all have to know tons of "narrow technologies". But for every one we know, there are a bunch that we don't know (usually because we haven't needed them).

I'm saying you don't want to miss out on a great developer for not knowing SharePoint, becuase very shortly he might be your best SharePoint guy. – Brian MacKay Dec 13 '087 at 14:36.

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.

1 Yes, I wanted to see this kind of answer. Good candidate for being accepted. Anyone better?

– splattne Dec 13 '08 at 18:37 5 @splattne: don't be silly, this is a Jon Skeet answer, so just accept it. It is inevitable. – Steven A.

Lowe Dec 16 '08 at 15:12 3 I was just about to say...wt...you don't question Skeet! – Saif Khan Dec 29 '08 at 23:28 This is a much better answer than the accepted one. It helps you understand whether someone has deep knowledge in an area of purported expertise while also probing knowledge of language features that run a fairly wide gamut.

– Mark Brittingham Feb 23 '09 at 13:55 1 This answer beats the pants off of 'design your own Linked List, "parse HTML with regexp", or the "How much do you know about the Assembly, GAC, etc..." because it addresses tools and concepts that you'd actually use during development. Intimate knowledge of LINQ is also essential. I've seen many instances on this site where people are trying to roll their own version of Union Distinct and Concat for collections because they don't understand LINQ.

– Evan Plaice Jun 19 '10 at 1:04.

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...

1 That's a really interesting observation. We had the opposite situation: a small clique of developers that knew less than others but who convinced management that they knew more. They proposed a data abstraction class that I argued was impossible (I was criticized for not being a "team player").

– Mark Brittingham Feb 23 '09 at 14:00 -continued - after 4 months of "skunk works" effort they presented the team with....their transfer papers to another dept - and NO code. The rest of the team had to pick up the pieces. – Mark Brittingham Feb 23 '09 at 14:01 1 Bottom line, though: I really like your observation that specific knowledge of coding constructs is not a guarantee of an ability to create working software that meets customer needs.

– Mark Brittingham Feb 23 '09 at 14:02.

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.

– splattne Dec 14 '08 at 9:46 2 No offense to Jon Skeet - but I think Rick Strahl tends to show up with the answers more frequently for the types of issues I run into.. – Andrew Theken Mar 1 '09 at 1:29 1 @Andrew Theken: I'll play the percentages on that one ;-) google for "Rick Strahl" yields 38,500 hits, "jon skeet" yields 144,000. Plus, Rick Strahl doesn't post on SO AFAIK. – Steven A.

Lowe Mar 1 '09 at 2:30 3 Skeet skeet skeet – user58670 Nov 22 '09 at 7:10 1 both guys are great at what they do...our gain. – silverCORE Jan 22 '10 at 19:40.

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?

2 Spot on. Asking rote questions is asking for trouble. Company I work for asks the old techie question but mostly it's: I have these problems, here's a whiteboard, shwo me how you'd solve 'em.

Scary but effective. – Chris Brooks Dec 17 '08 at 10:29 4 ... but if you don't solve them the way the interviewer expects, you fail. – gbjbaanb Dec 29 '08 at 23:26 1 @gbjbaanb sometimes.

But if that's the case you might not want to work there anyway. Remember, you're interviewing the company, too. I have known a few companies that failed the interview!

– Tony Ennis Oct 17 '10 at 16:12.

"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.

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.

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.

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?

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.

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?

My code would usually throw a NullReferenceException. – Joshua Mar 7 '09 at 18:01 4 @Joshua, ArgumentNullException you failed. – Nicolas Dorier Jun 10 '09 at 21:47.

" 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).

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.

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.

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.

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.

A few more: Partial classes. And its limitations? Sealed classes How localization can be done in .

NET? Database connectivity Various configuration files Delegates vs events Unmanaged dll access Reflections Generic classes Hottest in . NET 3.5 Unit testing frameworks you have used.

(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).

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. ).

1 I didn't know, so I looked up the limitations of garbage collection. – billynomates May 3 at 14:49.

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.

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.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions