Coffeehouse Thread

60 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Interviewing programmers

Back to Forum: Coffeehouse
  • User profile image
    pathfinder

    I am interviewing candidates for a C#/C++ programming position and I just need some ideas for good technical questions to ask to guage someones experience.    I am mostly concerned with C# experience.  Does anyone have some good ideas on questions I should ask?

    Questions involving using Sockets and Threading  would be helpful too.

    They don't have to be trick questions, but one I thought of was "Name a class that does not have the .ToString() method".

  • User profile image
    ScanIAm

    pathfinder wrote:
    

    I am interviewing candidates for a C#/C++ programming position and I just need some ideas for good technical questions to ask to guage someones experience.    I am mostly concerned with C# experience.  Does anyone have some good ideas on questions I should ask?

    Questions involving using Sockets and Threading  would be helpful too.

    They don't have to be trick questions, but one I thought of was "Name a class that does not have the .ToString() method".



    Are you going to not hire someone if they don't know which class doesn't have a .ToString() method?

    Hell, I don't know this off the top of my head, and I'm willing to bet I've got a pretty decent knowledge of C#.

    Mostly because it isn't pertinent to the skillset.

  • User profile image
    Martin Carolan

    As he said in his message, there isn't one, System.Object has it, so they all have it

  • User profile image
    Dr Herbie

    pathfinder wrote:
    

    I am interviewing candidates for a C#/C++ programming position and I just need some ideas for good technical questions to ask to guage someones experience.    I am mostly concerned with C# experience.  Does anyone have some good ideas on questions I should ask?

    Questions involving using Sockets and Threading  would be helpful too.

    They don't have to be trick questions, but one I thought of was "Name a class that does not have the .ToString() method".




    "What is polymorphism and why is is useful?"

    I was shocked at the number of candidates that couldn't separate polymorphism from class inheritance and I don't think I've met one yet who could explain why it was useful (other than inheriting functionality, which is not the correct answer).


    Also, for C#, ask them to explain garbage collection.


    Herbie

  • User profile image
    Ion Todirel

    well, there are so many questions you may ask, a google search will guide you Wink

  • User profile image
    Ion Todirel

    Dr Herbie wrote:
    "What is polymorphism and why is is useful?"

    I was shocked at the number of candidates that couldn't separate polymorphism from class inheritance and I don't think I've met one yet who could explain why it was useful (other than inheriting functionality, which is not the correct answer).


    Also, for C#, ask them to explain garbage collection.


    Herbie
    good questions, also you may ask when Dispose method is called Smiley

  • User profile image
    W3bbo

    Martin Carolan wrote:
    As he said in his message, there isn't one, System.Object has it, so they all have it


    Not necessarily.

    If you compile your project with the /nostdlib you can define your own classes which don't inherit from System.Object (it's how you compile mscorlib.dll btw).

    Dr Herbie wrote:
    "What is polymorphism and why is is useful?"

    I was shocked at the number of candidates that couldn't separate polymorphism from class inheritance and I don't think I've met one yet who could explain why it was useful (other than inheriting functionality, which is not the correct answer).


    It's useful because it enables code-reuse and overriding older/irrelevant methods.

    But they're not so much separate as they are dependent. Polymorphism depends on inheritance. That's why VB6 isn't a true OOP language.

    Dr Herbie wrote:
    Also, for C#, ask them to explain garbage collection.


    "See Sharp Garbage Collection you say? Well I know the city santiation guys use thick gloves when dealing with the bins in the public loos"

  • User profile image
    W3bbo

    Duplicate post of evilness.

  • User profile image
    pathfinder

    ScanIAm wrote:
    
    Are you going to not hire someone if they don't know which class doesn't have a .ToString() method?




    If I had a candidate that could answer the question and one that couldn't and everything else was equal, then probably yes.

  • User profile image
    pathfinder

    W3bbo wrote:
    
    Martin Carolan wrote:
    As he said in his message, there isn't one, System.Object has it, so they all have it


    Not necessarily.

    If you compile your project with the /nostdlib you can define your own classes which don't inherit from System.Object (it's how you compile mscorlib.dll btw).



    Good point.  What about P/Invoke?  I like the suggestion about GC.   These are good .NET questions, how about any questions that are specific to C# language structure? 

  • User profile image
    mstefan

    Dr Herbie wrote:
     Also, for C#, ask them to explain garbage collection.


    That's easy. Every Wednesday morning, this large truck with robotic arms roams the neighborhood, lifts up our trash bins (which we've placed at the curb on the previous evening) and deposits the contents into the back of the truck. Sometimes, it must shake the bin a few times to extract all of the refuse. It then places the bin back down on the ground, near its original position at the curb. Thusly, the garbage has been collected.

    Am I hired?

  • User profile image
    Massif

    As I've been interviewed recently you'd think I'd be able to help, but I got asked a bunch of really annoying "what does X keyword mean" questions.

    I suggest asking them about C# strings, (like why "this " + someint.ToString() + " is stupid" is a bad idea)

    Also you could ask them how they'd marshall a pointer by p/invoke. That'd be tricky methinks.

    But definitely ask them about garbage collection, and if they know about generations and what is the best amount of time to retain objects etc...)

    But mainly I'd ask them about OO principles, design patterns and stuff like that. Picking up C# is a week or so's work for a programmer who understands the principles.

  • User profile image
    bbrewder

    pathfinder wrote:
    

    I am interviewing candidates for a C#/C++ programming position and I just need some ideas for good technical questions to ask to guage someones experience.    I am mostly concerned with C# experience.  Does anyone have some good ideas on questions I should ask?

    Questions involving using Sockets and Threading  would be helpful too.

    They don't have to be trick questions, but one I thought of was "Name a class that does not have the .ToString() method".



    Check out this blog entry on Coding Horror: Why Can't Programmers.. Program?. It outlines some basic questions that have proven remarkably useful at weeding out the truly incompetent.

    You should just stick to very basic questions when it comes to programming, such as write a for loop. If you need somebody that can design a multi-process communication system, ask them basic questions about remoting, such as, pick your favorite remoting technique and establish a connection. For threading, ask them to establish a thread.

    I don't think that more complicated questions will prove anything one way or another (not everybody performs at their best during an interview).

    Obviously these questions won't tell you if the person is truly competent or not, but they will tell you if they are incompetent. To judge further, just ask them about their experience with the things you are interested in. Try to get them to go deep and explain any complex/tricky parts as best they can (but don't make them write the code).

    Don't bother asking trivial or very technical questions. Trivia might be fun, but it's not a very good indicator of competence.

  • User profile image
    W3bbo

    bbrewder wrote:
    For threading, ask them to establish a thread.


    What if they give you an example back which just uses BackgroundWorker.

    Is that a partial-credit?

  • User profile image
    Yggdrasil

    Some questions I'ved asked, to get a feel for how much the person understands the technology he's using:

    1) What are the primary differences between developing in a managed environment (C#, Java, etc) and an unmanaged one (C/C++ etc).

    Some people stammer and go all glassy eyed. ("Because it's newer"). Some have some half-remembered or non-specific answers. ("Because it's safer" or "Because we get to take advantage of the .NET framework"). With others, you can see straight away that they have experience with unmanaged code and the advantages of managed code - less worries about memory management, having runtime checks to prevent access violations and overflows, and so forth.

    2) Strings. Ask people how strings are implemented in .NET, why we need the StringBuilder class and, as an extra bonus, what all these interned immutable strings are good for. Smiley

    3) XML. Ask about the different ways of working with XML files in .NET. Assuming they pass the first stage, ask them when would an XmlDocument be appropriate and when an XmlReader.

    All this assumes that these are even in your area of interest. Don't bother asking them about things that they don't need in their daily work.

  • User profile image
    Dr Herbie

    W3bbo wrote:
    
    Dr Herbie wrote:
    "What is polymorphism and why is is useful?"

    I was shocked at the number of candidates that couldn't separate polymorphism from class inheritance and I don't think I've met one yet who could explain why it was useful (other than inheriting functionality, which is not the correct answer).


    It's useful because it enables code-reuse and overriding older/irrelevant methods.

    But they're not so much separate as they are dependent. Polymorphism depends on inheritance. That's why VB6 isn't a true OOP language.



    OK, firstly polymorphism has nothing to do with code-reuse.  That's where you're confusing class inheritance with polymorphism (although you're right, polymorphism does depend on inheritance). Polymorphism can also be done through pure interface inheritance.
    Polymorphism is where different classes can be made to appear the same through casting to a base class/interface. This allows all the references to be treated the same, thereby simplifying code that uses those objects.

    The classic example is a vector drawing program there all the shapes derive from the base 'BaseShape'.  The specific instances of shapes that the user creates (Like CircleShape, TriangleShape and RectangleShape) are stored in a collection of BaseShape instances and the picture is drawn by iterating through all the BaseShape instances and caling the 'Draw' method.  The main program has no knowledge of which shape it is drawing and it treats them all the same.
    The contents of the 'BaseShape' class are irrelevant to the technique of polymorphism; BaseShape may containa lot of shared code, or it may be an interface with no shared code. Polymorphism and code-reuse are two separate aspects of inheritance.


    I had been doing OOP for nearly 10 years before I realised this distinction.



    The next question would be:
    Other than inheritance, how else can you re-use code in an OOP fashion?


    Herbie

  • User profile image
    Maddus Mattus

    When testing knowlidge you should ask questions like:

    "How would you do ...?"

    When testing experience you should ask questions like:

    "Can you give me a concrete example how you dealt with ... in project .... ?"

    If the candidate answers in plural form, "we did this", "we did that", ask him what his/her contribution was.

    I tend to ask questions like:
    "Can you explain to me how events work?"
    "What is a delegate?"

  • User profile image
    thumbtacks2

    Dr Herbie wrote:
    
    W3bbo wrote:
    
    Dr Herbie wrote:
    "What is polymorphism and why is is useful?"

    I was shocked at the number of candidates that couldn't separate polymorphism from class inheritance and I don't think I've met one yet who could explain why it was useful (other than inheriting functionality, which is not the correct answer).


    It's useful because it enables code-reuse and overriding older/irrelevant methods.

    But they're not so much separate as they are dependent. Polymorphism depends on inheritance. That's why VB6 isn't a true OOP language.



    OK, firstly polymorphism has nothing to do with code-reuse.  That's where you're confusing class inheritance with polymorphism (although you're right, polymorphism does depend on inheritance). Polymorphism can also be done through pure interface inheritance.
    Polymorphism is where different classes can be made to appear the same through casting to a base class/interface. This allows all the references to be treated the same, thereby simplifying code that uses those objects.

    The classic example is a vector drawing program there all the shapes derive from the base 'BaseShape'.  The specific instances of shapes that the user creates (Like CircleShape, TriangleShape and RectangleShape) are stored in a collection of BaseShape instances and the picture is drawn by iterating through all the BaseShape instances and caling the 'Draw' method.  The main program has no knowledge of which shape it is drawing and it treats them all the same.
    The contents of the 'BaseShape' class are irrelevant to the technique of polymorphism; BaseShape may containa lot of shared code, or it may be an interface with no shared code. Polymorphism and code-reuse are two separate aspects of inheritance.


    I had been doing OOP for nearly 10 years before I realised this distinction.
    For those of us out there who are self-taught programmers, this is a definite hurdle. For me the real difficulty was not the concepts behind polymorphism, but rather the lack of decent textbooks describing the concept. I can't count the number of textbooks that did not use any type of visual diagram when explaining these concepts...for me it would have been so much easier. 

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.