Author Topic: C++ interview questions that do not suck  (Read 26106 times)

0 Members and 1 Guest are viewing this topic.

Offline SirNick

  • Frequent Contributor
  • **
  • Posts: 589
Re: C++ interview questions that do not suck
« Reply #100 on: May 16, 2014, 07:50:31 pm »
Valgrind helps quite a bit with that.
 

Offline grumpydoc

  • Super Contributor
  • ***
  • Posts: 2682
  • Country: gb
Re: C++ interview questions that do not suck
« Reply #101 on: May 16, 2014, 08:20:49 pm »
Quote
Some things in C++ are just completely broken. The way libraries work is one of those. One day it will explode in your face. Try to find that segfault where memory was allocated in a DLL and released by the executable...
That's more a Windows thing than a C++ thing.

TBH I'm more of a Unix guy but have done my fair share of Windows development.

This can also lead to problems when something which should be a singleton actually has multiple copies (one per DLL)

I recall one morning chasing down an STL bug on a Windows box - a STL r-b tree traversal was crashing. Turns out the the implementation used an "empty" node to cap unused branches in the tree. Fine but it compared the address of the node with its "empty node" and ran off the ends when the comparison failed. The problem was that the tree had been allocated in one DLL and was being traversed in another.  :palm:
 

Offline ejeffrey

  • Super Contributor
  • ***
  • Posts: 1993
  • Country: us
Re: C++ interview questions that do not suck
« Reply #102 on: May 17, 2014, 06:54:42 am »
No. You can't realistically appraise someone's coding ability in a short interview. You even admit it in the third sentence where you point out that without the usual tools there are some major limitations. Programming is as much about using the tools as it is about just churning out code.

No, programing is *not* about using tools.  Tools are great, they increase our productivity, manage complexity, and do simple jobs for us, but they aren't what programming is about, and they don't make you a good or bad programmer (unless you refuse to use them).

If you need an IDE and the online help to write a simple routine of 10-20 lines with clear specifications you are never going to make it to the hard stuff.  It is like if you ask a basketball player to walk down the court and dribble and they have to constantly look at the ball.  It isn't that you want them to play blindfolded, but if they don't just *know* where the ball is like they know how to breathe, they can't possibly handle the stress of a real game.  Likewise, if I ask a programmer to write a simple routine like a binary search or finding the longest substring that is in alphabetical order I expect them to write down the answer basically as fast as they can write.  If they stand there for two minutes holding the marker and make two false starts, then they aren't going to be able to solve real problems.

Quote
You need to stop trying to rely on the interview alone to evaluate the candidate, because the interview is inadequate.

I never said or even suggested that.
 

Offline SirNick

  • Frequent Contributor
  • **
  • Posts: 589
Re: C++ interview questions that do not suck
« Reply #103 on: May 17, 2014, 07:56:36 am »
Hehe.. This makes me glad I'm not looking for a programming job.  I wrote a couple hundred lines of code on a pet project today.  Once, I saved my changes to a few files (I use the Kate text editor, not an IDE), ran my Makefile, and it compiled without any syntax errors on the first try.  I was shocked!  That... like.. never happens.

Then I realized there was an error in my Makefile.  I had changed the name of a target file, so it hadn't rebuilt all the libraries.  Fixed the Makefile, and then got a few lines of cranky syntax errors.  Ah.  All is right with the world.

So yeah.  Glad no one sees my work before I get a chance to close all the braces, add the semicolons, name the typedef'd structs, add the parameter name after the data type in the function definitions...   :-DD  (Yeah, I know, there's a difference between typos and not knowing how to write code.  But I still fear the day when a potential employer stares at a whiteboarded code snippet and asks, "so... did you mean to return a char array from sprintf?")
 

Offline linux-works

  • Super Contributor
  • ***
  • Posts: 1941
  • Country: us
    • netstuff
Re: C++ interview questions that do not suck
« Reply #104 on: May 17, 2014, 04:38:44 pm »
bottom line: as good as you think you are (as an interviewer) you will miss a large portion of people with your petty 'tests' and come to more wrong conclusions than right ones.

interviewing is an art and you either have people skills to detect 'ability' or you do not.

tests are useless.  but go on thinking they are useful.  if you only have 1 tool in your shed, I guess that's the one you'll always use.

