21 January 2011

Interview Puzzles


Q. How many ways are there of arranging the sixteen black or white pieces of a standard international chess set on the first two rows of the board?  Given that each pawn is identical and each rook, knight and bishop is identical to its pair.
Answer6,48,64,800 ways
There are total 16 pieces which can be arranged on 16 places in
16P16 = 16! ways.
(16! = 16 * 15 * 14 * 13 * 12 * ..... * 3 * 2 * 1)

But, there are some duplicate combinations because of identical pieces. There are 8 identical pawn, which can be arranged in
8P8 = 8! ways. Similarly there are 2 identical rooks, 2 identical knights and 2 identical bishops. Each can be arranged in 2P2 = 2! ways.
Hence, the require answer is
= (16!) / (8! * 2! * 2! * 2!)
= 6,48,64,800

Q. A person with some money spends 1/3 for cloths, 1/5 of the remaining for food and 1/4 of the remaining for travel. He is left with Rs 100/-  How much did he have with him in the beginning?
AnswerRs. 250/-
Assume that initially he had Rs. X
He spent 1/3 for cloths =. (1/3) * X
Remaining money = (2/3) * X

He spent 1/5 of remaining money for food = (1/5) * (2/3) * X = (2/15) * X
Remaining money = (2/3) * X - (2/15) * X = (8/15) * X

Again, he spent 1/4 of remaining money for travel = (1/4) * (8/15) * X = (2/15) * X
Remaining money = (8/15) * X - (2/15) * X = (6/15) * X

But after spending for travel he is left with Rs. 100/- So
(6/15) * X = 100
X = 250

Q. Grass in lawn grows equally thick and in a uniform rate. It takes 24 days for 70 cows and 60 days for 30 cows to eat the whole of the grass.  How many cows are needed to eat the grass in 96 days?
Answes: 20 cows
g - grass at the beginning
r - rate at which grass grows, per day
y - rate at which one cow eats grass, per day
n - no of cows to eat the grass in 96 days

From given data,
g + 24*r = 70 * 24 * y - A
g + 60*r = 30 * 60 * y - B
g + 96*r = n * 96 * y - C

Solving for (B-A),
(60 * r) - (24 * r) = (30 * 60 * y) - (70 * 24 * y)
36 * r = 120 * y - D

Solving for (C-B),
(96 * r) - (60 * r) = (n * 96 * y) - (30 * 60 * y)
36 * r = (n * 96 - 30 * 60) * y
120 * y = (n * 96 - 30 * 60) * y [From D]
120 = (n * 96 - 1800)
n = 20

Hence, 20 cows are needed to eat the grass in 96 days.

Q. There is a safe with a 5 digit number as the key. The 4th digit is 4 greater than the second digit, while the 3rd digit is 3 less than the 2nd digit. The 1st digit is thrice the last digit. There are 3 pairs whose sum is 11. Find the number.
Answer: 65292
As per given conditions, there are three possible combinations for 2nd, 3rd and 4th digits. They are (3, 0, 7) or (4, 1, 8) or (5, 2, 9)

It is given that there are 3 pairs whose sum is 11. All possible pairs are (2, 9), (3, 8), (4, 7), (5, 6). Now required number is 5 digit number and it contains 3 pairs of 11. So it must not be having 0 and 1 in it. Hence, the only possible combination for 2nd, 3rd and 4th digits is (5, 2, 9)

Also, 1st digit is thrice the last digit. The possible combinations are (3, 1), (6, 2) and (9, 3), out of which only (6, 2) with (5, 2, 9) gives 3 pairs of 11. Hence, the answer is 65292.

Arjan, Bhuvan, Guran and Lakha had 90, 50, 55 and 45 sheep respectively.
  Assume that Arjan, Bhuvan, Guran and Lakha had A, B, G and L sheep respectively. As it is given that at the end each would have an equal number of sheep, comparing the final numbers from the above table.
