Some C++ technical interview tips please

Soldato
Joined
9 Jun 2006
Posts
2,642
Hi,

I am going for a job interview for a Junior Software Engineer where the primary language is C++. As I am only a final year, I don't think they will expect me to know as much as someone who has done C++ for years, but I want to be as prepared as I can.

I'm currently running through the C++ tutorials, is there anything else I could do? Are there any simple debugging exercises out there? I know one of the exercises involve being presented with a poorly written block of code and having to point out what is wrong with it.

Thanks.
 
Possibly being able to explain why virtual functions are slow, the difference between a reference and a pointer, why not to pass by value and use reference/pointer.

I only mention that because it's the last thing I did in my C++ lectures :p

That's all I can think of right now. I agree with the above, const correctness!
 
They may be more interested in your overall approach to software design and so forth rather than specific C++ knowledge.

Find out which system they work around - is it .NET? VCL? GCC?
Memory management (and how to debug memory leaks in your chosen environment)
Debugging techniques (being able to do this without a debugger shows initiative - that is things like printing values to screen / logs and that they are what you expect them to be)
Software testing (automated tests - we use DUnit, which will eventually be coupled with our automated build system - CruiseControl).

Project management (version control systems)
Documentation

Where i work, i wasn't employed on the basis of my C++ knowledge (which was none existent at the time - it was a student placement position) but of my ability to approach problem solving in the correct way and so on.

I now work there full time, so i must be doing something right.

That's all i can think of right now, but best of luck and i hope it goes well.
 
It'll probably depend on what type of work they do, if it's highly numerical stuff (which seems to be the last computing areas to be using C++ heavily) then memory management will be important.

Good luck anyhow.
 
The OO buzzwords often seem to pop up in interviews - polymorphism, encapsulation, inheritance, abstract classes - even though I don't think they're the most crucial things to know, you should be able to say what they are.

Memory management is important since it's often a source of bugs. Watch out for memory leaks in any sample code they give you. A favourite question is 'why should a destructor in a base class be virtual?'. If you have the time, many of the gotchas like this are covered well in Scott Meyer's book 'Effective C++'.

Design patterns are another thing that frequently come up. You're usually not asked about a specific one but to talk about any that you've used, so it's useful to be able to talk about one or two. This wouldn't be crucial for a junior developer but would be good to show you're at least aware of them. If you don't have time to read the Design Patterns book, it might be worth having a look on the web for an overview of a couple of patterns. Common ones are Singleton, Observer and Factory patterns.
 
The OO buzzwords often seem to pop up in interviews - polymorphism, encapsulation, inheritance, abstract classes - even though I don't think they're the most crucial things to know, you should be able to say what they are.

I wouldn't for a second say that they aren't the most crucial things to know. Like I say in my post it really depends on the focus of the company he's applying too. Polymorphism and inheritance certainly critical in certain areas IMHO.
 
Take a look at memory-management, stack versus heap. And also exception management and memory/reference leaks. Pointers and de-referencing should also be asked, and possibly static versus dynamic casting.

Junior developer can mean different things to different people. But I'd expect the basics (like the above) to be covered.
 
Slate everyone for creating, using and propagating an unwieldy and general naff language that breaks most of the things it tries to implement and then bodges them until they look like they work. Explain to them that everything they want to do can be better done in some other language, with less compromises, and then make them rebuild their entire system. That should get you the job in no time :D

Alternatively, if you have the time, at least skim both the C++ FAQ-lite found here and the C++ FQA found here.

The first is a fairly comprehensive guide to C++ in general and particularly some of the stickier areas. The second basically takes the points of the first and rips into them for no other reason than the author really hates C++, with good reason a lot of the time.

The first is probably more likely to get you the job and improve your knowledge of what is, to be fair, an 'OK' language, all things considered. The second is by far the more entertaining and sometimes the more informative read.
 
I quite like C++. Get some Boost in there with smart pointers and it's awesome. Awesomely fast and efficient too. Intellisense is a bit rubbish in Visual Studio but various plugins fix that. I really don't see the problem with C++ anyway... It's great at what it does.

As for the OP question, I'd suggest brushing up on memory management, various OO techniques (mainly polymorphism imo) and the STL.
 
Back
Top Bottom