I'm just glad that I occasionally run into interviewers who can look way beyond this test BS and get a feeling for the person and their skill set.  it happens maybe 1 out of 20 interviews but it does happen and those are the jobs that I often accept or want to accept.  the ones with 'tests' are usually the 2nd choice companies with a more 'do what you're told!' kind of culture.  blech!

go on believing you can know about a candidate's ability from some syntax on a white board or paper.  but you're wrong more often than you're right.  its a lousy way to evaluate a creative person and not everyone works or thinks the same way or even at the same speed.  faster does NOT mean better, btw!
 

Offline ejeffrey

  • Super Contributor
  • ***
  • Posts: 1993
  • Country: us
Re: C++ interview questions that do not suck
« Reply #105 on: May 18, 2014, 06:26:37 am »
tests are useless.  but go on thinking they are useful.  if you only have 1 tool in your shed, I guess that's the one you'll always use.

I didn't say that, either, and you are the person advocating restricting what you consider.  Obviously I also believe you need to find out how someone interacts with people, and how they talk about their accomplishments.

Quote
go on believing you can know about a candidate's ability from some syntax on a white board or paper.  but you're wrong more often than you're right.

I am glad you magically know that out of thin air.

Quote
its a lousy way to evaluate a creative person and not everyone works or thinks the same way or even at the same speed.  faster does NOT mean better, btw!

Creativity is an extremely valuable talent, but it is not a replacement for fundamentals.  I want to hire people who are creative, but also who are going to be successful at harnessing that creativity productively.  People who can do that are people who can do the mechanical aspects of their job "in their sleep" and save their time and energy for the hard stuff.  At the end of the day you have to produce a product, not just an idea.  You sound like someone who has no interest in actually accomplishing anything.  Also, faster is better than slower.  Speed isn't everything, but it is important.  Real projects have deadlines and requirements and consequences.  If deadlines slip and requirements aren't met, projects get canceled or you get beaten to market.  I don't know what fraction of new software projects (or any engineering project) never ship, but I know it is a lot.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: C++ interview questions that do not suck
« Reply #106 on: May 18, 2014, 06:44:00 am »
I don't know what fraction of new software projects (or any engineering project) never ship, but I know it is a lot.

Funny thing, I shipped every project I worked on and always on time, and surely that goes proudly on my CV.

Another thing to ask is about their "crunch time" experience, myself I go home and sleep at least 8 hours, I mean I will put extra time but not to the point of exhaustion like some people do. To me it's kind of a red flag, and the only reason I stay late is because of support to the team or taking other people's tasks because their plates are too full.

Granted, you might need to put extra time at the end of the project because other people were blocking your progress, but it's your fault that it got that way. I don't wanna hear how you pretty much lived at the office for the last month of a project because your tasks were not done in time. I do expect that from a lazy teen in high school and also college, but not professionally.

And I know, sometimes deadlines are not within the scope of reality, but then it's not crunch time, it's non stop for the whole project's length.
 

Offline John Coloccia

  • Super Contributor
  • ***
  • Posts: 1199
  • Country: us
Re: C++ interview questions that do not suck
« Reply #107 on: May 18, 2014, 01:35:56 pm »
Creativity is an extremely valuable talent, but it is not a replacement for fundamentals.

Exactly.  I was pretty well known for my creativity and problem solving, not just for software but also for mechanical widgets, interface design, etc.  I would have been pretty worthless if I wasn't also a damn fine engineer that could actually pull off the whacky ideas I came up with.

I think a lot of interviewers ask some pretty dumb questions, but I can truthfully say I've never feared going into an interview and being asked technical questions.  Whatever...I chew them up and spit them out.  That's part of being a pro, under pressure or not.  What are you going to do when the manager of some fab in Taiwan is screaming at you over a video conference because they're loosing $20,000 every minute they're down and it's YOUR machine that's holding everything up.  Or when it's 3:00 in the morning, and you have Air Force chief head mucky mucks, program managers, and government suits screaming at you because the very expensive flight test they just finished has NO DATA and was a complete waste of time because your stupid data recorder screwed up?

Keeping a cool head under pressure is really just part of being a pro.  Admitting when you're unsure of something, or when you're a little flustered and you need a minute to collect your thoughts, is part of being a pro too.  Bullshitting and guessing is amateur hour behavior.
 

Offline John Coloccia

  • Super Contributor
  • ***
  • Posts: 1199
  • Country: us
