Mircosoft Interview Puzzles

The following Microsoft Interview Puzzles will help you brush up your skills and will make you more confident while giving the interview.

1. Microsoft Interview Puzzle  - Cheating Husbands Interview Question

There is a town named Panem. The town is well built and have every facility available to the citizens. It comprises of 100 married couples. The husbands of the town are very loyal to their wives but that happens for a reason. There is a rule that is followed by the people of the town. If any wife finds out about her husband's infidelity, the husband is immediately executed.
No woman in the town talks about their own husband and all they do is gossip about others'. Thus every woman in the town is familiar with all the other unfaithful husbands but does not know about their own. This can also be explained as that the husbands remain glued lip about their own unfaithfulness.

One day, the mayor of the town announces to the people that there is at least one cheating husband in the town. What will happen now?

Solution:
This one definitely sounds too unusual. But there is an easy way to look at things.

Let us say that there is one unfaithful husband in the town. In such a case, 99 women will know about him. The wife of that man will be the only one who will not know about him and would have always thought that his husband is truly faithful to her. But since the mayor announced that there is at least one cheater among them, she will come to a realization that her husband must be cheating on her. So her husband will be executed on the first day of the announcement.

Now let us take up a case that there are two cheating husbands in the town. Now 98 women of the town must be knowing about them both. The two wives of those men will think that there is only one cheater in the town. Both of them believes that their respective husbands are loyal and this would not report about them

But when both of them will find out on the next day that no one was executed, they will realize that it could only mean that both of their husbands are cheaters. Thus both the husbands will be executed on the second day.

Thus if we have X number of cheating husbands, they all will die on the Xth day after the announcement is being made.

2. Microsoft Interview Puzzle - Prison Interview Puzzle

Once in a prison with 100 prisoners, the Warden introduces a strange but interesting challenge to all the prisoners. This challenge can even grant them the freedom and thus every one of the prisoners becomes quite excited. 

The warden selects one prisoner everyday randomly from the lot and moves him into a pitch black room with a bulb and a witch that controls the bulb. The prisoner can carry out three different actions in the room - He can switch on the bulb, switch it off or do nothing and sit idle. A prisoner can be picked up more than one time.

Now the warden introduces the twist in the challenge. He tells them that the prisoners can put a stop to the process any day they feel that every one of them has been confined to that room at least once. If the prisoners are correct, then every single one of them will be set free. But if they have put up a wrong judgment, all of them will be killed.

Seeking it to be the only chance of freedom, the prisoners take up the challenge. They are given some time to discuss regarding it before the process could begin. How will they plan things so that they are finally set free?

Solution:
They select one of the prisoner named Jason to do the trick and frame out a full proof plan. According to their plan, whenever a prisoner other than Jason is selected, they will follows some simple steps - If the bulb is off, they will switch it on but if the bulb is already lit, they won't do anything and sit idle.

If Jason is selected and he finds out that the bulb is lit, he will add one to his count and will switch off the bulb. If the bulb is already switched off, he will sit there idly. In such a manner when his count reaches to 99, he will tell the warden that every prisoner has now been to the room.

Let us craft out the solution in simpler terms. Whenever a prisoner goes inside the room, he simply switches on the bulb if it is off. Thus one prisoner will only light the bulb once. When Jason finds out that the bulb it on, he will know that this has been done by a new prisoner and he will add one to his count. He will keep doing this till his count reaches 99. 99 because, he already has been in the room which makes a total of 100. Thus it is a full proof plan that will definitely set them all free. 

3. Microsoft Interview Puzzle - Equilateral Triangle Interview Puzzle

There is an equilateral triangle and three bugs are sitting on the three corners of the triangle. Each of the bugs picks up a random direction and starts walking along the edge of the equilateral triangle. What is the probability that none of the bugs crash into each other?
Solution:
If you have come up with the fact that the bugs can avoid the collision only when they decide to move in the same direction be it clockwise or anti clockwise, you have already solved half of it. In any other way, the bugs will definitely run into each other.

Now the bugs can move either clockwise or anti-clockwise. The probability of choosing a specific direction is then 1/2.

We will utilize the simple equation of probability to find out our answer

P(No Collision) = P (The bugs move in clockwise direction) + P(The bugs move in anti-clockwise direction)
= 0.5 * 0.5 * 0.5 + 0.5 * 0.5 * 0.5
= 0.25

Thus the probability that the bugs won't collide into each other is 0.25 or 1/4. 

4. Microsoft Interview Puzzle  - Interesting Gold Bar Interiew Puzzle

You are a king of an empire. You have a servant working in your palace. He works all the seven days and you only pay him in the form of gold bar. You must pay the worker for his work every day at the end of the day. 