Arjan's sheep = Bhuvan's sheep
2A/3 = A/4 + 3B/4
8A = 3A + 9B
5A = 9B

Arjan's sheep = Guran's sheep
2A/3 = A/15 + B/5 + 4G/5
2A/3 = A/15 + A/9 + 4G/5 (as B=5A/9)
30A = 3A + 5A + 36G
22A = 36G
11A = 18G

Arjan's sheep = Lakha's sheep
2A/3 = A/60 + B/20 + G/5 + L
2A/3 = A/60 + A/36 + 11A/90 + L (as B=5A/9 and G=11A/18)
2A/3 = A/6 + L
A/2 = L
A = 2L

Also, it is given that Guran had ten more sheep than Lakha.
G = L + 10
11A/18 = A/2 + 10
A/9 = 10
A = 90 sheep

Thus, Arjan had 90 sheep, Bhuvan had 5A/9 i.e. 50 sheep, Guran had 11A/18 i.e. 55 sheep and Lakha had A/2 i.e. 45 sheep.

Q. Consider a number 235, where last digit is the sum of first two digits i.e. 2 + 3= 5. Find the smallest number such that if its rightmost digit is placed at its left end, the new number so formed is precisely 50% larger than the original number.
Answer: 285714.

If its rightmost digit is placed at its left end, then new number is 428571 which is 50% larger than the original number 285714

Q. The simplest way is to write a small program. And the other way is trial and error!!! Two identical pack of cards A and B are shuffled thoroughly. One card is picked from A and shuffled with B. The top card from pack A is turned up. If this is the Queen of Hearts, what are the chances that the top card in B will be the King of Hearts?
Answer: 52 / 2703

There are two cases to be considered.
CASE 1 : King of Hearts is drawn from Pack A and shuffled with Pack B
Probability of drawing King of Hearts from Pack A = 1/51 (as Queen of Hearts is not to be drawn)
Probability of having King of Hearts on the top of the Pack B = 2/53

So total probability of case 1 = (1/51) * (2/53) = 2 / (51 * 53)
CASE 2 : King of Hearts is not drawn from Pack A
Probability of not drawing King of Hearts from Pack A = 50/51 (as Queen of Hearts is not to be drawn)
Probability of having King of Hearts on the top of the Pack B = 1/53

So total probability of case 2 = (50/51) * (1/53) = 50 / (51 * 53)
Now adding both the probability, the required probability is
= 2 / (51 * 53) + 50 / (51 * 53)
= 52 / (51 * 53)
= 52 / 2703
= 0.0192378

Q. There is a 4-character code, with 2 of them being letters and the other 2 being numbers.  How many maximum attempts would be necessary to find the correct code? Note that the code is case-sensitive.
Answer: The maximum number of attempts required are 16,22,400

There are 52 possible letters - a to z and A to Z, and 10 possible numbers - 0 to 9. Now, 4 characters - 2 letters and 2 numbers, can be selected in 52*52*10*10 ways. These 4 characters can be arranged in
4C2 i.e. 6 different ways - the number of unique patterns that can be formed by lining up 4 objects of which 2 are distinguished one way (i.e. they must be letters) and the other 2 are distinguished another way (i.e. they must be numbers).

Consider an example : Let's assume that @ represents letter and # represents number. the 6 possible ways of arranging them are : @@##, @#@#, @##@, #@@#, #@#@, ##@@

Hence, the required answer is
= 52*52*10*10*6
= 16,22,400 attempts
= 1.6 million approx.


Q. How many possible combinations are there in a 3x3x3 rubics cube?  In other words, if you wanted to solve the rubics cube by trying different combinations, how many might it take you (worst case senerio)? How many for a 4x4x4 cube?
Answer: There are 4.3252 * 10^19 possible combinations for 3x3x3 Rubics and 7.4012 * 10^45 possible combinations for 4x4x4 Rubics.

