Saturday, July 30, 2011

Microsoft Interview Questions

Clock Hands

How many times a day do the minute and hour hands of a clock overlap? Answer

Is Your Husband a Cheat?

A certain town comprises of 100 married couples. Everyone in the town lives by the following rule: If a husband cheats on his wife, the husband is executed as soon as his wife finds out about him. All the women in the town only gossip about the husbands of other women. No woman ever tells another woman if her husband is cheating on her. So every woman in the town knows about all the cheating husbands in the town except her own. It can also be assumed that a husband remains silent about his infidelity. One day, the mayor of the town announces to the whole town that there is at least 1 cheating husband in the town. What do you think happens? Answer

100 Prisoners in Solitary Cells

100 prisoners are stuck in the prison in solitary cells. The warden of the prison got bored one day and offered them a challenge. He will put one prisoner per day, selected at random (a prisoner can be selected more than once), into a special room with a light bulb and a switch which controls the bulb. No other prisoners can see or control the light bulb. The prisoner in the special room can either turn on the bulb, turn off the bulb or do nothing. On any day, the prisoners can stop this process and say “Every prisoner has been in the special room at least once”. If that happens to be true, all the prisoners will be set free. If it is false, then all the prisoners will be executed. The prisoners are given some time to discuss and figure out a solution. How do they ensure they all go free? Answer

The Ant Problem

Three ants are sitting at the three corners of an equilateral triangle. Each ant starts randomly picks a direction and starts to move along the edge of the triangle. What is the probability that none of the ants collide? Answer

Gold for 7 days of Work

You’ve got someone working for you for seven days and a gold bar to pay them. You must pay the worker for their work at the end of every day. If you are only allowed to make two breaks in the gold bar, how do you pay your worker? (Assuming equal amount of work is done during each day thus requiring equal amount of pay for each day) Answer

Trains and Birds

A train leaves City X for City Y at 15 mph. At the very same time, a train leaves City Y for City X at 20 mph on the same track. At the same moment, a bird leaves the City X train station and flies towards the City Y train station at 25 mph. When the bird reaches the train from City Y, it immediately reverses direction. It then continues to fly at the same speed towards the train from City X, when it reverses its direction again, and so forth. The bird continues to do this until the trains collide. How far would the bird have traveled in the meantime? Answer

A Box of Defective Balls

You have 10 boxes of balls (each ball weighing exactly10 gm) with one box with defective balls (each one of the defective balls weigh 9 gm). You are given an electronic weighing machine and only one chance at it. How will find out which box has the defective balls? Answer

Globe Walker

How many points are there on the globe where, by walking one mile south, then one mile east and then one mile north, you would reach the place where you started? Answer

4 Quarts of Water

If you had an infinite supply of water and a 5 quart and 3 quart pails, how would you measure exactly 4 quarts? and What is the least number of steps you need? Answer

Four People on a Rickety Bridge

Four people need to cross a rickety bridge at night. Unfortunately, they have only one torch and the bridge is too dangerous to cross without one. The bridge is only strong enough to support two people at a time. Not all people take the same time to cross the bridge. Times for each person: 1 min, 2 mins, 7 mins and 10 mins. What is the shortest time needed for all four of them to cross the bridge? Answer

The McNugget Problem

When Mr. Rice was a high schooler, Mc. Donald’s introduced the Chicken Mc. Nugget. At that time, Mc. Nuggets came in boxes of 6 pieces, 9 pieces, and 20 pieces. It may astonish you to discover that in high school Mr. Rice was kind of a geek. One day while he was sitting in Mc. Donald’s with his just as geeky friends, they tried to figure out something about Chicken Mc. Nuggets. Buying only whole boxes (that means 6, 9, or 20 pieces), what is the largest number of Chicken Mc. Nuggets you CANNOT buy?

As an example, you cannot buy 1 Mc. Nugget, you cannot buy 7 Mc. Nuggets, but you can buy 15 Mc. Nuggets (a box of 6 and a box of 9).

