We're having some debate at my company about whether the technical questions I ask during an interview are too hard or are not effective at determining a candidate's qualifications, so I'd like to get some feedback from the EE collective. Sorry for the length.
The candidates we've been interviewing recently are for a senior-level (10+ years experience) developer, who will be coding primarily in c++.
==========================
=====
1) What is polymorphism? Use an example to define it if you like.
2) What is a copy constructor? Why are they important?
3) What is the difference between a modal dialog and a modeless dialog?
4) What is the difference between the PostMessage() and SendMessage() api's?
5) What is wrong with this piece of code?
class A {
private:
int x, y;
public:
A():y(0), x(y)
{
}
}
After they figure that out, I ask: what are the advantages of using member-list initialization? When do you *have* to use it?
6) What does the following code output?
class A {
public:
A() { printf("constructor A\n"); }
~A() { printf("destructor A\n"); }
};
class B: public A {
public:
B() { printf("constructor B\n"); }
~B() { printf("destructor B\n"); }
};
class C: public B {
public:
C() { printf("constructor C\n"); }
~C() { printf("destructor C\n"); }
};
void main()
{
C myobj;
}
void main()
{
A* myobj = new C;
delete myobj;
}
(this can lead to a nice discussion about why destructors need to be virtual).
7) What are design patterns?
(If they don't know I give a one-sentence explanation).
What is a Singleton?
(If they don't know I describe what it is).
Go up to the white board and implement one.
(This is the most difficult part, and I will ask leading questions and give them hints to get them to the solution. Mostly I'm trying to get a sense of how their thought processes work, see if they can ask intelligent questions, admit when they are stuck or don't know something, etc).
After they get a reasonable solution, I ask:
Is your implementation thread-safe? How do you make it thread-safe? How can you structure the code so that you only have to do the synchronization once ever?
If there is time, we talk about deletion strategies for cleaning up the singleton when the program ends.
==========================
The goal of course is to make sure the candidate has some level of c++ expertise, can think on their feet, can work through a problem, etc.
I welcome all opinions about whether these questions are reasonable and effective at determining whether someone is a good programmer.
Points will be split amongst all who respond.
Thanks.
Start Free Trial