Let's consider 3x3x3 Rubics first.
There are 8 corner cubes, which can be arranged in 8! ways.
Each of these 8 cubes can be turned in 3 different directions, so there are 3^8 orientations altogether. But if you get all but one of the corner cube into chosen positions and orientations, only one of 3 orientations of the final corner cube is possible. Thus, total ways corner cubes can be placed = (8!) * (3^8)/8 = (8!) * (3^7)

Similarly, 12 edge cubes can be arranged in 12! ways.
Each of these 12 cubes can be turned in 2 different directions, so there are 2^12 orientations altogether. But if you get all but one of the edge cube into chosen positions and orientations, only one of 2 orientations of the final edge cube is possible. Thus, total ways edge cubes can be placed = (12!) * (2^12)/2 = (12!) * (2^11)

Here, we have essentially pulled the cubes apart and stuck cubes back in place wherever we please. In reality, we can only move cubes around by turning the faces of the cubes. It turns out that you can't turn the faces in such a way as to switch the positions of two cubes while returning all the others to their original positions. Thus if you get all but two cubes in place, there is only one attainable choice for them (not 2!). Hence, we must divide by 2.

Total different possible combinations are
= [(8!) * (3^7)] * [(12!) * (2^11)] / 2
= (8!) * (3^7) * (12!) * (2^10)
= 4.3252 * 10^19


Similarly, for 4x4x4 Rubics total different possible combinations are
= [(8!) * (3^7)] * [(24!)] * [(24!) / (4!^6)] / 24
= 7.4011968 * 10^45

Note that there are 24 edge cubes, which you can not turn in 2 orientations (hence no 2^24 / 2). Also, there are 4 center cubes per face i.e. (24!) / (4!^6). You can switch 2 cubes without affecting the rest of the combination as 4*4*4 has even dimensions (hence no division by 2). But pattern on one side is rotated in 4 directions over 6 faces, hence divide by 24.

Q. Substitute digits for the letters to make the following relation true.
N E V E R
L E A V E
+ M E
---------------
A L O N E
Note that the leftmost letter can't be zero in any word. Also, there must be a one-to-one mapping between digits and letters. e.g. if you substitute 3 for the letter M, no other letter can be 3 and all other M in the puzzle must be 3.
Answer: A tough one!!!

Since R + E + E = 10 + E, it is clear that R + E = 10 and neither R nor E is equal to 0 or 5. This is the only entry point to

solve it. Now use trial-n-error method.
N E V E R 2 1 4 1 9
L E A V E 3 1 5 4 1
+ M E + 6 1
-------- --------
A L O N E 5 3 0 2 1

Q. One of the four people - Mr. Clinton, his wife Monika, their son Mandy and their daughter Cindy - is a singer and another is a dancer. Mr. Clinton is older than his wife and Mady is older than his sister. If the singer and the dancer are the same sex, then the dancer is older than the singer. If neither the singer nor the dancer is the parent of the other, then the singer is older than the dancer. If the singer is a man, then the singer and the dancer are the same age. If the singer and the dancer are of opposite sex then the man is older than the woman. If the dancer is a woman, then the dancer is older than the singer. Whose occupation do you know? And what is his/her occupation?
AnswerCindy is the Singer. Mr. Clinton or Monika is the Dancer.

From (1) and (3), the singer and the dancer, both can not be a man. From (3) and (4), if the singer is a man, then the dancer must be a man. Hence, the singer must be a woman.
CASE I : Singer is a woman and Dancer is also a woman  Then, the dancer is Monika and the singer is Cindy.
CASE II : Singer is a woman and Dancer is also a man Then, the dancer is Mr. Clinton and the singer is Cindy.

In both the cases, we know that Cindy is the Singer. And either Mr. Clinton or Monika is the Dancer.

