terriko: (Pi)
[personal profile] terriko
There'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...

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.

Date: April 26th, 2013 01:17 am (UTC)
From: [identity profile] alan-de-smet.livejournal.com
I feel like I'm missing something in the if/else case. I have an answer, but I'm afraid it might be violating the spirit of the question. Does the X replacement have to be syntactically valid on its own? (I'm assuming this is pseudocode. If this is a particular language, I might be able to dredge up other answers based on the specifics of that language.)

Date: April 26th, 2013 05:50 am (UTC)
From: (Anonymous)
Would it be "cheating" to replace the X with some variant that amounts to "if (! print("hello")) in whatever language this is supposed to be ?

Date: April 26th, 2013 06:32 am (UTC)
azurelunatic: Vivid pink Alaskan wild rose. (Default)
From: [personal profile] azurelunatic
Let's see. You could of course look for a light switch and turn it off that way, if there is one. You could also break the bulb, unscrew the bulb, get out your insulated shears and remove the bulb from its power supply the fun way, or maybe even go out of the room and fetch a bulldozer. Depending on what you mean by "off", you might also be able to cover it with something, or fill the air in the room with enough fog (you have a fog machine, right?) so it's not really light anymore.

Date: April 26th, 2013 06:23 pm (UTC)
From: [personal profile] fg4fc07p
Steal the bulb.

Vibrate the bulb (to break the filament but not the glass), subject the bulb to extreme heat (with a cigarette lighter or brulee torch) or cold (find a fire extinguisher, maybe even a glass of ice water). With a CF bulb and cold and some care, it will be possible to turn the bulb back on by letting it get warm again.

Unscrew the bulb and put some coins in the socket. If this causes the power supply to protect itself by changing state (i.e. a fuse blows or similar thermal overload protection device trips), you can even get your coins back and the bulb will still be off. If you have a handful of metal filings or mercury handy those work too. Water and table salt can do the job if you get the mixture right and you can work out a delivery system that doesn't kill you first. If there are fuses, turn on every switch and put a hairpin or a paperclip in every wall socket you can find until you find one on the same circuit as the bulb. Go to an adjacent room with more accessible bulb sockets and use this or the coin attack on those.

Think outside the room: attack the local power grid.

If the bulb is resting on an object, move the bulb to rest inside or suspend it underneath some other object (the bulb is on, you say? On what?). If there is no single obvious acceleration vector acting on the room and its contents (e.g. the room is in orbit), argue with the interviewer about the locally accepted definitions of words like "down" on which concepts like "on" and "off" may rely.

Dip the bulb in opaque reflective paint. Depending on the bulb technology, this either leaves the bulb still on but its light invisible, rendering the bulb functionally ineffective; or it causes the bulb to overheat and fail. This approach has some risks: the bulb might win, and shine through cracks or burns in the paint, or the bulb may put out enough heat that the paint itself starts radiating visible light.

Put your own light source in the room to raise the ambient light level in the room to 100 times greater than the brightest light level emitted at the surface of the first bulb. The light will be on, but to human eyes (or an image sensor with an equivalent contrast ratio) the first bulb will appear no brighter when it is on than it does when it is off.

Use an electric coil to induce a current inside the bulb high enough to make it fail (or if it's CF or LED, disrupt the electronics of its power supply). If the bulb is already wirelessly powered by induction, put a sheet of metal in the way, or move the bulb away from its power source, or generate your own induction current with equal magnitude and opposite phase. Detonate a nuclear warhead in the atmosphere above the room and use the EMP to disable the light bulb or its power supply. Trigger an unusually large solar flare and direct it toward the Earth, disrupting the global power grid.

If the bulb is one of those remotely programmable WiFi or ZigBee LED devices, send it the 'off' or '(r,g,b) = (0,0,0)' command.

If the room is in a submarine at sufficient depth, opening all the doors between the light bulb room and the outside should get the light being off, especially in salt water.

If the bulb uses a combustion-based power supply (e.g. it's a Coleman lantern and the "bulb" is really a thorium dioxide mantle), seal the room and remove all the oxygen (or pump in lots of carbon dioxide).

If the bulb contains its own power supply (e.g. batteries or a luminescent chemical reaction), you could just wait until that power supply runs out. If possible, increase the bulb's brightness to make this happen faster. If the bulb is based on LEDs or electroluminescence then this might take a while. If the bulb is based on a radiological power supply (e.g. radium and zinc sulfide painted on the inside of the bulb glass) this might take a very long while.

For radiologically powered light bulbs, use acid to dissolve the zinc sulfide (or similar chemistry for other materials) to make it stop fluorescing. Hydrofluoric acid will dissolve bulbs made of glass and probably destroy critical materials in all the other kinds of bulb. There might be a nuclear reaction you can use to stop radiological power sources (possibly emitting a large amount of light between the initial state and the "off" state), but I have no idea how to even Google for that.

Date: April 30th, 2013 04:11 am (UTC)
warthog9: Warthog9 (Default)
From: [personal profile] warthog9
And here I'm surprised no one has gone so far so far as to suggest nuking the light bulb from orbit, as it's the only way to be *SURE* it's out. ;-)

Profile

terriko: (Default)
terriko

May 2025

S M T W T F S
    12 3
456 78910
11121314151617
18192021222324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 13th, 2025 07:12 pm
Powered by Dreamwidth Studios