If you are only able to make two breaks in the gold bar, how will you pay the servant if the servant works for the equal time every day and thus equal amount must be paid at the end of the day?

Solution:
If you are thinking of how to cut in such a way that you are able to make seven equal pieces, you are thinking in the wrong direction. You should give more stress on how to make the transaction with the worker.

You have to break the gold bar two times so you have the following sizes of the bar:

1/7 ---- Bar A
2/7 ---- Bar B
4/7 ---- Bar C

When the day 1 ends:
Give Bar A (You remain with Bar B and Bar C; Worker possess - Bar A)

When the day 2 ends:
Give Bar B and take the Bar A back (You remain with Bar A and Bar C; Worker possess - Bar B)

When the day 3 ends:
Give Bar A (You remain with Bar C; Worker possess - Bar A and Bar B)

When the day 4 ends:
Give Bar C and take back Bar A and Bar B (You remain with Bar A and Bar B; Worker possess - Bar C)

When the day 5 ends:
Give Bar A (You remain with Bar B; Worker possess - Bar A and Bar C)

When the day 6 ends:
Give Bar B and take back Bar A (You remain with Bar A; Worker possess - Bar B and Bar C)

When the day 7 ends:
Give Bar A (You remain with no bar; Worker possess - Bar A, Bar B and Bar C)

Thus by the end of seven days, you have taken care of everything.

5. Microsoft Interview Puzzle - Colliding Trains Interview Puzzle

A train is moving from station A to station B at 15 mph. Another train is moving in the opposite direction from station B to A at a speed of 20mph. A vulture is flying from Station A to station B at 25 mph. When the vulture reaches at the train moving from Station B to A, it starts flying back and flies at the same speed till it reaches the train moving from station A to B and starts flying in the reverse direction again. The vulture keeps flying to and fro till both the trains collide with each other. 

What is the total distance that is traveled by the vulture?

Solution:
To solve this question, we will have to use the concept of relative speed.

Let us assume that the distance between the station A and B is D Miles
The relative speed at which the train are approaching each other is 20 + 15 = 35 mph
When the train collides with each other, the sum of the distance covered will be the distance between the stations i.e. D.
Now Speed = Distance/Time
Which means that the trains will collide in d/35 hours after their start

Another constant things we have here is the speed of the vulture i.e. 25 mph.
Thus by the time the trains collide, the vulture would have covered
25*(D/35) miles = 5D/7 Miles

6. Microsoft Interview Puzzle- Box with Defective Balls Interview Question

Here is a situation. You have 10 boxes that contains balls with each of the ball weighing 10 grams precisely. Now among the boxes, one of the box comprises of defective balls with each defective ball weighing 9 grams. You have been provided with an electronic weighing machine but you are allowed to use it only once. 

Can you find out which box contains defective balls?

Solution:
The question can practically disarm you. But we promise by the time you read the solution, you will find that it was way easy than you were thinking.

Let us name the boxes with a number - Box1, Box 2..., Box10. Now you must be familiar with the weights of the balls precisely. By saying that we are not implying that you will have to take one ball from every box and judge the weight of every ball.

What you have to do is pick one ball from Box 1, 2 balls from Box 2, 3 balls from Box 3, ...., 10 balls from Box 10. Thus after taking balls from every box in such a manner, you will finally have 55 balls in total. There comes the time to use the weighing machine.

If all the balls were weighing adequate, the combined weight should be 55 x 10 grams = 550 grams. But since one of the box has defected balls, the weight will be less than that. Here is the tricky part and explains why we took different number of balls from each box.

If the total weight is less than 1 gram, then the defective box is the Box 1 since we took 1 ball from that box. If the Box 2 is defective, the total weight will be less than 2 grams. In similar fashion you can identify the defective box by analyzing the total weight that is calculated by the weighing machine.

7. Microsoft Interview Puzzle  - Crossing Bridge Interview Puzzle

The scenario comprises of a wobbly bridge and four people. It is the night time and the people have only one torch. Without torch one may risk his life in crossing the bridge. Also we have a condition; the bridge is not quite strong and can hold only two persons together at one. The four people take different time to cross the bridge - 1 min, 2 min, 7 min and 10 min. 

Since the torch is a necessity and the bride can't hold more than two persons at a time, two persons must travel at a time out of which one must return with the torch so they don't risk their life crossing in the dark.

What is the shortest time that will be required for all of them to cross the bridge?

Solution:
Were you thinking of using the fastest person who takes one minute to travel to and fro till everyone has reached the other end? Yes that can be done but it will take 10 + 1 + 7 + 1 + 2 = 21 minutes in total.