Q. There are 20 people in your applicant pool, including 5 pairs of identical twins.  If you hire 5 people randomly, what are the chances you will hire at least 1 pair of identical twins? (Needless to say, this could cause trouble ;))
Answer: The probability to hire 5 people with at least 1 pair of identical twins is 25.28%

5 people from the 20 people can be hired in 20C5 = 15504 ways.
Now, divide 20 people into two groups of 10 people each :
G1 - with all twins
G2 - with all people other than twins

Let's find out all possible ways to hire 5 people without a single pair of indentical twins.

People from G1 People from G2 No of ways to hire G1 without a single pair of indentical twins No of ways to hire G2 Total ways
0 5 10C0 10C5 252
1 4 10C1 10C4 2100
2 3 10C2 * 8/9 10C3 4800
3 2 10C3 * 8/9 * 6/8 10C2 3600
4 1 10C4 * 8/9 * 6/8 * 4/7 10C1 800
5 0 10C5 * 8/9 * 6/8 * 4/7 * 2/6 10C0 32
Total 11584


Thus, total possible ways to hire 5 people without a single pair of indentical twins = 11584 ways

So, total possible ways to hire 5 people with at least a single pair of indentical twins = 15504 - 11584 = 3920 ways

Hence, the probability to hire 5 people with at least a single pair of indentical twins
= 3920/15504
= 245/969
= 0.2528
= 25.28%

Q. In a hotel, rooms are numbered from 101 to 550. A room is chosen at random. What is the probability that room number starts with 1, 2 or 3 and ends with 4, 5 or 6?
Answer: There are total 450 rooms.

Out of which 299 room number starts with either 1, 2 or 3. (as room number 100 is not there) Now out of those 299 rooms only 90 room numbers end with 4, 5 or 6

So the probability is 90/450 i.e. 1/5 or 0.20

Draw 9 dots on a page, in the shape of three rows of three dots to form a square. Now place your pen on the page, draw 4 straight lines and try and cover all the dots. You're not allowed to lift your pen.
Note: Don't be confined by the dimensions of the square.

Q. There are 3 persons X, Y and Z. On some day, X lent tractors to Y and Z as many as they had. After a month Y gave as many tractors to X and Z as many as they have. After a month Z did the same thing. At the end of this transaction each one of them had 24. Find the tractors each originally had?
Answer: One way to solve it is by making 3 equations and solve them simultaneously. But there is rather easier way to solve it using Backtracing.

It's given that at the end, each had 24 tractors (24, 24, 24) i.e. after Z gave tractors to X & Y as many as they had. It means that after getting tractors from Z their tractors got doubled. So before Z gave them tractors, they had 12 tractors each and Z had 48 tractors. (12, 12, 48)

Similarly, before Y gave tractors to X & Z, they had 6 & 24 tractors respectively and Y had 42 tractors i.e. (6, 42, 24)

Again, before X gave tractors to Y & Z, they had 21 & 12 tractors respectively and X had 39 tractors i.e. (39, 21, 12)

Hence, initially
X had 39 tractors, Y had 21 tractors and Z had 12 tractors.

Q. You have 14 apples. Your Friend Marge takes away 3 and gives you 2. You drop 7 but pick up 4. Bret takes 4 and gives 5. You take one from Marge and give it to Bret in exchange for 3 more. You give those 3 to Marge and she gives you an apple and an orange. Frank comes and takes the apple Marge gave you and gives you a pear. You give the pear to Bret in exchange for an apple. Frank then takes an apple from Marge, gives it to Bret for an orange, gives you the orange for an apple.  How many pears do you have?
Answer: None

Frank gave you a pear in exchange of the apple which Marge gave you. And you gave that pear to Bret in exchange for an apple. All the others exchanges involved apples and/or organges.
Four couples are going to the movie. Each row holds eight seats. Betty and Jim don't want to sit next to Alice and Tom. Alice and Tom don't want to sit next to Gertrude and Bill. On the otherhand, Sally and Bob don't want to sit next to Betty and Jim.

