jeudi 11 juin 2009

C++ interview questions/inspiration - part 4

One, two, three

This is part 4. You can read the first three here :

Part 1
Part 2
Part 3


This fourth question is the bonus.


I didn't get to ask it very often. There is never enough time in an interview, that's why I prefer to have a small number of good questions. The questions need to be orthogonal and good predictors. This fourth question is not a very good predictor. Almost every candidate will flunk it. That's why I ask it last. Since the other three questions are good predictors, I often abandon before the fourth question.

Having questions that are good at detecting bad candidates is not enough. Interviewers often forget that interviews work both ways. Candidates judge companies too. It's very frustrating to leave an interview without having been asked at least one difficult question. If the candidate can't answer the difficult question, it's no big deal. If he succeeds, then you have learned something very important : it's a keeper.

The statement

Write a smart pointer. In the general case, it shall only keep a reference to the pointed object. If the pointed object's class inherits from IRefCountable, the smart pointer shall call the AddRef and Release member functions.

In case of silence

If there is an uncomfortable silence, ask more specific questions. What is a smart pointer? Do you know C++ templates? Have you ever used boost? Boost::mpl?

Runtime vs compile-time

Most candidates will try to use dynamic_cast. Does he know what are the limits of RTTI? What if the pointed object is an int?

1 commentaire:

roradinho a dit...

Hi

I read this post two times.

I like it so much, please try to keep posting.

Let me introduce other material that may be good for our community.

Source: Interview questions and answers

Best regards
Henry