I once interviewed for a role at Bank of America. The interview process started off well enough, the main guy asked some general questions about career history and future goals. Then it was off to the technical interviewers. The first guy was fine. Asked appropriate questions which he clearly understood the answers to.

The next guy up, however, was what I like to call an aggressive moron. After looking at my resume, he said I see you listed C++. To which I said, yes I have about 7 years of experience in it but I've mostly been using python for the past few years so I might be a bit rusty. Great he said, can you write me a function that returns an array?

After I finished he looked at my code, grinned and said that won't work. Your variable is out of scope.

(For non C programmers, returning a local variable that's not passable by value doesn't work because the local var is destroyed once the function exits. Thus I did what you're supposed to do, allocate the memory manually and then returned a pointer to it)

After a quick double take and verifying that my code did work, I asked, um can you explain why that doesn't work as I'm pretty sure it does.

The guy then attempted to explain the concept of variable scope to me. After he finished I said, yes which is why I allocated the memory manually using the new operator, which persists after the function exits.

Einstein then stared really hard at my code for maybe 10 to 15 seconds. Then finally looked up said ok fine, but now you have a memory leak so your code is still wrong.

Considering a memory leak is by definition an application level bug, I just said fine, any more questions?

  • 1
    So hard to interview people technically without accidentally, or just stupidly, turning it into a sort of "trivia" about trivial info that someone would easily address IRL... but the interviewer feels it indicates so much more, if only because at one time it inconvenienced them once.

    Humans really suck at that process.
  • 2
    I think he might have been expecting you to return one of the movable STL containers which would be the C++ way to do it honestly, but he could have at least bothered to think through the code you gave him. He seems like he's just looking for ways to trip people up and gets excited when he thinks he sees a mistake.
  • 0
    You're lucky you didn't get that job. It's fucking awful.
  • 0
    @SortOfTested Haha. Well good for me then :-)
Add Comment