Interview Questions for C#

Posted on 2006-05-25
Last Modified: 2012-06-22

I need to interview some candidates on their C# knowledge. Objective is to test strong C# fundamentals and .NET framework fundamentals.

Please suggest some good questions that can test conceptual knowledge.

Thanks in advance.
Question by:rajesh_khater
    LVL 6

    Accepted Solution

    LVL 6

    Expert Comment

    Oops forget to add this sorry;

    Conceptual understanding of some of the fundamentals of software engineering also helps to weed out a good versus a bad candidate.  Ask them more generalized questions about memory (eg stack vs heap), iteration vs recursion vs dynamic programming etc.  then get them to provide you with some kind of concrete example in C#.  That way you'll know if you have a skilled candidate on your hands who will may just not be that experienced with C# yet but who may pick it up quickly since he already has a great understanding of general programming.

    Also basic questions getting them to define the point of Interfaces, Boxing, Delegates, Value vs Reference Types, Debugging etc. are good for short and quick definitions that you can use to lead on to more in depth examples.

    Hope this helps,

    LVL 35

    Assisted Solution

    One thing that we do when interviewing candidates is ask them to bring in sample code.  Often you can get a person that knows the book answers, but doesn't have any good practical experience.  Or the code shows very bad practices or standards (like one person we saw that they named everything in the page textbox1, textbox2, ... textbox44 and that was in code they brought to showcase thier work)

    Also when you ask to bring in code samples you can ask them questions about what it does and specific sections on why it was written that way to be sure they wrote it and not someone else.
    LVL 35

    Expert Comment

    Also ask if they have ever heard of things like n-tier architecture, and to describe the complete development cycle of a large or complex project they have worked on.
    LVL 37

    Assisted Solution

    I have a tendency of asking really off the wall questions ... One of my favorites is "How much does a ferry way". I like to see how they think .. (i.e. their ability to ask questions and decompose a problem).

    For technical questions I like to ask them to describe their last or favorite project and how it worked .. I will usually drill into a specific area and ask more detailed questions to get an idea of how things were applied.

    I would definately cover design pattern questions in your interview as well. Don't ask things like "What is a singleton", I think it is hard to find someone who does not know ... A better question might be "What is the difference between a proxy and a decorator" or "Why would I want to use an abstract factory" (looking for related factories answer) "What is a possible issue with using factories?" "Why are singletons bad?"

    Depending on how big you are on OOP I might even go into further questions on common items .. never ask the definition of something though, always ask an application or comparison question (nearly all of the "interview questions" are asking definitions etc which shows almost no understanding.

    More examples:

    What are some situations where Active Record would not be a good choice for me to use?
    What are the 4 tenets of OOP? (then go through what each _means_)
    I am writing asynchronous code, what data structures am I likely using? (Queue is the answer you are expecting to see but they might come up with others .. point is seeing the understanding of broader knowledge)
    Why might I want to use a tree as opposed to a hash table? Follow up with what other data structures might I look at applying in those situations and why?
    Architecture is a trade off; what am I likely losing if I gain database independence
    How have generics changed C#?
    What is diamond inheritance? How does .NET prevent it? (this is a great question if you have a good "talker")
    What are the advantages and disadvantages of unit tests?

    For .NET in specific I would probably ask  ...

    What is the cardinality of threads to OS threads?
    How does Control.Invoke work?
    What is impersonation?
    How would I make a textbox draw its text upside down?
    What is GDI?
    What does Application.Run do?
    If I am getting an indexoutofboundsexception in wndproc, how do I catch it to keep the application from dying? What may happen if I let the application continue?

    What is the life cycle of an ASP.NET page
    what is the difference between a user control and a web control (web part) why might I prefer one over the other
    What is the difference between a windows service and a web service (you would be amazed how many get this wrong)
    Describe the ASP.NET validation process
    What situational items define whether I want to store something in session, viewstate, cache, cookie.
    I would probably test their javascript knowledge as well...

    and of course ... my age old favorite for the "talkers" is to take old products (i.e. libraries from the late 80s or similar technology and ask how they have applied them. I had one guy tell me about his experiences loading a webservice with DEVICEHIGH=name.wsdl in config.sys and the differences from doing the same with DEVICE=name.wsdl, thats the great thing about the "talkers", they give funny answers so enjoy your time with them!)

    Keep in mind that this person is making decisions everyday that have a server impact on the quality of your product, you will notice some of my quetions are silly but you learn alot from them. Ex: How would I make a textbox print its text upside down (I know for a fact they have never done this nor have they read about it:) ). I always focus on making sure they know how to think ... I can teach them how to code :)


    Greg Young
    LVL 35

    Expert Comment

    I say split among neilprice {16760995} mrichmon {16762208} gregoryyoung {16766327}
    LVL 6

    Expert Comment

    I agree with mrichmon's answer above.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
    Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now