Q. There were N stations on a railroad. After adding X stations 46 additional tickets have to be printed. Find N and X.
Answer:  Let before adding X stations, total number of tickets
t = N(N-1)

After adding X stations total number of tickets are
t + 46 = (N+X)(N+X-1)

Subtracting 1st from 2nd
46 = (N+X)(N+X-1) - N(N-1)
46 = N
2 + NX - N + NX + X2 - X - N2 + N
46 = 2NX + X
2 - X
46 = (2N - 1)X + X
2
X
2 + (2N - 1)X - 46 = 0

Now there are only two possible factors of 46. They are (46,1) and (23,2)

Case I: (46,1)
2N - 1 = 45
2N = 46
N = 23
And X = 1

Case II: (23,2)
2N - 1 = 21
2N = 22
N = 11
And X = 2

Hence, there are 2 possible answers.

Q. An emergency vehicle travels 10 miles at a speed of 50 miles per hour. How fast must the vehicle travel on the return trip if the round-trip travel time is to be 20 minutes?
Answer : 75 miles per hour
While going to the destination, the vehicle travels 10 mils at the speed of 50 miles per hour. So the time taken to travel 10 miles is
= (60 * 10) / 50
= 12 minutes

Now it's given that round-trip travel time is 20 minutes. So the vehicle should complete its return trip of 10 miles in 8 minutes. So the speed of the vehicle must
= (60 * 10) / 8
= 75 miles per hour

Q. All of the students at a college are majoring in psychology, business, or both. 73% of the students are psychology majors, & 62% are business majors. If there are 200 students, how many of them are majoring in both psychology & business?
Answer: 70 students are majoring in both, psychology & business

If 73% of the students are psychology majors, we know that 27% are not psychology majors. By the same reasoning, 38% are not business majors, because 62% of the students do major in business. So: 27 + 38 = 65

65% of the students are not majoring in both psychology & business, so 35% are double majors, a total of 70 students.

Q. Karan bought a little box of midget matches, each one inch in length. He found that he could arrange them all in the form of a triangle whose area was just as many square inches as there were matches.  He then used up six of the matches, and found that with the remainder he could again construct another triangle whose area was just as many square inches as there were matches.  And using another six matches he could again do precisely the same. How many matches were there in the box originally?

Note that the match-box can hold maximum of 50 matches.
Answer: Initially, there were 42 or 36 matches in the match-box.

There are 42 matches in the box with which he could form a triangle 20, 15, 7, with an area of 42 square inches. After 6 matches had been used, the remaining 36 matches would form a triangle 17, 10, 9, with an area of 36 square inches. After using another 6 matches, the remaining 30 matches would form a triangle 13, 12, 5, with an area of 30 square inches. After using another 6, the 24 remaining would form a triangle 10, 8, 6, with an area of 24 square inches.

Thus, there are two possible answers. There were either 42 or 36 matches in the match-box.


Q. Mr. Black, Mr. White and Mr. Grey were chatting in the Yahoo conference. They were wearing a black suit, a white suit and a grey suit, not necessarily in the same order. Mr. Grey sent message, "We all are wearing suit that are of the same color as our names but none of us is wearing a suit that is the same color as his name."  On that a person wearing the white suit replied, "What difference does that make?" Can you tell what color suit each of the three persons had on?
Answer:  Mr. Grey is wearing Black suit.
Mr. White is wearing Grey suit.
Mr. Black is wearing White suit.


Mr. Grey must not be wearing grey suit as that is the same colour as his name. Also, he was not wearing white suit as the person wearing white suit responded to his comment. So Mr Grey must be wearing a black suit.

Similarly, Mr. White must be wearing either black suit or grey suit. But Mr. Grey is wearing a black suit. Hence, Mr. White must be wearing a grey suit.

And, Mr. Black must be wearing white suit

No comments:

Post a Comment