C++ interview preparation [closed]

大城市里の小女人 提交于 2019-12-02 13:47:05

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

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

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

Now, for completion's sake, some books:

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

Fix this memory leak as robustly 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 long someone had been working with C++. This is one datapoint you can use to tell where you are in the scale of C++ knowledge.

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

  • Try some practice problems on TopCoder.

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

Even if they're interviewing for a C++ position not all questions may be specific to C++. For example, I've been hit with questions related to the following all in the same set of 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 my case, the phone interview was part of a screening process to determine if I could take an online C/C++ knowledge test (e.g. through BrainBench). The online test results then determined if I would be flown out for on-site interviews, which also included more "hands-on" software development tests.

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

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

HTH and good luck!

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

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

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

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

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

So relax and try to enjoy it!

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!