Is this this interview question fair? (IT Based)
Is this this interview question fair? (IT Based)
Author
Discussion

BMWBen

Original Poster:

4,906 posts

229 months

Tuesday 1st March 2011
quotequote all
I've asked this question of several people so far, and nobody has come close to a decent response. So I'm wondering if my question is out of whack in some way...

It's for a technical IT role, and the candidates say they have experience of scripting/programming in various quantities.

The question is:

The fibonacci sequence of numbers: 1,1,2,3,5,8 etc
Can you write a function (in pseudocode, your favorite language, whatever) that will give me the n'th number in the sequence.

Would you expect someone to be able to answer that in an interview situation?
The idea would then be that we would have a discussion about their solution, but it's never got that far!

illmonkey

19,788 posts

226 months

Tuesday 1st March 2011
quotequote all
I once went for a junior web site design job (wanted to see if I could get a basic job to start from the beginning). I was asked to write out (pen and paper) a whole website in the interview. A JUNIOR, writing a WHOLE site in an INTERVIEW on PAPER.

I'm fairly good at it now, and still couldn't do it.

Seems a bit harsh to ask them to do it in an interview, especially if it'll make it last longer than a normal interview. Like it or not, they possibly have a job already. Maybe set them an assignment to email into you?

plasticpig

12,932 posts

253 months

Tuesday 1st March 2011
quotequote all
Totally fair IMO. It's not a particularly difficult function to write.

JFReturns

3,820 posts

199 months

Tuesday 1st March 2011
quotequote all
I think it is reasonable, but I would give detail on what a Fibonacci number is. Not knowing does not mean they are bad programmers.

bigandclever

14,318 posts

266 months

Tuesday 1st March 2011
quotequote all
That's a piece of piss, especially if you let them do it in pseudo-code.

TooLateForAName

4,924 posts

212 months

Tuesday 1st March 2011
quotequote all
Is the problem that they don't know what the Fibonacci series is?

bigandclever

14,318 posts

266 months

Tuesday 1st March 2011
quotequote all
anonymous said:
[redacted]
And if they don't know, they should ask - nothing worse than a coder just cracking on without full comprehension of the question being asked.

Landlord

12,689 posts

285 months

Tuesday 1st March 2011
quotequote all
Probably the easiest answer would be to do it in a loop. Though I'd have thought it pretty bloody obvious that you could derive the formula as;

Fn = (((1+SQRT(5))^n) - (1-SQRT(5))^n))/2^n*SQRT(5)

:cough:
wink

Though to answer your question, I think it's an entirely valid question. Depends on the intended/required experience of the developer though.

Ultuous

2,291 posts

219 months

Tuesday 1st March 2011
quotequote all
I'm not even in IT (did it at A Level many moons ago, but have never performed in a developed role) and reckon I could answer that in Pseudoode/ BASIC/ Pascal without a problem!

Piersman2

6,676 posts

227 months

Tuesday 1st March 2011
quotequote all
This reminded me of my very first job interview when I was about 18/19 and just out of college.

The guy asked me to work out what the result would be through a diagram of several layers of logic gates, which seemed fairly simple to me.

After I started work there it would appear I was the only person who even had a crack at it let alone got it right.

What I'm saying of course, is that you should persevere and wait until someone comes along that can have a go at it... and they'll likely be very, very special - like me! smilesmilesmile


944fan

4,962 posts

213 months

Tuesday 1st March 2011
quotequote all
Often these questions are designed to see how you cope under pressure. In a relaxing atmosphere that question isn't hard for even non programmers but in the stress of an interview it is more difficult. Take you time and think about the question and then give your answer. Even if you don't get it totally right it is more about hwo you approach it.

It is a better question that the 'What are you weaknesses?' I had always heard that you should make a strength sound like a weakness, like 'I work too hard' etc. I was asked that quesiton in an interview, answered a long those lines and the interviewer started to moan how he hates it when people make a strength sound like a weakness. I wanted to say don't ask such stupid fking questions then. But I didn't, nor did I get the job. Sorry I am rambling now.

Stevenj214

4,941 posts

256 months

Tuesday 1st March 2011
quotequote all
BMWBen said:
I've asked this question of several people so far, and nobody has come close to a decent response. So I'm wondering if my question is out of whack in some way...

It's for a technical IT role, and the candidates say they have experience of scripting/programming in various quantities.

The question is:

The fibonacci sequence of numbers: 1,1,2,3,5,8 etc
Can you write a function (in pseudocode, your favorite language, whatever) that will give me the n'th number in the sequence.