Re: C++ interview questions that do not suck
« Reply #108 on: May 19, 2014, 06:38:25 pm »
Yeah, I don't think anyone is expecting perfect syntax or something that's completely bug free.  Sometimes you have doubts that someone knows how to program at all, and you just want to see that they have at least a reasonable working knowledge.  This is more the case with new grads.  Some are rock stars, and others just really don't know what they're doing and it's obvious, but you still want to give them a chance to prove you wrong instead of just dismissing them.
 

Offline ehsmeng

  • Contributor
  • Posts: 35
  • Country: gb
Re: C++ interview questions that do not suck
« Reply #109 on: May 21, 2014, 12:56:40 am »
I'd try some irl examples. like, "do make this class thread safe"

The expected outcome would be something like in the POSA2 book (pattern oriented software architecture) that you have a mutex in the object and in the interface functions you have a Guard class

void Example_class::fun(int apa) {
    Guard<Thread_Mutex>guard(monitor_lock_);
    ....
}

Guard destructor is called regardless of where you get out of fun() and regardless of if it's return or an exception. So it's totally safe. If applicant has habits like this, nice code will be produced.
 

Offline linux-works

  • Super Contributor
  • ***
  • Posts: 1941
  • Country: us
    • netstuff
Re: C++ interview questions that do not suck
« Reply #110 on: May 21, 2014, 02:49:23 am »
sigh.  I just don't agree that testing is at all valid.  I've seen 'stars' ease thru interviews but can't do real world coding to save their lives.  they wrote 'school style code' which is meant to show off or impress but is hard as hell to support.  hate hate HATE when kids try to show off how much of a language they know and try to use all obscure features.

I've seen people freeze up during interviews but knew they could have handled the job.

the correlation is as random as it can be.  so I don't even care about giving anyone a coding test.  I'll talk to them and that's a far better judge of their logical thinking ability than spitting out algorithms they memorized or language syntax.

I just don't see the correlation.  a lot of people are GREAT at memorizing the classic problems and they ease thru interviews.  but... SO WHAT?  does not prove a damned thing in the real world.

 

Offline jpb

  • Super Contributor
  • ***
  • Posts: 1622
  • Country: gb
Re: C++ interview questions that do not suck
« Reply #111 on: May 21, 2014, 10:36:09 am »
I've seen 'stars' ease thru interviews but can't do real world coding to save their lives.  they wrote 'school style code' which is meant to show off or impress but is hard as hell to support.  hate hate HATE when kids try to show off how much of a language they know and try to use all obscure features.

Without entering the debate on interview questions, I agree that the best code is simple code - far less likely to introduce bugs and far easier to maintain. It also is far easier to move to different platforms and if you switch compilers you should get the same results.

Even from the speed point of view, modern compilers can optimise very well and so there is no reason to try and speed things up by writing complicated code.

I like the story of the Pope looking for an artist in the 13th/14th Century and having them submit examples of their work. The artist Giotto simply drew a perfect circle free hand and he got the commission.

http://100swallows.wordpress.com/2007/09/14/giottos-o/
 

Offline linux-works

  • Super Contributor
  • ***
  • Posts: 1941
  • Country: us
    • netstuff
Re: C++ interview questions that do not suck
« Reply #112 on: May 21, 2014, 01:47:48 pm »
some people do well on 'tests' and some do not.  if you use on the spot coding tests as any kind of serious evaluation of programming ability, you will be wrong as many times as you are right.

a lot of people can cram for an exam and fool people into thinking they know more than they really do.

and those that freeze up on stressful tests may know more than the interviewer, in fact, but are just not good at psych pressure tests.

correlation is all over the place.  therefore, I, personally, will never give a single line of coding test to anyone coming in for a programming job.  I'll talk to him, see how he thinks, see what things he was proud of, what he would have redone some other way - stuff like that.  I find it more telling to engage in chat than to put the pressure cooker thing on anyone.

I suck at interviews when there is a test; yet I've been writing code nearly all my life (I'm in early 50's) and I know I can do any coding job given me.  NOT IN 15 MINUTES - but if I'm allowed to go to my desk, use resources that we normally have during the day, yes, I can solve nearly any problems that is expected for the job I would be applying for.

just trying to warn people that you will reject a lot of good guys by this highly synthetic pressure-based test system that so many people just default to, for some reason.  honestly, I think its easier on interviewers and so they take the easy way out.  odd, since they put the candidate on the spot and yet they laze out with scripted programming questions from comp sci 101.
 

