### 面试时最经常被问到的问题（Frenquently asked interview questions）之Analytical, puzzles, and brain-teasers篇

Analytical, puzzles, and brain-teasers Questions & Answers

1If you had an infinite supply of water and a 5 quart and 3 quart pail, how would you measure exactly 4 quarts?

2If you could remove any of the 50 states, which state would it be and why?

--I would not remove any of them, (provided the definition of state is the USA's states). Could you imagine the gerrymandering after something like that? Besides - each state has something special it brings to its star on the flag. That is what makes the USA so remarkable.

--I will ask the interviewer for the definition of "remove" first.
If ( the answer is dig a hole, let water bubble up)
{
I would say I "remove" a state lack of water supply.
}
else if ( the answer is give it up or give it away to other countries )
{
I would say it's some state with the biggest area of desert. And I would definitely trade sth. back from whom want it
} else // default,
{
I will keep it for possible future usage
}

3If you are on a boat and you throw out a suitcase, will the level of water increase?

-- The answer is: it depends on the density of the briefcase. While the briefcase is in the boat, it will displace it's weight in water.

If the briefcase floats after you toss it out, then it still displaces its weight in water, and there is no change.

However, if the briefcase is heavier than water it will displace its volume, not its weight. The amount of displaced water will be less (which is why it sank) and the water level will decrease.

-- The other question is whether or not the suitcase is thrown in the water. If it is thrown on to a dock or land, then the level will decrease due to less weight in the boat.

4There are 3 ants at 3 corners of a triangle, they randomly start moving towards another corner. What is the probability that they don't collide?

--- 1. Let's mark the corners of the triangle as A,B,C.
2. There are only two cases under which the ants won't collide : A->B, B->C, C->A and A->C, C->B and B->A
3. Therefore, probability of ants not colliding : 2/8 = 1/4.

---This assumes that ants move in a straight line, as we know they don't. They move all over the place, in random directions, eventually ending up in their final destinations. Although Microsoft asked me this question and was looking for the answer mentioned by other posters, they gave extra credit for what I explained.

--- You are all wrong! You have made not one but three obvious assumptions!
1) They move in straight lines.
3) They stay within the confines of the triangle.

Moral: Think out of the triangle!!

5Three men were renting a motel figuring the room cost 30 dollars they would pitch in ten a piece. The room was only 25 so they each gave the bell boy ten,(tip)the bellboy didn"t think that would be fair so he gave them each back 1 dollar and kept 2 for himself. What happened to the other dollar? ( sent by MACsabastion@webtv.net )

Oh after giving it some thought actually I was right, there isn't any missing dollar.

If you go backwards you come up to this:
9x3 = 27
27+2 = 29
so it had to be 30$in order to be correct right? No, because you have to add 3$ and not 2. You think it would be right if you add 2\$ because the tip is that amount. But the tip is already included in the multiplication.
So the maths aren't right, it should be 9x3+3 and not 9x3+2.

6"You have b boxes and n dollars. If I want any amount of money from 0 to n dollars, you must be able to hand me 0 to b boxes so that I get exactly what I request." The two questions were " What are the restrictions on b and n, and how is money distributed among the boxes?"

The trick is of Binary Numbers

2^0=1
2^1=2
2^2=4
2^3=8
2^4=16
....
...

2^7=128
...

The formula is [log n to base 2] + 1 = b
where [] denote integral part of the log base 2 of n

Example
So if we want 0 to 15 dollars
[log of 15 to base 2] + 1 = [3.90] + 1 = 3 + 1 = 4 boxes
we need to have 4 boxes each having 1,2,4,8, dollars respectively.Now we know from binary numbers that any amount from 0 to 15 can be formed with this boxes.

For 0 to 6 dollars
[log of 7 to base 2] + 1 = [2.58] + 1 = 2 + 1 = 3 boxes
we need to have 3 boxes each having 1,2,4, dollars respectively

For 0 to 100 dollars
[log of 100 to base 2] + 1 = [6.64] + 1 = 6 + 1 = 7 boxes
we need to have 7 boxes each having 1,2,4,8,16,32,64 dollars respectively

-Ameya Vaidya

7What is the sum of the numbers from 1 to 1000?

Depends what NUMBER means here:

If means integer, that's 100*(100+1)/2=5050;
If not, that's infinity.

8You are an employer. You have ten employees. Each month, each one of your ten employees gives you ten bags of gold. Each bag of gold has ten pieces of gold in it. Each piece of gold weighs one pound. One of your employees is cheating you by only putting nine pieces of gold in each of his ten bags of gold. You have a scale (not a balance, a scale), and you can only take one measurement from the scale, only one (1) reading. How can you tell which of the ten employees is cheating you by using this scale and only taking one measurement?

---When your employees come to pay you at the end of the month, take one bag from employee number one's pile and set it aside. Take two bags from employee number two's pile and add it to the one from employee number one. Take three from employee three, four from employee four, etc...

Once you have now compiled a pile of bags, you should have 55 bags (one from one, two from two, etc). Set the whole pile (all 55 bags) on the scale and take a reading. If all the bags were honest, you would have 550 pounds on the scale.

If employee one is cheating you, then the reading would be 549, since you only have one bag from employee one. Likewise, if the measurement is 547, then 3 pounds are missing, and employee three is the thief.