Would you expect someone to be able to answer that in an interview situation?
The idea would then be that we would have a discussion about their solution, but it's never got that far!
PRINT "What number in the sequence would you like?"
INPUT = "input"
COUNT = 1
a = 0
b = 1
IF COUNT = INPUT
OUTPUT = a+b
PRINT OUTPUT
ELSE
LET a = b
LET b = OUTPUT
COUNT = COUNT + 1

Then whatever code makes the if statement loop until count=input

That would be my answer-ish.

My qualifications?

BASIC @ 14 years old
MATLAB @ 17


EDIT: My code has messed up the sequence, but the general idea is there...

Edited by Stevenj214 on Tuesday 1st March 13:35

Landlord

12,689 posts

285 months

Tuesday 1st March 2011
quotequote all
Would this be an OK answer?

1, Open a browser
2, Navigate to www.google.co.uk
3, Enter "Get fibonacci numbers"
4, Ctrl + C
5, Ctrl + V

DanL

6,586 posts

293 months

Tuesday 1st March 2011
quotequote all
BMWBen said:
The fibonacci sequence of numbers: 1,1,2,3,5,8 etc
Can you write a function (in pseudocode, your favorite language, whatever) that will give me the n'th number in the sequence.
How close is this to an activity that will tell you something useful about the person's ability to do the role you're recruiting for?

The answer to that should tell you if it's a fair question or not. I'm a "fair" Java programmer and engineering graduate before that (a few years ago now!), so should be reasonably au fait with maths. I can't remember what the Fibonacci formula is, as who uses it day to day?

In your example I can work out how you get the next number in the sequence just by looking at the sequence and thinking about it, but people may not be thinking too clearly in an interview - I suspect this is why they're failing.

So - are you looking for someone who can tell you from the sequence of numbers that the formula is F_n = F_{n-1} + F_{n-2}, someone who can take that information and produce a nice bit of code to work it out, or is someone who can do both required for the role you're trying to fill?

BMWBen

Original Poster:

4,906 posts

229 months

Tuesday 1st March 2011
quotequote all
TooLateForAName said:
Is the problem that they don't know what the Fibonacci series is?
Can't be, I write out the sequence first and explain it as a matter of course. Glad to know it's them and not me....

I think it's a really good question, because you can solve it using a traditional imperative method very simply, but if you're a brainiac you might go for the elegant recursive solution to show off. You can then lead into a discussion on the different approaches and what the implications are.

We had a guy this morning who managed to write a function which would double a number and that was it. He had a degree in software development.

Landlord

12,689 posts

285 months

Tuesday 1st March 2011
quotequote all
DanL said:
I can't remember what the Fibonacci formula is, as who uses it day to day?
Forex traders.

BMWBen

Original Poster:

4,906 posts

229 months

Tuesday 1st March 2011
quotequote all
DanL said:
ow close is this to an activity that will tell you something useful about the person's ability to do the role you're recruiting for?

The answer to that should tell you if it's a fair question or not. I'm a "fair" Java programmer and engineering graduate before that (a few years ago now!), so should be reasonably au fait with maths. I can't remember what the Fibonacci formula is, as who uses it day to day?

In your example I can work out how you get the next number in the sequence just by looking at the sequence and thinking about it, but people may not be thinking too clearly in an interview - I suspect this is why they're failing.

So - are you looking for someone who can tell you from the sequence of numbers that the formula is F_n = F_{n-1} + F_{n-2}, someone who can take that information and produce a nice bit of code to work it out, or is someone who can do both required for the role you're trying to fill?
Understood - the actual problem itself isn't particularly relevant, which is why I explain how the sequence works first in case they haven't come across it before. My view is however, that if you say you can program, you should be able to solve it.

BMWBen

Original Poster:

4,906 posts

229 months

Tuesday 1st March 2011
quotequote all
Landlord said:
Would this be an OK answer?

1, Open a browser
2, Navigate to www.google.co.uk
3, Enter "Get fibonacci numbers"
4, Ctrl + C
5, Ctrl + V
That is worryingly close to one of the other major skills that is required in this job biggrin

Stevenj214

4,941 posts

256 months

Tuesday 1st March 2011
quotequote all
If you are really interested, you could ask a local university to set the problem to their 4th year computer science students. You may even find some promising candidates.

tomash

177 posts

308 months

Tuesday 1st March 2011
quotequote all
Its a perfeclty fair question IMO.

I used to ask people to write an Roman to Arabic number converter and all the test cases!