Sign in to follow this  
kSquared

Google Interview Questions

Recommended Posts

Witchcraven    564
Since you are still alive, I assume somehow your biology was preserved. So that means your muscle mass is still in proportion to your total mass. Thus, my solution would be to jump out. Should I fail to make the jump, I would probably punch a hole in the blender upon my landing. Or if the blender was on its side, I would walk out. Or jump against the side, knocking it over. Considering my density/size ratio, I wonder if I could chew through the blades.

Hell, if you shot me at 2000 feet per seoond I could probably be used as an anti tank bullet.

Why such a complex stack growth solution. In a function, declare 2 local variables. Compare addresses.

Share this post


Link to post
Share on other sites
Raduprv    997
Quote:
Original post by Witchcraven
Since you are still alive, I assume somehow your biology was preserved. So that means your muscle mass is still in proportion to your total mass. Thus, my solution would be to jump out. Should I fail to make the jump, I would probably punch a hole in the blender upon my landing. Or if the blender was on its side, I would walk out. Or jump against the side, knocking it over. Considering my density/size ratio, I wonder if I could chew through the blades.

Hell, if you shot me at 2000 feet per seoond I could probably be used as an anti tank bullet.

Why such a complex stack growth solution. In a function, declare 2 local variables. Compare addresses.


Only that it was stated that your mass is also reduced accordingly.

Share this post


Link to post
Share on other sites
Cold_Steel    835
Quote:
Original post by Raduprv
Why would it kill the motor? Placing too much load might kill it, but too little wouldn't.
I assume they are designed to be run with some resistance. Sort of like if you run a water pump motor dry, it will burn out. Also, I just read somewhere that they may be designed for short use time spans, and not continuous use, so they could burn out that way too after 10 or so minutes.

[disclaimer]I don't even own a blender! What do I know!?[wink]

Share this post


Link to post
Share on other sites
Raduprv    997
The water pump is different: the motor needs the water to cool itself. For a blender, it doesn't matter, because the motor cools itself with air.

Share this post


Link to post
Share on other sites
Cold_Steel    835
Quote:
Original post by Raduprv
The water pump is different: the motor needs the water to cool itself. For a blender, it doesn't matter, because the motor cools itself with air.
I wonder for how long though. I suspect an average would tend to overheat at some point given the high RPM.

Share this post


Link to post
Share on other sites
cowsarenotevil    3001
Quote:
Original post by kSquared
Q: "You are shrunk to the height of a nickel and your mass is proportionally reduced so as to maintain your original density. You are then thrown into an empty glass blender. The blades will start moving in 60 seconds. What do you do?"


Clearly they mentioned nickels for a reason. Simply use a now proportionately huge piece of pocket change to jam the blades in some way. :D

Share this post


Link to post
Share on other sites
Raduprv    997
Quote:
Original post by Cold_Steel
Quote:
Original post by Raduprv
The water pump is different: the motor needs the water to cool itself. For a blender, it doesn't matter, because the motor cools itself with air.
I wonder for how long though. I suspect an average would tend to overheat at some point given the high RPM.


Many motors (big motors) have some sort of fan/propeler inside, so they draw air to cool themselves. Besides, if a motor is idle it will heat slower. But it depends on the motor, of course. Some are designed to run non stop, while others are designed to run for a limited time. A cheap blender will probably die if used too much, but a well build one will most likely run for quite a while.

Share this post


Link to post
Share on other sites
Cold_Steel    835
Quote:
Original post by Raduprv
Many motors (big motors) have some sort of fan/propeler inside, so they draw air to cool themselves. Besides, if a motor is idle it will heat slower. But it depends on the motor, of course. Some are designed to run non stop, while others are designed to run for a limited time. A cheap blender will probably die if used too much, but a well build one will most likely run for quite a while.
Yeah, Google should at least tell you what brand they're using. There's a big difference between a high quality restaurant blender and a Wal-Mart POS.
Heh, you know what, I think I know how to answer all of Google's interview questions:
[google]

Share this post


Link to post
Share on other sites
qesbit    100
[quote]Original post by kSquared
Q: "You are shrunk to the height of a nickel and your mass is proportionally reduced so as to maintain your original density. You are then thrown into an empty glass blender. The blades will start moving in 60 seconds. What do you do?"

Ehh. Well I make alot of smoothies and stuff with blenders.. hehe.. ok.. watch if you drop a granola (or rice or something) on the blade just as you turn it on. It will shoot itself out of the blender (hopefully, sometimes it richochetes all over the place before flying out).

My guess is if you are that small, get on the blade and just as the blade turns on jump and you will ping pong right out of the blender and land about 20 feet somewhere arbritraily in your kitchen. Of course you will probably be dead anyways from slamming into the blender walls and flying all that distance...

Why do they ask questions like this anyways?

Oh, oops, I forgot it is usually because it is hitting the blades :-) My bad. I'd just google for the answer.

They didn't mention if it has a top on it though.

Share this post


