什么样的面试问题适合于c ++手机屏幕? [英] What kinds of interview questions are appropriate for a c++ phone screen?

查看:101
本文介绍了什么样的面试问题适合于c ++手机屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很高兴得到人们的想法。我经常进行面试,并在我的职业生涯中有足够的反思,我注意到了一系列广泛的问题。我做了这个c ++具体,但值得注意的是,我有人问我的算法复杂性问题通过电话,我甚至不意味着什么是哈希查找的复杂性与二叉树,我的意思更像是分析问题,例如想象有4只大黄蜂,每只嗡嗡的bla bla bla。



现在我个人更喜欢保持手机屏幕更具体,白板的抽象问题。



我知道有另一个类似的线程,但坦率地说,似乎是这样的完全错过了这是关于手机屏幕,而不是面对面的采访。

解决方案

我会问资源/内存管理,因为它是C ++中的一个重要主题,并且它不需要具体代码。只是草拟一个简单的假设场景,并问他们如何确保一些重要的资源被释放,即使面对错误/异常。说他们正在开发一个网络应用程序,他们如何确保我们正确关闭我们的套接字?当然,正确的答案是将它包装在一个RAII对象中,但不要直接问他们(很容易googleRAII,而上面的问题如何确保资源被正确释放实际上显示你是否或者他们不知道适当的技术如果他们回答包装一切在try / catch,他们可能有一个问题,这很好地与堆和堆栈之间的差异的问题。



你可能能够提出一些关于异常安全的简单问题,这不需要任何真正的代码。一般来说,我会说一个讨论所有的C ++成语可能是一个好的



查看他们是否知道智能指针(最好是通过给予他们的情况,智能指针被要求,并看看他们如何解决这个问题),也许templates / metaprogrammin(在后一种情况下,可能只是找出他们是否知道这是可能的,而不是要求他们实际元程序在电话上)



您可能还想询问一些未定义行为的一些常见区域(执行 a = b ++ + b ++??),或者分配10个元素的数组,并向数组指针添加10或11,并询问每种情况下的结果,给你一个过去的结束指针,+ = 11未定义)。或者给他们一个场景,他们需要复制很多对象,并问他们怎么做的(普通的for循环复制每个元素,memcpy或std :: copy是明显的答案注意memcpy的注意事项,它对于非POD对象是不安全的)



或者问一下他们的编码风格。他们对迭代器有什么感觉?他们喜欢朴素的旧for循环吗?他们知道如何使用std :: for_each或std :: transform?



编辑:
看到 a = b ++ + b ++ (答案是未定义的行为,btw)建议特别生成了很多评论。也许人们读得太多了。因为OP说他喜欢问具体的(不抽象,容易解释/回答/通过电话讨论)的问题,这将揭示一点关于受访者的C ++技能,这是一个简单(是的,也许nitpicky)的例子。其背后的原因是,1)它有一个直观的意义,这是错误的,和2)你必须有一定水平的C ++的经验之前,你才意识到这一点。当然3),它很短,很容易通过电话询问。它不需要任何人写代码。不,它不会揭示候选人是否是一个伟大的程序员,但正如我理解的问题,这不是目标。如果有人错误,它并不意味着什么,但如果他们得到正确,你可以相当确定他们知道一点C ++。但如果你再次阅读我的答案,你会看到这只是一个我认为应该代表的问题的一个简单的例子。 C ++充满了未定义的行为,即使在看起来完全无害和直观的代码中。要求候选人识别某些实例可能是有用的,无论是在同一个表达式中修改相同的变量两次还是不同的。


Curious to get people's thoughts. I conduct frequent interviews, and have had enough in my career to reflect on them, and I've noticed a broad array of questions. I made this c++ specific, but it's worth noting that I have had people ask me algorithmic complexity questions over the phone, and I don't even mean what is the complexity of a hash lookup vs. a binary tree, I mean more like analytical problems, such as "imagine there are 4 bumble bees, each buzzing bla bla bla."

Now personally I prefer to keep phone screens a little more concrete, and leave the abstract questions for the white board. So when conducting c++ phone interviews, what kind of topics do you cover, especially for Sr. developers?

I know there is another thread similar to this, but frankly it seems to completely have missed the point that this is about phone screens, not interviews that are face to face. Plus this is more c++ specific.

解决方案

I'd ask about resource/memory management, because it's an important subject in C++, and it doesn't require concrete code. Just sketch a simple hypothetical scenario, and ask how they'd ensure some vital resource gets freed even in the face of errors/exceptions. Say they're developing a network app, how do they ensure that we close our sockets properly? Of course the proper answer would be to wrap it in a RAII object, but don't ask them that directly (it's easy to google "RAII", while the above question "how would you ensure resources get released properly" actually shows you whether or not they know the appropriate techniques. If they answer "wrap everything in try/catch", they might have a problem. And this ties in nicely with questions about the differences between heap and stack.

You might be able to come up with some simple question about exception safety too, which doesn't require any real code. In general, I'd say a discussion of all the various C++ idioms might be a good idea, because many of them don't require much actual code, but are still vital language-specific concepts.

See if they know about smart pointers (again preferably by giving them a situation where smart pointers are called for, and see how they would solve the problem), and maybe templates/metaprogrammin (in the latter case, probably just find out if they're aware that it's possible ,rather than requiring them to code actual metaprograms on the phone)

You might also want to ask about some common areas of undefined behavior (what are the values of a and b after executing a = b++ + b++??), or allocate an array of 10 elements, and add 10 or 11 to the array pointer, and ask what the result is in each case (+=10 is legal, gives you a past-the-end pointer, +=11 is undefined). Or give them a scenario where they need to copy a lot of objects, and ask how they'd do that (plain for-loop copying each element at a time, memcpy or std::copy are obvious answers. Note the caveats with memcpy, that it's not safe for non-POD objects)

Or ask about their coding style in general. How do they feel about iterators? Do they prefer plain old for-loops? Do they know how to use std::for_each or std::transform?

Edit: Seems the a = b++ + b++ (the answer is undefined behavior, btw) suggestion in particular generated a lot of comments. Perhaps people read too much into it. As the OP said he preferred to ask concrete (not abstract, and easy to explain/answer/discuss over the phone) questions, that'd reveal a bit about the interviewee's C++ skills, and this is a simple (and yes, perhaps nitpicky) example of that. The reasoning behind it is that 1) it has an intuitive meaning, which is wrong, and 2) you have to have a certain level of experience with C++ before you realize this. And of course 3), it's short and easy to ask over the phone. It doesn't require anyone to write code down. No, it won't reveal whether the candidate is a "great programmer", but as I understood the question, that wasn't the goal either. If someone gets it wrong, it doesn't mean much at all, but if they get it right, you can be fairly sure that they know a bit of C++. But if you read my answer again, you'll see that it was just a quick example of a category of questions I thought should be represented. C++ is full of undefined behavior, even in code that looks completely harmless and intuitive. Asking the candidate to recognize some instance of this may be useful, whether it's the "modify the same variable twice in the same expression" example above, or something different.

这篇关于什么样的面试问题适合于c ++手机屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