Offline retrolefty

  • Super Contributor
  • ***
  • Posts: 1606
  • Country: us
  • measurement changes behavior
Re: C++ interview questions that do not suck
« Reply #113 on: May 21, 2014, 02:34:23 pm »
  Interviewing job applicants is more an art then a skill set. While never interviewing programmers I did interview lots of electronic techs applicants at a oil refinery I worked at, both individually and as part of team interviews.

 The best method we came up with after several years was just ask a series of maybe 8 very open ended questions that forced the the applicant to show his thought process, work experiances, as well as the accuracy of his answers. Give the interview a decent period to talk and he/she will tell you why you should or should not hire him/her.

 The last effort we had to interview 30 applicants for 12 positions in a 5 day period, and that was after the HR department had narrowed down 700 applicants down to 70 resumes that they passed on to us, of which we selected 30 for the interview, we could only allocate one hour per interview. It was quite an effort but very rewarding in that after five years all but 4 hired had been promoted to front line maintenance supervisor positions and only one left the company.

 So spend a lot of time working out your open ended questions, and ask all the applicants the same questions. Make sure the question can't be answered with a simple yes or no or answered in less then 5 mins. Make them have to ask questions back to better answer the question, as that too reflects on their thought process.
 

Offline linux-works

  • Super Contributor
  • ***
  • Posts: 1941
  • Country: us
    • netstuff
Re: C++ interview questions that do not suck
« Reply #114 on: May 21, 2014, 02:51:32 pm »
agreed with lefty ;)

conversation is all that is needed.  and, the interviewers MUST be senior.  please, folks, do NOT send your 20somethings to interview candidates in who are twice their age.  its insulting, the young kids have no idea what the hell to ask and it rarely works out when you do it that way.

it sounds ageist: but its really how it works out; the younger ones try to show off and 'beat the older guy' for some kind of sadistic pleasure.  otoh, when I run into people more my own age, they always ask reasonable questions, don't immediately put you down as 'no ability' if you stutter on one question and you can see there is mutual respect going both ways, which really puts the candidate at ease and lets him be more like his real self.

I never forgot this one interview I had at a storage company.  the girl was in her early 20's.  she kept paging thru my resume saying 'wow, you were there?  and there too?  wow, you've been at a lot of places!'.  finally, she came right out and said 'gee, mister, you've been working longer than I've been alive.'

she actually said that.

and yet, this is a person who is passing judgement on me.

fwiw, I never got that job.  everyone was a 20something and they clearly didn't want any old greyhairs in the group.  can't have that!  it would ruin the party atmosphere!

(sigh...)

contrast that to my last interview: 4 phone screens, nothing really threatening or scary, all conversational, all reasonable.  I got the job.  never even went on-site (even though its local to me) but was still offered the job.  no coding tests, just some questions about the field I'm in.  I loved that experience and interestingly enough, almost everyone in my group is a grey-hair ;)
 

Offline jlmoon

  • Supporter
  • ****
  • Posts: 608
  • Country: us
  • If you fail the first time, keep trying!
Re: C++ interview questions that do not suck
« Reply #115 on: May 21, 2014, 03:31:47 pm »
Creativity is an extremely valuable talent, but it is not a replacement for fundamentals.

Exactly.  I was pretty well known for my creativity and problem solving, not just for software but also for mechanical widgets, interface design, etc.  I would have been pretty worthless if I wasn't also a damn fine engineer that could actually pull off the whacky ideas I came up with.

I think a lot of interviewers ask some pretty dumb questions, but I can truthfully say I've never feared going into an interview and being asked technical questions.  Whatever...I chew them up and spit them out.  That's part of being a pro, under pressure or not.  What are you going to do when the manager of some fab in Taiwan is screaming at you over a video conference because they're loosing $20,000 every minute they're down and it's YOUR machine that's holding everything up.  Or when it's 3:00 in the morning, and you have Air Force chief head mucky mucks, program managers, and government suits screaming at you because the very expensive flight test they just finished has NO DATA and was a complete waste of time because your stupid data recorder screwed up?

Keeping a cool head under pressure is really just part of being a pro.  Admitting when you're unsure of something, or when you're a little flustered and you need a minute to collect your thoughts, is part of being a pro too.  Bullshitting and guessing is amateur hour behavior.



So how about if we throw a little "Common Sense" into the equation as well? 
Creativity, Fundamental Understanding and Common Sense are what really make things happen in a good way!

