Saturday, January 02, 2010

Weird Depot : Google/Microsoft Interview Q&A


These questions are not new, in fact, these are now old enough to get a jerk! Still we often (not only "we", many high-profile technocrats would also) fumble to state clear answers.. Here goes an attempt of mine to sum up those..


1. Why is manhole cover round?
(You can find 100 definite reasons but actual explanation I got from this site: http://www.maa.org/mathland/mathland_10_21.html. Before facing technical interviews I was completely unaware of manhole-cover designs! And I had no idea about "Reuleaux Polygons". Thnak God! I learnt so much about geometry in pursuit of getting reason behind justified shape of such an important property. That's manhole cover!:)

2. What's the significance of "Dead Beef" ?
In Hex, 0xDEADBEEF means memory cells aren't initialized. It marks freed kernel memory (KMEM_FREE_PATTERN). Famously used in IBM systems, also in original Mac OS.

3. How many golf balls can fit in a school bus?
Now, it's truly an absurd idea if I think I'd figure out some way to draw an exact answer to this question! I think the appropriate answer should be: Volume of school-bus (i.e. cuboid) divided by volume of a golf-ball (i.e. a sphere) = (L x B x H) / ((4/3) x pi x R^3), where, L, B, H are length, breadth, height of school bus & R is the radius of golf ball. Simple!

4. How many times a day does a clock's hands overlap?
22 times. 12:00 AM, 1:05 AM, 2:11 AM, 3:16 AM, 4:22 AM, 5:27 AM, 6:33 AM, 7:38 AM, 8:44 AM, 9:49 AM, 10:55 AM, 12:00 PM, 1:05 PM, 2:11 PM, 3:16 PM, 4:22 PM, 5:27 PM, 6:33 PM, 7:38 PM, 8:44 PM, 9:49 PM, 10:55 PM. But this question isn't weird at all.. the answer may seem weird at first look though!

5. You're 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?
Hmm.. I think the obvious answer is "die" or "wake up from the horrible dream", but it won't be the right guess.. what say?? Let's give it a wild try! Provided my density remaining the same, probably I'd fly out of the blender.. because then I'd become so light (almost like a tissue paper may be), that the wind generated by the blades would pick me up & throw me out of the blender. An appropriate answer (someone wrote in WikiAnswers and it's worth to put in here).. "If you are shrunk K times, the force you can exert with your muscles, which is approximately proportional to the cross-section of your muscles, decreases K^2 times, and the length (path) on which you exert this force decreases K times. Hence the energy your muscles can deliver decreases about K^3 times, which is just enough to jump in the same height as before, because your mass also decreases K^3 times. This is just a rough estimate, but "hypothetically" you could surely jump out of a 15-20 cm high glass blender".

6. How many piano-tuners are there in the entire world?
How the hell on earth can I know!!!.. but there must be some trick or other inherently involved in it.. So I looked for it in Wikipedia.. On Wikipedia, they call this a Fermi problem. The classic Fermi problem, generally attributed to Fermi, is "How many Piano tuners are there in Chicago?" A typical solution involves the followings :

  1. There are approximately 5,000,000 people living in Chicago.
  2. On average, there are two persons in each household in Chicago.
  3. Roughly one household in twenty has a piano that is tuned regularly.
  4. Pianos that are tuned regularly are tuned on average about once per year.
  5. It takes a piano tuner about two hours to tune a piano, including travel time.
  6. Each piano tuner works eight hours in a day, five days in a week, and 50 weeks in a year.
From these assumptions we can compute that the number of piano tunings in a single year in Chicago is
(5,000,000 persons in Chicago) / (2 persons/household) × (1 piano/20 households) × (1 piano tuning per piano per year) = 125,000 piano tunings per year in Chicago.
And we can similarly calculate that the average piano tuner performs
(50 weeks/year)×(5 days/week)×(8 hours/day)×(1 piano tuning per 2 hours per piano tuner) = 1000 piano tunings per year per piano tuner.
Dividing gives :
(125,000 piano tuning per year in Chicago) / (1000 piano tunings per year per piano tuner) = 125 piano tuners in Chicago.
A famous example of a Fermi-problem-like estimate is the Drake equation, which seeks to estimate the number of intelligent civilizations in the galaxy. The basic question of why, if there are a significant number of such civilizations, ours has never encountered any others is called the Fermi paradox.

7. You've to get from point A to point B. You don't know if you can get there. What would you do?
I'd answer that there's nothing to worry about.. Google Map is there to help me!;).. But it won't work to crack the tough-nuts.. the answer will be either using BFS (Breadth First Search) or using DFS (Depth First Search). Another more optimizing technique may be A* search, because it's a fundamental exploring algorithm (actually it's a Best First Search).. but frankly speaking, I'm less comfortable with it rather than BFS or DFS.

8. Imagine you have a closet full of shirts. It’s very hard to find a shirt. So what can you do to organize your shirts for easy retrieval?
Using hashing is the right answer. More accurate answer is : First use hashing. Then arrange each type in 2-3-4 tree or Red-Black tree. (Though I'm definite that even the CEO of Microsoft himself won't ever arrange his shirts using hashing)!!:P

9. Why is it that the mirror appears to reverse left and right, but not up and down?
I didn't find any satisfactory explanation for this through net, I think it happens because our eyes are placed in a horizontal line.. and in horizontal plane (or more accurately in X-Y plane), these kind of right-into-left & left-into-right reflection works.. in Y-Z plane and X-Z planes respectively that up-into-down & down-into-up reflections would also work.

10. Which way should the key turn in a car door to unlock it?
This question seems a real dumb – is there any trick hidden behind it? I don't think so.. Tradition holds that since it is easier for right handed people to turn a key to the right, and right handed people make up the majority of the population, turning a key right unlocks the door. If anyone knows the exact answer, please post it here.







No comments:

Post a Comment