Jump to content

  • Log In with Google      Sign In   
  • Create Account

Google Interview Questions


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
81 replies to this topic

#41 Nice Coder   Members   -  Reputation: 366

Posted 08 February 2005 - 08:20 PM

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

Sponsor:

#42 Raduprv   Members   -  Reputation: 997

Posted 08 February 2005 - 08:38 PM

Ironically, google doesn't know the answer to "how many gas stations in the us" (I just tried).

#43 Nemesis2k2   Members   -  Reputation: 1045

Posted 08 February 2005 - 08:39 PM

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.

#44 benryves   Members   -  Reputation: 1998

Posted 08 February 2005 - 08:41 PM

Quote:
Original post by Coaster Kev
Why not ask Google ... err... yeah

Funny Google Response


Why do Google want to shrink my donkey?
[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

#45 shmoove   Members   -  Reputation: 829

Posted 09 February 2005 - 12:07 AM

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

#46 kSquared   Members   -  Reputation: 1356

Posted 09 February 2005 - 02:21 AM

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

#47 Conner McCloud   Members   -  Reputation: 1135

Posted 09 February 2005 - 02:32 AM

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

#48 kSquared   Members   -  Reputation: 1356

Posted 09 February 2005 - 02:35 AM

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.

#49 Sagar_Indurkhya   Members   -  Reputation: 253

Posted 09 February 2005 - 02:47 AM

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.

#50 Coward   Members   -  Reputation: 210

Posted 09 February 2005 - 03:43 AM

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?

#51 Nemesis2k2   Members   -  Reputation: 1045

Posted 09 February 2005 - 03:50 AM

Quote:
Original post by Coward
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?

No, sell them for $150 each, and pretend you sold them for $100 each. :D

#52 Dmytry   Members   -  Reputation: 1148

Posted 09 February 2005 - 04:29 AM

first, if compiler doesn't optimize too well, just

void stackdir(){
int a,b;
if((&a)>(&b)){cout<<"stack grows down";}else
if((&a)<(&b))cout<<"stack grows up";}else
cout<<"something is wrong, compiler is waay too smart";
}

, that must work in debug mode with all optimizations turned off.

But if compiler is optimizing...

There is some hope that not-so-well optimizing compiler will not able to optimize that out:
int recursive_fun(int level){
if(level>1){return recursive_fun(level-1);}
if(level==1)return int(&level)-recursive_fun(0);
return int(&level);
};
...
int n=5+random()%20;
int i=recursive_fun(n);
if(i>0){cout<<"stack grows down";}else
if(i<0)cout<<"stack grows up";}else
cout<<"something is wrong, compiler is waay too smart";

If that will be optimized too, it will be needed to add some "useful load" to program, make it compute something.


as about blades. If you are n times smaller, your mass is n3 times smaller, and your surface area is n2 times smaller. Accordinly to laws of physics, if only size will be scaled, you will somehow die, the most obvious way is that you'll lose your heat quickly and die even if themperature is around 20C. Or that you'll evaporate all your water through skin, etc. Okay, let you survived. For that, time needs to be scaled apporiately. That is, your speed of chemical reactions will need to be n times faster. So you will be only n2 or less times weaker, with n3 lower mass. Somewhat like n times lower gravitation, but even cooler. With such ratio, you should be able to just jump out. Or run around that thing, using inertia force to keep in touch with walls, and get out by spiral. Also, 60 seconds should be lot longer for you, so you should have more time to think...
If you'll survive somehow without becoming relatively stronger, your clothes will be too weak to stop blades.

[Edited by - Dmytry on February 9, 2005 10:29:58 AM]

#53 Dmytry   Members   -  Reputation: 1148

Posted 09 February 2005 - 04:54 AM

Quote:
Original post by Raduprv
Quote:
Original post by Cold_Steel
They just look like flat blades. Eventually, I supposed running an empty blender would kill the motor.

Why would it kill the motor? Placing too much load might kill it, but too little wouldn't.

Anyway, to the blender question, I don't think there is any way to survive. The clothes would be so small they are unlikely to stop the motor. And even if the motor is stoped, what can you do? Your clothes are not a rope, and you can't throw them over the edge. Even if you could, you'd need some sort of anchor at the other end so they won't fall back.
The correct answer would be: "Coming at peace with yourself and with the Universe" :D

If blender is empty, motor of course consumes less power, but almost all power it consumes is lost inside motor... and if there's something in blender, some power is spend on mixing and eventually heating that drink....

#54 Stonicus   Members   -  Reputation: 157

Posted 09 February 2005 - 04:59 AM

Even better response to this one:
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?"

I'd get out.

#55 JexMX   Members   -  Reputation: 206

Posted 09 February 2005 - 06:04 AM

Googles test should be, "What is the answer to the world, universe and everything".

If you say 42, you don't get the job..

#56 C-Junkie   Members   -  Reputation: 1099

Posted 09 February 2005 - 06:22 AM

Quote:
Original post by JexMX
Googles test should be, "What is the answer to the world, universe and everything".

If you say 42, you don't get the job..
I guess google has to fire its search engine

#57 Sagar_Indurkhya   Members   -  Reputation: 253

Posted 09 February 2005 - 09:18 AM

Quote:
Original post by Nemesis2k2
Quote:
Original post by Coward
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?

No, sell them for $150 each, and pretend you sold them for $100 each. :D


Well, I am pretty sure they would be like, write some code to solve some insane problem, and generate billions of dollars overnight. Then donate the profit to charity. I don't know.

#58 kSquared   Members   -  Reputation: 1356

Posted 09 February 2005 - 09:29 AM

Quote:
Original post by JexMX
Googles test should be, "What is the answer to the world, universe and everything".

If you say 42, you don't get the job..

My response would be that "the world, the universe, and everything" is not a question, and so I cannot give an answer.

#59 furby100   Members   -  Reputation: 102

Posted 09 February 2005 - 09:53 AM

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


I would say there were five if I didn't want to answer the question properly. It doesn't ask how many you think there are.

#60 furby100   Members   -  Reputation: 102

Posted 09 February 2005 - 09:59 AM

Quote:
Original post by Sagar_Indurkhya
2) What is the most beautiful equation you have ever seen? Explain.


x=2. This equation is satisfied by 2. It follows that there are numbers that satisfy the equation x = 2. From that, it follows that there are numbers. From this simple equation one can settle one of the deepest philosophical questions about mathematics. Certainly a beautiful result.


However, it's almost certain most people will put eip + 1 = 0




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS