[ACCEPTED]-C++ interview preparation-logic

Accepted answer
Score: 57

Make sure you know your basic data structures 14 and algorithms. You're more likely to be 13 asked about that stuff than something higher 12 up the food chain. Those are usually saved 11 for the in-person interview.

Put another 10 way: be solid with the fundamentals and 9 solid with your C++ syntax. Also, knowledge 8 of common libraries like STL and Boost couldn't 7 hurt...but be sure you know what those libraries 6 give you! In the end phone screens are there 5 to cull out people who can't do the basics. Prove 4 you can and you should move on to the next 3 step. Good luck!

Here's some links of interview 2 questions to check out:

Now, for completion's 1 sake, some books:

Score: 55

I have interviewed several candidates specifically 10 focusing on their C++ knowledge, and if 9 there was one question that worked well 8 to put peoples' knowledge of C++ on a gradient, it 7 was this one:

Fix this memory leak as robustly 6 as you can:

void doSomething()
{
Foo* pFoo = new Foo();
[do some stuff]
}
  • +1 for putting delete pFoo at the end
  • +2 for putting pFoo in a std::auto_ptr
  • +3 for knowing what RAII is - the concept, if not the acronym
  • +4 for mentioning exception-safety guarantees of the auto_ptr
  • +5 for putting pFoo in a boost:shared_ptr
  • +6 for knowing when a shared_ptr might not be freed.
  • +7 for talking about garbage collection techniques to fix circular references

This always worked to show how 5 long someone had been working with C++. This 4 is one datapoint you can use to tell where 3 you are in the scale of C++ knowledge.

Edit: I 2 would recommend someone for hire at level 1 3 or above.

Score: 8
  • Try some practice problems on TopCoder.

  • Check out 4 Marshall Cline's C++ FAQ. Its a good way to learn some new stuff 3 and bone up on the things you already know 2 in case the decide to ask you some 'knowledge' questions 1 as opposed to 'problem solving' questions.

Score: 4

Grab a knowledgeable friend and have them 7 ask you some C++ programming problems that 6 you can solve on a whiteboard. A lot of 5 interviews will have you solve a problem 4 on a whiteboard, and it can be disconcerting 3 to think on your feet and write things out 2 in front of someone if you are not used 1 to it.

Score: 3

Even if they're interviewing for a C++ position 21 not all questions may be specific to C++. For 20 example, I've been hit with questions related 19 to the following all in the same set of 18 interviews for a single C++ position:

  • Algorithmic complexity of well known sort and search algorithms
  • Multithreaded programming
  • Multiprocess programming
  • Sockets programming
  • Software development philosophy / approach
  • Software test and validation philosophy / approach
  • Debugging
  • Benchmarking
  • Dynamic and static analysis of code (e.g. run-time memory leak detection vs compile-time)

In 17 my case, the phone interview was part of 16 a screening process to determine if I could 15 take an online C/C++ knowledge test (e.g. through 14 BrainBench). The online test results then 13 determined if I would be flown out for on-site 12 interviews, which also included more "hands-on" software 11 development tests.

YMMV. A lot depends on 10 what you claim on your resume, as well.

Interviewers 9 often try to help you by giving you hints 8 so that they can see if you can arrive at 7 the answer they're looking for. Besides 6 gauging your knowledge, they also want to 5 see how you think. Occassionally you might 4 get a crummy interviewer that is neither 3 helpful nor positive. The key is to be 2 confident in your abilities and be truthful.

HTH 1 and good luck!

Score: 3

Something which I am starting to believe 12 is that there is sometimes a clear divide 11 between candidates that enjoy programming 10 as a hobby versus those who consider it 9 "just a day job".

Even if you don't know 8 the answer to a specific question it is 7 worth mentioning that normally you'd look 6 up the answer on < your favourite resource 5 > (eg. StackOverflow).

Based on your experience 4 I don't think the interviewer will expect 3 that you'll get every question right. They're 2 most likely trying to decide if you've got 1 "potential".

So relax and try to enjoy it!

Score: 2

Besides the obvious parts of the language, I've 4 found that employers will want to see if 3 you fully understand pointers, references, how 2 copy-constructors come into everything, probably 1 STL, and of course the basics of classes.

Score: 1

Read (or skim, depending on how much time 2 you have to prepare) "Large-Scale C++ Software Design" by John 1 Lakos. Chances are, you will need it.

More Related questions