--- I think we are given a scale not a balance. So we can’t tell the exact weight of the bags. So how do we find out whether its 549, 547 etc.?

--- Why does he need to weigh? Can't he just count?

9How many points are there on the globe where by walking one mile south, one mile east and one mile north you reach the place where you started.

--At the North Pole, The South Pole wouldn't quite work, since you can only go north from the South Pole.

--Both answers (North Pole, and all points on the circle 1 mile north of the circle having circumference of 1 mile around the South Pole) are right.

10How would go about finding out where to look for a book in a library? (You do not know how the books are organized beforehand)

-- I would go and ask a person in charge of arranging the books instead of wasting my time in searching all of them

-- This question is open ended , though Microsoft might be testing fundamentals on Binary search , Indexing etc by asking this.

The approach I would take is , check out the index cards and find the shelf where the book is located. Then do an alphabetical search by physically going to that shelf. You can also say that you would start on the top of the shelf or the bottom depending on the "letter" name of the book etc.

-- I would leave the library, drive to the exact location of the person who wrote this question, and slap them.

11Imagine you are standing in front of a mirror, facing it. Raise your left hand. Raise your right hand. Look at your reflection. When you raise your left hand your reflection raises what appears to be his right hand. But when you tilt your head up, your reflection does too, and does not appear to tilt his/her head down. Why is it that the mirror appears to reverse left and right, but not up and down?

-- It's mainly because man himself is "left-right" symetric but not "up-down" symetric.

-- This is not a Physics issue... this is a matter of perception.

When you stand in front of the mirror and raise YOUR LEFT HAND, the reflection is of YOUR LEFT HAND.

By referring to "what appears to be his right hand" the question has essentially asked you to envision yourself rotated 180 degrees about a vertical axis, thus subtly introducing the apparent conflict between left and right.

Why it works: Since humans are relatively symmetric along a vertical axis you are able to envision YOUR LEFT HAND as a suitable RIGHT HAND for your reflection.

Humans are not generally symmetric along a horizontal axis (hey, I've never seen it, but that doesn't mean some freak isn't out there...), so it's much harder to envision feet as a suitable head and vice versa.

12You have a bucket of jelly beans. Some are red, some are blue, and some green. With your eyes closed, pick out 2 of a like color. How many do you have to grab to be sure you have 2 of the same?

If you select 4 Jelly beans you are guaranteed that you will have 2 that are the same color.

13You are given a scale which you are to use to measure eight balls. Seven of these balls have the same weight: the eight ball is heavier than the rest. What is the minimum number of weighs you could perform to find the heaviest of the eight balls?. Remember it's a scale not a balance. (i.e. It can just tell you if one side is heavier than the other it can't give you the exact weight).

!..Umm. You can do this in 2 weighs. Put three balls on each side of the scale. That's a total of six balls you're weighing. If the three balls on each side weigh equally, you know that one of the two remaining balls is the heaviest. Weigh those two balls to determine which one is heaviest. If, however, one of the three ball combinations weighs most, remove all balls from the scale, then weigh just two of the three "heavier" balls. If those two balls are equal weight, the third, unweighed ball is the heaviest; otherwise the scale will indicate which of the two balls on the scale is the heavier one.

So, what’s the difference between a balance and a scale?

14How would you design a toaster?

1. Find out Voltage to be supported
2. '' '' 2-pin/3 pin plug ?
3. '' '' How many slots for bread?
4. '' '' what size bread ?
5. Automatic pop-up
6. Easily accessible for cleaning and maintenance
7. Easily operable
8. Compact and good looking
9. Design a simple circuit that uses components that are easily available.
10. Internet enabled ?
11(?). Provide a place to keep the stack of bread slices, a settable counter, place to keep the plate, toaster automatically picks up bread from the stack, "toasts" it and places it on the plate.

12. Also could provide a butter holder that melts the butter and sprinkles it on the toast, once done.
13. Optional alarm that rings after the job is done (entire stack is toasted)
14. Optical sensor to sense the actual browning of the bread (different settings for wheat and white bread)

.. And so on.... :))

15How would you design an universal remote control?

16How would you design a clock for a blind person?

I would design a clock with Brail Code, Self talk and vibration and with capabilities for disabling any of those features depending on the requirement. Since vibration is very difficult to design, they can be set aside in another version of the clock.

17How many miles of road are there in the US?

-- This series of questions is called Guesstimates, and tests ur ability to make meaningful guesses and assumptions. Some other questions like this are 'how many helicopters are flying overhead right this moment?' and 'what is the number of tennis balls made in the US annually?'

-- actually this questions is like that : how many cars in USA u can answer any number u want and argue later: ask the interviewer to count them for u, if he finds more cars than , more cars have been bought since he last counted ..., if less then a lot of cars have been scrapped...
the same thing applies to road also, enjoy

-- I guess this is funny!! I would rather say, 0.625 times the number of kms in USA:)

18There are n couples attending a party. Each one shakes hands with the persons he doesn't know. (Assuming each person knows his/her partner) Mary and John are a couple. John asked the rest of the party-attenders how many times he has shaken hands. Each one gives a unique answer. How many times does Mary shake hands?

0 0