JLM
Recharged Volt-Nut
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 3076
  • Country: us
Re: C++ interview questions that do not suck
« Reply #116 on: May 21, 2014, 08:51:11 pm »
Quote
the interviewers MUST be senior.  please, folks, do NOT send your 20somethings to interview candidates in who are twice their age.  its insulting...
Sorry, but I think you're off-base here.  The people who interview you need to be the people that you're going to work with and for.  If they're half your age, well - that's they way it is and the way it's going to be if you get hired.  And at a modern startup, the 20-something might be the star engineers...

Quote
the younger ones try to show off and 'beat the older guy' for some kind of sadistic pleasure.
Which is entirely different than the older interviewer doing the same thing to young interviewees?
(I guess this is a key point.  An interview should not be a contest; it's more like a date...  Questions need to toe the line between extracting data and intimidation.  Although I suspect the line blurs if it IS a contest between 50 candidates...)

Quote
'gee, mister, you've been working longer than I've been alive.'
she actually said that.
and yet, this is a person who is passing judgement on me.
So?  Sounds respectful enough, and perhaps she's the one that will have to work with you.  I remember I was a 20-something and interviewed <HW engineer> in the early days of <since-successful startup>; basically all the engineers at the time interviewed all engineering candidates.  This guy had retired and spent a few years as a piano tuner before reentering the industry, back before I got out of HS!  I don't think we HAD anyone who was much more than half his age.  It made for an interesting interview.  (and we hired him, and he went on to design <important and successful product>) (AND he fit in pretty well with the younger online-focused group that was there.)
 

Offline vvanders

  • Regular Contributor
  • *
  • Posts: 124
Re: C++ interview questions that do not suck
« Reply #117 on: May 22, 2014, 05:27:03 am »
agreed with lefty ;)

conversation is all that is needed.  and, the interviewers MUST be senior.  please, folks, do NOT send your 20somethings to interview candidates in who are twice their age.  its insulting, the young kids have no idea what the hell to ask and it rarely works out when you do it that way.

it sounds ageist: but its really how it works out; the younger ones try to show off and 'beat the older guy' for some kind of sadistic pleasure.  otoh, when I run into people more my own age, they always ask reasonable questions, don't immediately put you down as 'no ability' if you stutter on one question and you can see there is mutual respect going both ways, which really puts the candidate at ease and lets him be more like his real self.

I never forgot this one interview I had at a storage company.  the girl was in her early 20's.  she kept paging thru my resume saying 'wow, you were there?  and there too?  wow, you've been at a lot of places!'.  finally, she came right out and said 'gee, mister, you've been working longer than I've been alive.'

she actually said that.

and yet, this is a person who is passing judgement on me.

fwiw, I never got that job.  everyone was a 20something and they clearly didn't want any old greyhairs in the group.  can't have that!  it would ruin the party atmosphere!

(sigh...)

contrast that to my last interview: 4 phone screens, nothing really threatening or scary, all conversational, all reasonable.  I got the job.  never even went on-site (even though its local to me) but was still offered the job.  no coding tests, just some questions about the field I'm in.  I loved that experience and interestingly enough, almost everyone in my group is a grey-hair ;)
Westfw covered it pretty well but an attitude like that is extremely counter-productive and will only hurt your career.

While we have a bunch of senior people, some with decades of experience a good 50% of our developers are in their 20s. Many of them interview candidates and give a fair assessment that's in line with our senior developers. We make sure that they follow good practices and shadow experienced interviewers to understand the correct techniques.

In my 20s I was regularly stack ranked at the top of my peers, don't mistake age for years of experience. Some of us got started in software development very early and took non-traditional paths(I.E. skipped college).

We don't have tricks in our interviews or play 'beat the older guy'. We look for a solid understanding of CS fundaments, excellent problem solving skills, interpersonal communication and a grasp of common problems and solutions. Age does not discriminate on those factors and I think it's a great disservice to have a bias for either the age of the interviewer or interviewee.
 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 892
  • Country: us
Re: C++ interview questions that do not suck
« Reply #118 on: May 22, 2014, 06:25:54 am »
[...] fwiw, I never got that job.  everyone was a 20something and they clearly didn't want any old greyhairs in the group.  can't have that!  it would ruin the party atmosphere!
Well, maybe the right thing happened. It's nice to get offers and all, but working with people who don't "click" is no fun, and not so productive in an engineering environment. Plenty of other fish in the sea.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf