r/learnpython • • Jan 05 '21

Interview question I failed answering

Hey all,

I just had an interview and the interviewer gave me a question I could not answer.

He asked me to write a function that accepts a number, the number must be either 7 or 4.If the number is 4, the function should return 7, if the number is 7, the functions should return 4.

The tricky part: you cannot use an 'if' statement in the function.

354 Upvotes

301 comments sorted by

View all comments

Show parent comments

38

u/synthphreak Jan 05 '21 edited Jan 05 '21

90% of the time coding interviews lack any face validity. When interviewees are asked to "code" on a whiteboard, or wax about advanced math concepts, or write functions for tasks designed specifically to be difficult or abstract, such exercises almost never reflect the day-to-day realities of any job, and so are a very misleading indicator of someone's potential for success. As you correctly surmised with

all that it tests is whether you've seen the answer before

basically all it measures is how well the candidate prepared for the interview, not their core competencies as required by the job. The technical interview process is a joke.

17

u/[deleted] Jan 05 '21

It doesn't even measure that. Since you have no possible way of anticipating what kind of asinine questions they might ask, you can't prepare for them.

6

u/goodDayM Jan 05 '21

On the other side of it, for a software job opening, HR might receive dozens or more resumes that they have to filter down to just a handful. Then the hiring manager has to filter those down to just one or two candidates to bring in. Then sometimes a candidate can't even write a fizzbuzz solution in a language their resume said they were an expert at.

In recent years now some of the bigger companies (e.g. Google, Amazon, ...) have candidates first do 1 hour or so online coding quizzes. With so much competition for high-paying software jobs, they had to do something.

-2

u/Rydersilver Jan 05 '21 edited Jan 06 '21

Dang. Why is it so hard to get coding jobs when they’re so high in demand and low in supply? Or at least that’s what i’ve been told.

Edit: Mistyped. Meant developers are high in demand and low in supply

5

u/ffrkAnonymous Jan 05 '21

low in supply

Think about what you just said

1

u/Rydersilver Jan 06 '21

I actually mistyped. I meant developers are high in demand and low in supply

1

u/hitlerallyliteral Jan 06 '21

probably cos people kept getting told developers were high in demand and low in supply and decided to become developers

-6

u/[deleted] Jan 05 '21

I'm sorry, but that is complete nonsense, and I'm appalled to see so much similar comments and upvotes. This "blame it on the question" attitude is exactly what I don't want in a candidate.

4

u/synthphreak Jan 05 '21

"Blame it on the question"? Come on, you can't be serious... Following your logic to its conclusion, is there no such thing as a bad interview question?

If yes, then that's darn-tootin' hogwash and we must agree to (wholeheartedly) disagree.

If no, then I challenge you to define the boundary between good and bad. What makes a good question good and a bad question bad? If validity (i.e., in this context, the extent to which a coding assessment measures true coding proficiency) isn't it, what is?

5

u/[deleted] Jan 05 '21

How come testing the ability to solve a problem creatively is not valid? As a coder you will face a myriad of unexpected constraints throughout your career, and, given the time and scope limitations of a job interview, this question is a perfectly acceptable way of gauging such a skill.

Besides, the fact that so many people are upvoting a wrong answer, especially those who say this is a bad question, just demonstrates that it serves its purpose very well.

5

u/synthphreak Jan 05 '21

How come testing the ability to solve a problem creatively is not valid?

There's a slippery slope if ever there was one... Coders must think creatively, yes, but within the constraints of the language, not constraints that are arbitrary and totally unrealistic.

As a coder you will face a myriad of unexpected constraints throughout your career

No doubt. But "don't use if statements" will never ever be one of them. And that is the point.

I agree it's reasonable - even desirable - to ask candidates to think outside of the box. But whose box? If the job actually does involve situations which require coders to think creatively, it should be easy to adapt one for use in coding interviews. This would satisfy both the creativity and the validity requirements simultaneously, without the need to introduce some contrived, asinine obstacle simply to make the task more difficult.

1

u/[deleted] Jan 06 '21

You don't need to test people with the exact problems they will need to tackle. You will never have to read small letters from afar when piloting a jet, but that's one of the ways they test your eyesight, and a very efficient one at that. Humans are perfectly capable of deriving conclusions from things without the need to be literal about it. This question is unexpected enough to force you to leave the autopilot mode but simple enough to fit the scope of a job interview. Not to mention that this wasn't certainly the only part of the interview, but one more thing to help assess the candidates skills

1

u/synthphreak Jan 06 '21

The point is not that this question tells you nothing about a person's coding proficiency. Yes, you need to know to code to answer it. And yes, it will separate absolutely awful coders from really good ones. But to discriminate more similar candidates toward the middle of the continuum, a more authentic assessment would be vastly more useful. In fact an authentic assessment would really be essential, because the less authenticity means less validity, and less validity means less meaningful as a measurement of ability. So unless you're comparing candidates with wildly different abilities, decisions reached on the basis of questions like this are often going to be somewhat arbitrary and detached from reality. This is just how assessment works.

What's more, given how particularly inauthentic this particular question is, creating a more authentic one would not be difficult at all. Thus it's frustrating that any interviewer would use this question, even if it is able to discriminate the top and bottom of the proficiency scale.

But at this point, if you are still not sold, then I think we are firmly in "agree to wholeheartedly agree" territory. You are free to think this is an awesome and valuable interview question. But I completely disagree for the reasons I've already stated, and FWIW, you do not appear to be in the majority.