Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How would you fare in an interview?
Index -> General Programming
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
wtd




PostPosted: Sat Mar 03, 2007 8:59 pm   Post subject: How would you fare in an interview?

A task that might be posed in an interview:

Write a function which prints the numbers from 0 to 100. But, for each multiple of 3, it prints "Fizz" instead of the number. For each multiple of 5, it prints "Buzz" instead of the number and for multiples of both 3 and 5, it prints "FizzBuzz" instead of the number.

Don't post code for this, just write it out on paper. Pick whatever language you please, but no psuedocode.

Can you do it in a few minutes?

Congrats! Surprisingly few programmers applying for jobs even at the senior level can manage this.

Now, test your code. Did it produce the correct output?

Even fewer programmers get the function right if they can write it at all.
Sponsor
Sponsor
Sponsor
sponsor
md




PostPosted: Sat Mar 03, 2007 9:11 pm   Post subject: RE:How would you fare in an interview?

Heh, it really is surprising how many people can't actually do this.
neufelni




PostPosted: Sat Mar 03, 2007 9:25 pm   Post subject: Re: How would you fare in an interview?

I tried it, and sadly, I was unsuccessful. I had a few little mistakes. I used Python, and forgot the () in my function declaration and the function call. Also didn't make it so that it didn't count 0 as a multiple of 3 or 5.
wtd




PostPosted: Sat Mar 03, 2007 9:31 pm   Post subject: Re: How would you fare in an interview?

neufelni @ Sun Mar 04, 2007 10:25 am wrote:
Also didn't make it so that it didn't count 0 as a multiple of 3 or 5.


This was not required.
bugzpodder




PostPosted: Sat Mar 03, 2007 9:32 pm   Post subject: RE:How would you fare in an interview?

I read about that, and I don't believe it. Anyone who has more than 1 year of programming experience should have NO problems doing this. After all, it just consists of a loop, an if statement and output.
Clayton




PostPosted: Sat Mar 03, 2007 10:38 pm   Post subject: Re: How would you fare in an interview?

bugz, the keyword there is *should*. Sure anyone with half a brain should be able to write that program, but without a keyboard and a monitor in front of them, many people seem helpless. Then they also have to worry about stupid little mistakes because they have no debugger to tell them they screwed up in their code. It's more of a mental thing if you ask me.
bugzpodder




PostPosted: Sat Mar 03, 2007 11:11 pm   Post subject: RE:How would you fare in an interview?

thats not the point. the interviewer also has no debugger so he/she can't compile your code mentally. If he catches a mistake you didn't, just fix it. phasing out on paper is a different issue, the original post on a blog implies that many people can't do this period (do a search on fizzbuzz) which i think is a ridiculous claim.
Tony




PostPosted: Sun Mar 04, 2007 12:22 am   Post subject: RE:How would you fare in an interview?

I read the blog post, 199 of 200 seems to be an exauguration. Although writing code on a blank sheet of paper, with interviewing developers watching the clock is intimidating... I can see myself making some mistake, if the language choice is not mine.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
bugzpodder




PostPosted: Sun Mar 04, 2007 1:18 am   Post subject: RE:How would you fare in an interview?

they should be asking people to write a variant of binary search (returns the first position if the item is not in the list). i think thats a pretty good interview question.
Martin




PostPosted: Sun Mar 04, 2007 2:56 pm   Post subject: RE:How would you fare in an interview?

Easy!

code:

cout << "FizzBuzz\n1\n2\nFizz\n4\nBuzz\n...";


I thought about making a program to make this program, but I thought that'd be overkill.
wtd




PostPosted: Sun Mar 04, 2007 3:11 pm   Post subject: RE:How would you fare in an interview?

And what does everyone miss?

They fail to generalize the solution. There are all kinds of hard-coded values in the solutions. Wink
bugzpodder




PostPosted: Sun Mar 04, 2007 9:06 pm   Post subject: Re: How would you fare in an interview?

yeah for the people who says they google employees. just take my example, unless i disclose my online id is bugzpodder, there is no way in hell they are going to find anything about me on google. and a lot of people have common enough names for this not to happen. in fact, i tend to google my interviewers and often i find nothing. what makes he think he can find (correctly) his candidates?
octopi




PostPosted: Mon Mar 05, 2007 12:12 am   Post subject: Re: How would you fare in an interview?

I don't know how people could do that bad, I just wrote 6.5kb of php code (using notepad) off the top of my head, without testing it, when I did test it, I was missing a single semicolon that was my only mistake (and it was mostly just a speed of typing error, not that I thought I didn't need it), and this program I made was more complicated then the one required in the example interview (deals with mysql etc..)

I really don't see how that many people could get it wrong...
klopyrev




PostPosted: Mon Mar 05, 2007 2:20 am   Post subject: Re: How would you fare in an interview?

What an odd question. Didn't take me too long. Only mistake I made was that I didn't have a newline character at the end of my main method and my compiler complained. Why does it do that? (strange). I remember my brother, who now works at Google(Razz), was researching interview questions because he had to interview people at the company. He asked me a sample question, and it wasn't as easy as that. For the one he asked me, you actually had to use logic. He even asked me to tell him a few questions from Olympiads that he might use. I don't believe interviews should be that easy. I don't believe they are that easy. Then again, I guess it really depends on the position you are applying for and the company you are applying at.

KL
Martin




PostPosted: Mon Mar 05, 2007 3:36 am   Post subject: RE:How would you fare in an interview?

You have to weed out people in different levels. I've been asked some weird interview questions.

The "reverse a string in place" question is pretty common, as well as the "reverse a linked list."

Joel from Joel on Software has a good essay on interview questions here
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 23 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: