Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
What're some of the good interview questions that you've had/heard?

One of the better ones I've heard recently is "how many ways can you build a function that returns 1 if given 0 and 0 if given 1?"

Eric

Eric Avatar



1,442


November 2005
There're a ton of ways. That's a shitty question.

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
The actual point is to see how creative they can be. :P While interviewing MIT students for Amazon, Dave asked that. He had one guy who couldn't get past this:
if n == 0: return 1
else: return 1


Then you get these ones though:
return 1-n

return n^1

return (0 < 1)*1

The point is though, that some people get stuck and don't know very little in terms of alternative ways for doing things. They get stuck in "mine is already good enough" mode and then don't look for alternative methods unfortunately. :P

Here's one for you than Eric: (You'll probably get it if you've worked with bit operators at all)
What does the following function do?
function f(n){
return (n&(n-1))==0;
}


That was from a Google or Microsoft interview in the past. Can't remember which.

Also, if those are bad, then what are some good ones you've seen? :P

Eric

Eric Avatar



1,442


November 2005
I know what the & operator does. It's true for 0 and 2 and not 1 or 3, past that I don't feel like figuring out.

String parsing is always interesting, asking them to intentionally generate a specific error is interesting too.

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
String parsing in what sense? Specific error would be fun too. :P

As for that... it tells you whether or not the input is a power of two. Simplest way I believe.

Eric

Eric Avatar



1,442


November 2005
Interpreting a string in some way, whether it be making an "intelligent" array of some sort, or a regular expression to pick out data.

Aaron

Aaron Avatar
Bad Wolf

****
Dedicated Studio Member

859


November 2006
Gimme some silly questions to play with! D:

virtuoso92

virtuoso92 Avatar

*
New Member

4


April 2012
Not a puzzle, but a tricky question I've seen on stackoverflow: explain why extending native JavaScript objects is a bad idea.

Also, hi. ;) Long time no see, not sure if anyone remembers me.


Last Edit: Apr 7, 2012 0:33:57 GMT by virtuoso92

newBookmarkLockedFalling