C++面试准备
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1569778/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
C++ interview preparation
提问by Light_handle
I have a Phone interview coming up next with with a company which works in financial software industry. The interview is mainly going to be in C++ and problem solving and logic. Please tell me the method of preparation for this interview. I have started skimming through Thinking in C++ and brushing up the concepts. Is there any other way I can prepare?? Please help.
我接下来要与一家从事金融软件行业的公司进行电话面试。面试主要是 C++ 和问题解决和逻辑。请告诉我这次面试的准备方法。我已经开始浏览 C++ 中的思考并复习概念。有没有其他方法可以准备??请帮忙。
Edit:
编辑:
Thank you all everyone for the advice. I just want to add that I am currently fresh out of grad school and have no previous experience. So Can you suggest some type of questions that will be asked to new grads??
谢谢大家的建议。我只想补充一点,我目前刚从研究生院毕业,之前没有任何经验。那么你能建议一些新毕业生会被问到的问题吗??
回答by Kyle Walsh
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!
换句话说:扎实基础知识并扎实您的 C++ 语法。此外,了解 STL 和 Boost 等常用库也无妨……但请确保您知道这些库为您提供了什么!最终,手机屏幕是用来剔除不会做基础的人的。证明你可以,你应该继续下一步。祝你好运!
Here's some links of interview questions to check out:
以下是一些面试问题的链接,供您查看:
- C++ Interview Questions @ DevBistro
- C++ Interview Questions @ Blogspot
- C++ Interview Questions @ FYI Center
- Steve Yegge's Five Essential Phone Screen Questions(added this in response to your edit. This isn't C++-only, but a lot of it applies to C++ and I think would be a good read in your situation).
- C++ 面试题 @ DevBistro
- C++ 面试题@Blogspot
- C++ 面试题@ FYI Center
- Steve Yegge 的五个基本电话屏幕问题(添加此内容是对您的编辑的回应。这不是仅限 C++,但其中很多都适用于 C++,我认为在您的情况下会很好阅读)。
Now, for completion's sake, some books:
现在,为了完成,一些书:
- Scott Meyers "Effective" series (Effective C++, More Effective C++, Effective STL)
- Herb Sutter's "Exceptional" series (Exceptional C++, More Exceptional C++, Exceptional C++ Style)
- The C++ Standard Libraryby Josuttis
- C++ Primerby Lippman et al
- Stroustrup'stext as a reference
- Scott Meyers“Effective”系列(Effective C++, More Effective C++, Effective STL)
- Herb Sutter 的“Exceptional”系列(Exceptional C++, More Exceptional C++, Exceptional C++ Style)
- Josuttis的 C++ 标准库
- Lippman 等人的C++ Primer
- Stroustrup 的文本作为参考
回答by Matt
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:
我采访了几位候选人,特别关注他们的 C++ 知识,如果有一个问题可以很好地将人们对 C++ 的知识置于梯度上,那就是这个:
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
- +1 用于将 delete pFoo 放在最后
- +2 用于将 pFoo 放入 std::auto_ptr
- +3 了解 RAII 是什么 - 概念,如果不是首字母缩略词
- +4 用于提及 auto_ptr 的异常安全保证
- +5 用于将 pFoo 放入 boost:shared_ptr
- +6 用于了解何时可能不会释放 shared_ptr。
- +7 谈论垃圾收集技术来修复循环引用
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.
这总是可以显示某人使用 C++ 的时间。这是一个数据点,您可以使用它来判断您在 C++ 知识规模中的位置。
Edit: I would recommend someone for hire at level 3 or above.
编辑:我会推荐某人雇用 3 级或以上。
回答by theycallmemorty
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.
在TopCoder上尝试一些练习题。
查看Marshall Cline 的 C++ 常见问题解答。这是学习一些新东西并巩固你已经知道的东西的好方法,以防决定问你一些“知识”问题而不是“解决问题”的问题。
回答by Void
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:
即使他们正在面试 C++ 职位,也并非所有问题都针对 C++。例如,在针对单个 C++ 职位的同一组面试中,我遇到了与以下所有相关的问题:
- 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.
就我而言,电话面试是筛选过程的一部分,以确定我是否可以参加在线 C/C++ 知识测试(例如通过 BrainBench)。然后在线测试结果决定了我是否会被派往现场面试,其中还包括更多的“动手”软件开发测试。
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!
HTH,祝你好运!
回答by Richard Corden
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).
即使您不知道特定问题的答案,也值得一提的是,通常您会在<您最喜欢的资源>(例如 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!
所以放松并尝试享受它!
回答by Pedro Estrada
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.
找一个知识渊博的朋友,让他们问你一些可以在白板上解决的 C++ 编程问题。很多面试都会让你在白板上解决一个问题,如果你不习惯的话,如果你不习惯,在别人面前思考并写出来可能会令人不安。
回答by Smashery
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.
除了语言的明显部分,我发现雇主会想看看你是否完全理解指针、引用、复制构造函数如何进入一切,可能是 STL,当然还有类的基础知识。
回答by Max A.
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.
阅读(或略读,取决于您需要准备多少时间)John Lakos 的“大规模 C++ 软件设计”。很有可能,你会需要它。