Is this this interview question fair? (IT Based)
Discussion
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!
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!
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?
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?
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:

Though to answer your question, I think it's an entirely valid question. Depends on the intended/required experience of the developer though.
Fn = (((1+SQRT(5))^n) - (1-SQRT(5))^n))/2^n*SQRT(5)
:cough:

Though to answer your question, I think it's an entirely valid question. Depends on the intended/required experience of the developer though.
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!


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!



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 f
king questions then. But I didn't, nor did I get the job. Sorry I am rambling now.
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 f
king questions then. But I didn't, nor did I get the job. Sorry I am rambling now.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?"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!
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
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
1, Open a browser
2, Navigate to www.google.co.uk
3, Enter "Get fibonacci numbers"
4, Ctrl + C
5, Ctrl + V
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?Can you write a function (in pseudocode, your favorite language, whatever) that will give me the n'th number in the sequence.
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?
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.
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. 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?
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 1, Open a browser
2, Navigate to www.google.co.uk
3, Enter "Get fibonacci numbers"
4, Ctrl + C
5, Ctrl + V

Gassing Station | Jobs & Employment Matters | Top of Page | What's New | My Stuff