So, once again, what is the largest number of Chicken Mc. Nuggets you CANNOT buy, when you are only buying whole boxes of 6 pieces, 9 pieces, and 20 pieces?

You can use the matrix below to help you. There is a pattern that you can use to find the solution. You need to be able to explain to me how you got your answer.

1

7

13

19

25

31

37

43

49

55

61

67

73

79

85

91

97

2

8

14

20

26

32

38

44

50

56

62

68

74

80

86

92

98

3

9

15

21

27

33

39

45

51

57

63

69

75

81

87

93

99

4

10

16

22

28

34

40

46

52

58

64

70

76

82

88

94

100

5

11

17

23

29

35

41

47

53

59

65

71

77

83

89

95

101

6

12

18

24

30

36

42

48

54

60

66

72

78

84

90

96

102

Answer:

The smallest number you can buy is 6. So, if you can buy 6, you can buy 12, 18, 24, 30, etc. That means you can cross our all the numbers on that line. The next number you can buy is 9. So if you can buy 9, you can buy 15, 21, 27, 33, etc. So you can cross out all the numbers on that line also. The next number you can buy is 20. So if you can buy 20, you can buy 26, 32, 38, etc. So you can cross out all the numbers on that line. The next number you can buy is 29 (a box of 20 and a box of 9). So if you can buy 29, you can buy 35, 41, 47, etc. So you can cross out all the numbers on that line. The next number you can buy is 40 (2 boxes of 20). If you can buy 40, you can buy 46, 52, 58, etc. The next number you can buy is 49 (2 boxes of 20 and a box of 9). So if you can buy 49, you can buy 55, 61, 67, etc. You can cross everything on that line out.

Now that you all of these numbers crossed out, you will see that 43 is the largest number left. That means that the largest number of McNuggets that you CANNOT buy when they are sold in boxes of 6, 9, and 20, is 43. You can buy every other number greater than that. That leads us to a way more important question; what part of the chicken does the McNugget come from?

Who Owns the Fish?

It is your worst nightmare!! All of your most demanding teachers live on one street. That way, they can plan on how to make the lives of the students miserable.

1. The teachers are: Mr. Bird, Ms. Lessig, Mr. Moriarty, Mr. Rice, & Ms. Riggin.

2. Along the street there are 5 houses of 5 different colors: blue, green, red, white and yellow.

3. Each of the 5 teachers drinks a certain beverage: beer, coffee, milk, tea, and water.

4. Each teacher has a certain type of car: Chevy, Ford, Honda, Nissan, & Toyota.

5. Each teacher has a different pet: cat, bird, dog, fish, and horse.

6. No teachers have the same pet, the same car, or drink the same beverage.

7. Mr. Rice lives in a red house.

8. Ms. Riggin has dogs as pets.

9. Ms. Lessig drinks tea.

10. The green house is right of the white house (next to it).

11. The green house owner drinks coffee

12. The teacher who drives the Nissan rears birds.

13. The owner of the yellow house drives a Toyota.

14. The teacher living in the house right in the center drinks milk.

15. Mr. Bird lives in the first house.

16. The teacher who drives the Chevy lives next to the teacher who keeps cats.

17. The teacher who keeps a horse lives next to the teacher who drives the Toyota.

18. The teacher who drives the Ford drinks beer.

19. Mr. Moriarty drives a Honda.

20. Mr. Bird lives next to the blue house.

21. The teacher who drives the Chevy has a neighbor who drinks water.

THE QUESTION IS: WHICH TEACHER OWNS THE FISH?

ANSWERS

House 1

House 2

House 3

House 4

House 5

Teacher

Mr. Bird

Ms. Lessig

Mr. Rice

Ms. Riggin

Mr. Moriarty

House Color

Yellow

Blue

Red

White

Green

Pet

Cats

Horses

Birds

Dogs

Fish

Drink

Water

Tea

Milk

Beer

Coffee

Car

Toyota

Chevy

Nissan

Ford

Honda