If we pay attention towards finding a way to merge the one taking 7 minutes and the one taking 10 minutes, we will have to acknowledge the fact that one of them will also have to return back which will take much more time than 21 minutes.

What if we use the person taking 2 minutes to escort the one taking 1 minutes across? Let's come to the conclusion:

1 and 2 cross the bridge
2 returns with the torch
7 and 10 cross the bridge
1 comes back
1 and 2 cross the bridge

In such a manner, the total time taken will be
2 + 2 + 10 + 1 + 2 = 17 minutes.

8. Microsoft Interview Puzzle  - Measure the Water Interview Question

You have infinite supply of water. You also have 5 quart and 3 quart buckets. What is the least number of steps you will require to measure precisely 4 quarts?
Solution:
Fill the 3 quart bucket (5 quart bucket has 0 quarts and 3 quart bucket has 3 quarts)

Pour it entirely in the 5 quart bucket (5 quart bucket has 3 quarts and 3 quart bucket has 0 quarts)

Fill the 3 quart bucket (5 quart bucket has 3 quarts and 3 quart bucket has 3 quarts)

Pour the contents to fill the 5 quart bucket (5 quart bucket has 5 quarts and 3 quart bucket has 1 quart)

Empty down the 5 quart bucket (5 quart bucket has 0 quarts and 3 quart bucket has 1 quart)

Pour the water from 1 quart bucket to 5 quart bucket (5 quart bucket has 1 quart and 3 quart bucket has 0 quart)

Fill the 3 quart bucket (5 quart bucket has 1 quart and 3 quart bucket has 3 quarts)

Pour the contents from 3 quart bucket to 5 quart bucket (5 quart bucket has 4 quarts and 3 quart bucket has 0 quarts)

We are done and it took us eight steps to measure exactly 4 quarts of water.

9. Microsoft Interview Puzzle - 2 Eggs Interview Problem

We have an egg problem again. There is a 36 story building for which you have complete access. You have two eggs and you must follow the below facts:

An egg that does not breaks on falling can be re used.

1) A broken egg will be discarded immediately

2) All the eggs will experience the same effect of the fall as all the eggs are identical.

3) Suppose if an egg breaks on falling from first floor, it will definitely break from all the floors above the first floor.

4) If an egg does not breaks from falling from the thirty sixth floor, it will not break from all the floor below it as well.

5) All you have to do is find out the minimum drops with which you can determine the floor which is safe to drop eggs from.

Solution:
The minimum number of drops required are eight.

We will begin from the floor 8. And then if it does not breaks, we will continue in the following fashion

8, (8+7), (8+7+6), (8+7+6+5), (8+7+6+5+4), (8+7+6+5+4+3), (8+7+6+5+4+3+2), (8+7+6+5+4+3+2+1)

= 8, 15, 21, 26, 30, 33, 35, 36

Suppose if the egg breaks from 20th floor
It will not break from eights
It will not break from fifteenth
It will break from twenty first
You will still have one egg remaining

Now start putting from sixteenth floor moving up one floor every time
It will not break till nineteenth and it will break of twentieth floor.

For the worst scenario possible, the maximum number of droppings will be eight only.

10. Microsoft Interview Puzzle - Walking on Globe Interview Puzzle

If you walk one mile south, then one mile east and then one mile north, you reach the place where you started. In such a scenario, how many points are there on the globe to make it happen?
Solution:
Did you consider the southern hemisphere? If you did you must be knowing that there is a ring near the South Pole with a circumference of one mile. Consider the situation that you are standing on one mile north of the ring at any point. Now if you walk on the southern direction and cover one mile, you will be standing on the ring. Traveling one mile east will bring you on the circumference of the ring. Walking one mile north from there, you will be standing on the exact point where you started. Now if you start counting, you will understand that while you walk 1 mile north in the end, you can reach an infinite number of points.

In such a case, the total number of possible points possible are 1 + infinite.

Now let us consider the ring that is half a mile in circumference near the South Pole. If you walk a mile along the ring, you would circle twice but will reach the point where you started from. In such a case if you start from the point that is located one mile north of a half mile ring, it will also help you reach the starting point after traveling as per asked.

Now with every possible integer N, there is a circle with radius R = 1 / 2 (2*pi*n); which is centered at the South Pole.

If you walk along these rings, you will be circling N times and again returning to the point where you started. You must note that the possible values for N are infinite. Also, you can have infinite ways of selecting a starting point which is located one mile north of the rings which means that there are (infinite * infinite) possible points.

Concluding with our statements, the possible number of points are equal to 1 + infinite * infinite which is equal to infinite.

Thus there are infinite points possible. 

Comments