Two interview questions I enjoyed
Apr. 25th, 2013 05:07 pmThere's a longer, friends-locked post before this one talking about the interviews I had this week, but it occurs to me that the more general public might get a kick out of the two interview questions that most amused me:
My new favourite interview question:
Given this code...
What do you need to insert in place of X in order to get this code to print "helloworld" ?
And the second one:
If you're in a room with a light bulb that's on, how can you make it be off?
(This was asked shortly after they told me they were asking to see if I had the security mindset, which is a pretty huge clue as to the types of answers they were hoping to hear. I had a lot of fun with this.)
I am leaving my answers out of this post so that you can think about the possibilities yourselves, but of course feel free to discuss in the comments.
My new favourite interview question:
Given this code...
if ( X )
print("hello")
else
print("world")
What do you need to insert in place of X in order to get this code to print "helloworld" ?
And the second one:
If you're in a room with a light bulb that's on, how can you make it be off?
(This was asked shortly after they told me they were asking to see if I had the security mindset, which is a pretty huge clue as to the types of answers they were hoping to hear. I had a lot of fun with this.)
I am leaving my answers out of this post so that you can think about the possibilities yourselves, but of course feel free to discuss in the comments.