Link to post
Share on other sites
Zahlman    1682
Quote:
Original post by Witchcraven
Why such a complex stack growth solution. In a function, declare 2 local variables. Compare addresses.


Agreed. Of course, you will have to watch out for the optimizer reordering things. So you'll want to do it in assembly. (Of course, if you knew how to program in assembly on that platform, you'd probably already know the stack direction... :s )

Share this post


Link to post
Share on other sites
golopart    100
LOL. You don't need to do any of that. Make a function. If the function has the C calling convention then parameters on the right of the prototype will be pushed on first. Compare the address of two parameters. If the lefter parameter has a smaller address then the stack grows from high to low memory. Adjust according to calling convention. Newbies.

Share this post


Link to post
Share on other sites
bakery2k1    712
Quote:
Original post by golopart
LOL. You don't need to do any of that. Make a function. If the function has the C calling convention then parameters on the right of the prototype will be pushed on first. Compare the address of two parameters. If the lefter parameter has a smaller address then the stack grows from high to low memory. Adjust according to calling convention. Newbies.


What if the parameters are passed in registers?

Share this post


Link to post
Share on other sites
golopart    100
Then it's a fastcall calling convention. Is there a language where you can't choose to pass data on the stack? (don't say Java)

My point was to reduce the number of steps to find a solution. kSquared said call a function and another function in it. Someone else said declare two local vars. It seems to me that in any language that has those capabilities also has the capability of just doing:

void __cdecl lol(int a, int b)
{
print(&a);
print(&b);
}

But really I was just being a smart ass.

Share this post


Link to post
Share on other sites
Nice Coder    366
Push a value into a stack, and subtract the stack pointers current value from the stack pointers value before you pushed the value.

If it is positive then the stack is going up, otherwise it is going down.

You then pop it back again (to return the stack to its origional state)

Also, for the blener one, i would go something like:
Resonate the glass until it shatters, then run away real fast.

For "how many gas stations in the us"? I would say, "Google it".

From,
Nice coder

Share this post


Link to post
Share on other sites
Nemesis2k2    1045
Quote:
Q: "You are shrunk to the height of a nickel and your mass is proportionally reduced so as to maintain your original density. You are then thrown into an empty glass blender. The blades will start moving in 60 seconds. What do you do?"

Panic, because the rest of the ingredients are probably coming in a few seconds.

Quote:
Q: "How would you find out if a machine's stack grows up or down in memory?"

Give it appropriate amounts of sunlight and water, and record observations over time.

Quote:
Q: "Explain a database in three sentences to your eight-year-old nephew."

Well, basically it's a.... Wait a minute, who are you? I don't have an eight year old nephew.

Quote:
Q: "How many gas stations would you say there are in the United States?"

I don't know, but when I see him next, I'll ask.

Share this post


Link to post
Share on other sites
shmoove    821
Quote:
Original post by benryves
Quote:
Original post by Coaster Kev
Why not ask Google ... err... yeah

Funny Google Response


Why do Google want to shrink my donkey?

Yeah, your donkey, right....

They just want you to get in shape, that's all.

shmoove

Share this post


Link to post
Share on other sites
kSquared    1356
Quote:
Original post by golopart
LOL. You don't need to do any of that. Make a function. If the function has the C calling convention then parameters on the right of the prototype will be pushed on first. Compare the address of two parameters. If the lefter parameter has a smaller address then the stack grows from high to low memory. Adjust according to calling convention. Newbies.

I would fire you just for using the word "lefter" alone. =P

Share this post


Link to post
Share on other sites
Conner McCloud    1135
Quote:

Q: "How would you find out if a machine's stack grows up or down in memory?"

The correct answer is "Check the documentation."

Who's more valuable: The guy who can come up with some hack to calculate the value, or the guy who knows where to look up the value?

CM

Share this post


Link to post
Share on other sites
kSquared    1356
Quote:
Original post by Conner McCloud
Quote:

Q: "How would you find out if a machine's stack grows up or down in memory?"

The correct answer is "Check the documentation."

From earlier:

Quote:
Any intermediate questions that I asked for clarification or otherwise have been omitted.


I asked about that ("Is there a handy reference manual available somewhere?", and the response was "Your co-worker has a wobbly desk and is using it to prop it up right now." Heh, heh. At least Google has a sense of humor.

Share this post


Link to post
Share on other sites
My Comp Sci teacher once passed around this little application for google. It had some wierd stuff, though it makes it all the more interesting to work there:

1) Calculate the Resistance in ohm's that a knights move would require on an infinite plane of resistors(forgot the resistance of each resistor, or whatever).

2) What is the most beautiful equation you have ever seen? Explain.

3) You have 10,000 Apache servers, and 1 day to generate $1,000,000. What do you do?

And some other stuff.

Share this post


Link to post
Share on other sites
Coward    210
Quote:
Original post by Sagar_Indurkhya
3) You have 10,000 Apache servers, and 1 day to generate $1,000,000. What do you do?

Sell them for $100 each?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this