It is all about interview puzzles and HR questions .

Saturday, 31 March 2018

The king and 1000 bottle of wine


Puzzle :-

A king has 1000 bottles of very expensive wine. One of the bottle got poisoned accidentally. Unfortunately, the king does not know which bottle of wine is poisoned . The king decided to use 10 prisoner as taste tester to find the poisoned bottle. The effect of poison is seen only after 24 hours. The king only has 24 hours to find the poisoned bottle.
How can king do this?

Understanding of the puzzle.

We have 1000 bottles of wine, one of which is poisoned and we need to test all of the wine bottles using only 10 prisoners.
We have  only 24 hour to test the wine since effect of prisoner wine is observable only after 24 hours.
There is not enough time nor enough prisoner to test the wine one by one.
Hint :
Number each of the bottle from 1 to 1000.
Write the binary number representation of each bottle corresponding to it's number.
log 1000 with base 2 =9.96=10 (we have enough prisoner)
Answer : -
Assign each prisoner as a placeholder in the binary numbers so formed.
Prisoner 1 is assigned binary place 1
Prisoner 2 is assigned binary place2
Prisoner 3 is assigned binary place3
And so on...
Each prisoner will taste the wine from the bottle if the number on the at the binary place assigned to him is 1 otherwise if it is 0,he doesn't take a sip.
Example consider a bottle number 427
binary form of 427 is 0110101011
 Wait for 24 hours .
If 1st,2nd,4th,6th,8th and 9th prisoner died it means bottle no. 427 is poisoned.
Consider another case:
When  3rd,5th,6th and 8th prisoner Died. It means poisoned bottle would be :
10  9  8  7  6  5  4  3  2  1
 0   0  1  0  1  1  0  1  0  0
0010110100=180
Hence 180th bottle is poisoned. 

Two doors-heaven and hell

Puzzle :-

You are standing before two doors.
One of the path leads to heaven and the other one leads to hell.
There are two guards standing one by each door.
You know one of them always tells the truth and the other always lies, but you don't know who is the honest one and who is the liar.
You can only ask one question to one of them in order to find way to heaven.
What will you ask in order to determine which door leads to heaven?

Hint : -
Try to ask a question in which both the gate keepers will give you same answer.

Answer :-

Ask one of the guard,
" what would be the other guard say if a ask him which way is the hell?  "

And whatever answer he gives that is the way to heaven.

Explanation :-
1.
If you end up asking the question to the truthful one, he will tell the truth and he knows the other guard is going to lie(truth (i.e. other guard will tell the way to heaven when asked for way to hell) so truth will show the way to heaven.
2.
If you end up asking the question to the liar he will lie and he knows the other guard is going to tell truth (i.e.
Other guard will tell the way to hell)
So liar guard will show the way to heaven. 

Friday, 30 March 2018

In a country every one wants a boy

puzzle :-
In a country where everyone wants a boy, each family continues having babies till they have a boy. After some time, what is the proportion of boys to girls in the country? (Assuming probability of having a boy or a girl is the same)

Answer:-
This is a very simple probability question .
Assume there are C number of couples so there would be C boys. The number of girls can be calculated by the following method.
Number of girls = 0*(Probability of 0 girls) + 1*(Probability of 1 girl) + 2*(Probability of 2 girls) + …
Number of girls = 0*(C*1/2) + 1*(C*1/2*1/2) + 2*(C*1/2*1/2*1/2) + …
Number of girls = 0 + C/4 + 2*C/8 + 3*C/16 + …
Number of girls = C
(using mathematical formulas; it becomes apparent if you just sum up the first 4-5 terms)
The proportion of boys to girls is 1 : 1.

four people crossing a bridge

puzzle :-
 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 initial solution most people will think of is to use the fastest person as an usher to guide everyone across. How long would that take? 10 + 1 + 7 + 1 + 2 = 21 mins. Is that it? No. That would make this question too simple even as a warm up question.
Let’s brainstorm a little further. To reduce the amount of time, we should find a way for 10 and 7 to go together. If they cross together, then we need one of them to come back to get the others. That would not be ideal. How do we get around that? Maybe we can have 1 waiting on the other side to bring the torch back. Ahaa, we are getting closer. The fastest way to get 1 across and be back is to use 2 to usher 1 across. So let’s put all this together.
1 and 2 go cross
2 comes back
7 and 10 go across
1 comes back
1 and 2 go across (done)
Total time = 2 + 2 + 10 + 1 + 2 = 17 mins

The boy ended up paying the man $50

puzzle :-

A boy was at a carnival and went to a booth where a man said to the boy, 'If I write your exact weight on this piece of paper then you have to give me $50, but if I cannot, I will pay you $50.' The boy looked around and saw no scale so he agrees, thinking no matter what the carny writes he'll just say he weighs more or less. In the end the boy ended up paying the man $50. How did the man win the bet?

Answer :-

the man did exactly as he said he would and wrote 'your exact weight' on the paper.

Who is the boy and who is the girl ?


  Puzzle :-


A boy and a girl are talking.

"I am a boy" - said the child with black hair.

"I am a girl" - said the child with white hair.

At least one of them lied. Who is the boy and who is the girl?

Answer :-
they both lied(I said atleast )
if only one lied they would both be boys or both be girls.

which box has the defective balls?

 puzzle :- Defective Balls

 You have 10 boxes of balls (each ball weighing exactly 10 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:-
 For convenience sake, let’s name the boxes from 1 to 10. In order to solve this problem, you have to leverage the fact that you know exactly what each good ball is supposed to weigh and what each defective ball is supposed to weigh. Many of us instinctively will take one ball out of each box and try to find a way to make it work but the trick to take different number of balls from each box.
The number of balls you pick from each bag is equal to the box number. For example, pick 1 ball from box 1, 2 balls from box 2 and so on. In total you will have 55 balls. If all of the boxes have good balls, then the total weight of these balls would be 550gm.
If box 1 has defective balls, then the total weight should be 1gm less than expected (only one ball weighing 9 gm). If box 2 has defective balls, then the total weight should be 2gm less than expected (two balls weighing 9 gm). So once you weigh the set of chosen balls, find out the difference between the total weight and the expected weight. That number represents the box number which contains the defective balls.

How far would the bird have traveled in the meantime?



puzzle :-

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: -
Yes, you read it right. The bird is actually the fastest moving object in the problem!
Knowing that the bird is the faster than both the trains, you would only imagine that theoretically, the bird could fly an infinite number of times between the trains before they collide. This is because you know that no matter how close the trains get, the bird will always complete its trip before the crash happens. At the time of the crash, the bird would probably get squashed between the trains!
I bet sometime in school, you learnt how to sum up an infinite series. But do we have to do that?
The concept of relative speed (rings a bell?) can work handy here. Let’s assume that the distance between City X and City Y is d miles. The trains are approaching each other at a relative speed of (20 + 15) = 35 mph. The sum of the distances covered by the trains when they collide is d (i.e. the distance between the cities). Since distance/speed gives us time, we know that the trains collide d/35 hours after they start.Since the speed of the bird is constant at 25 mph, we know that the bird would have covered
25 * (d/35) miles = 5d/7 miles
before the trains collide.

objective is to pour exactly 7 litres of water in a bucket

puzzle:-
There are 2 jugs with 4 litres and 5 litres of water respectively. The objective is to pour exactly 7 litres of water in a bucket. How can it be accomplished?

Answer :-
 The approach here is to initially fill the 5L jug with water and empty the same into the 4L jug. The 5L jug will be left with 1L of water, which is poured into the bucket. Meanwhile, empty the 4L jug.

What did he write?


 Brilliant Student Puzzle :-


There was once a college that offered a class on probability applied to the real world.The class was relatively easy, but there was a catch. There were no homework assignments or tests, but there was a final exam that would have only one question on it.When everyone received the test it was a blank sheet of paper with a solitary question on it: 'What is risk?'.Most students were able to pass, but only one student received 100% for the class! Even stranger was that he only wrote down one word!
                What did he write?

Answer :-

brilliant student wrote down:'This.'

Tuesday, 20 March 2018

How many days would he to come out of the well ?


Puzzle :-

A man fell in a 30 meter deep well, in one day he climbs 4 meters up and slips 3 meters down. How many days would he to come out of the well ?
 Answer :-
He  will take 27 days to come out of that well for that man,
He climbs 4 meter every day and slips 3 meter down that means he  climbs 1 meter in total each day, so like this on 26th day he would have climbed 26 meter and on 27th day he will climb 4 meeter again so total 30 meter he will climb in 27 days.


=====================================================================




====================================================================

bob is the first person in the line

puzzle:-
People are waiting in line to board a 100-seat aeroplane. bob is the first person in the line. He gets on the plane but suddenly can’t remember what his seat number is, so he picks a seat at random. After that, each person who gets on the plane sits in their assigned seat if it’s available, otherwise they will choose an open seat at random to sit in.
The flight is full and you are last in line. What is the probability that you get to sit in your assigned seat?

Answer :-
The probability is indeed 1/2. There are two things to realize:
1. The probability that bob chooses his assigned seat is equal to the probability that he chooses your assigned seat.
2. In case that bob would choose neither his own seat nor yours, then there are two alternatives: if somebody else would choose bob’s seat at random, then you would get your assigned seat; otherwise you would be left with the bob’s seat.
With that being said, we can go on to find out the probability. With every person choosing a seat at random (including bob), there are there possible outcomes:
1. either he chooses your assigned seat, or
2. chooses the bob’s seat, or
3. chooses someone else’s seat.
Notice, that the probability of choosing bob’s seat is always equal to probability of taking your seat. That means that the probability of you getting your seat vs. not, is even. The case of a passenger choosing someone else’s seat doesn’t affect your final outcome in either way, it just passes that three possible alternatives to the next passenger.
Since the probability of someone taking your place is always equal to the probability of someone taking bob’s place (and this also applies to the penultimate passenger with only two seats left), the probability of you getting your assigned seat is in the end 50%

=====================================================================

====================================================================

When was the last palindrome date before 10/02/2001?



Puzzle :- (Last Palindrome Date Before 10/02/2001)


In year 2001 on October 2, 2001, the date in MMDDYYYY format was a palindrome (same forwards as backwards), 10/02/2001 -> “10022001”
When was the last palindrome date before 10/02/2001?


Answer :-
One year can have only one palindrome as the year fixes the month and date too, so the year has to be less than 2001 since we already have the palindrome for 10/02. It can’t be any year in 1900 because that would result in a day of 91, same for 1800 down to 1400. it could be a year in 1300 because that would be the 31st day.
So what’s the latest year in 1300 that would make a month?
When you first look at it, 12th month comes to mind as we have to find the latest date, so it seems it would be 1321. But we have to keep in mind that we want the maximum year in 1300 century with a valid date, so lets think about 1390 that will give the date as 09/31, is this a valid date…? No, because September has only 30 days, so last will be the 31st August. Which means the correct date would be 08/31/1380


=====================================================================
=====================================================================

A building of 100 floors

Puzzle :-

There is a building of 100 floors
-If an egg drops from the Nth floor or above it will break.
-If it’s dropped from any floor below, it will not break.
You’re given 2 eggs.
Find N
How many drops you need to make?
What strategy should you adopt to minimize the number egg drops it takes to find the solution?


Answer is 14 :-

In worst case it will take 14 egg drops to find the value of N.
This follows the below logic.
Say, the egg breaks at floor n we try to find out by going (N-1) till the first floor by doing linear search.
Say for example, I throw the egg from 10th floor, and it breaks, I wíll go to floor 1 to 9 to find out the floor..
Then I would try the same logic for every 10 floors thereby setting a worst case scenario of 19 chances.. I.e. 10,20,30,40,50,60,70,80,90,100,91,92,93,94,95,96,97,98,99
To find optimum solution, let’s try this:
If for every n, egg doesnt break, instead of going to next n, go to N-1, this would save us one drop as we are doing a linear search with second egg when egg1 breaks…
So the series would look something like this..
N + (N-1) + (N-2) + (N-3) +…+ 1
Now this is a series which is equal to N(N+1)/2
Now since it is given that the egg may or may not break from 100th floor..
We can write it as..
N(N+1)/2>=100
And n=14(approx)
So we should start from 14 then move up N-1 to 13 floor I.e. 27,39…
So the floors from where the drop needs to be done are: 14,27,39,50,60,69,77,84,90,95,99,100
So the answer is 14


======================================================================
====================================================================

What are the other pages that this sheet contains?

puzzle :-
 A newspaper made of 16 large sheets of paper folded in half. The newspaper has 64 pages altogether. The first sheet contains pages 1, 2, 63, 64.
If we pick up a sheet containing page number 45. What are the other pages that this sheet contains?

Answer :-
On the back of 45, it is 46. The numbers are arranged in pairs, with the first pair adding up to 64 and the second pair adding up to 66.


Then,
64-45 = 19
66-46 = 20
So the four pages in this sheet are 19, 20, 45, 46.

====================================================================

===================================================================

Sunday, 18 March 2018

What is the probability that the other child is also a boy?

Puzzle :-

Chances Of Second boy Child Problem
James and Calie are a married couple.
They have two children, one of the child is a boy. Assume that the probability of each gender is 1/2.
What is the probability that the other child is also a boy?

Answer : 1/3




Solution :-

This is a famous question in understanding conditional probability, which simply means that given some information you might be able to get a better estimate.



The following are possible combinations of two children that form a sample space in any earthly family:

Boy – Girl
Girl – Boy
Boy – Boy
Girl – Girl

Since we know one of the children is a boy, we will drop the girl-girl possibility from the sample space.
This leaves only three possibilities, one of which is two boys. Hence the probability is 1/3

========================================================================



========================================================================

Muddy Heads



Puzzle : -   


A mother tells her two children, a boy and a girl, to play without getting dirty.
However, while playing, both children get mud on their foreheads.
The mother says “At least one of you has a muddy forehead”. She then asks the children to answer “Yes” or “No” to the question: “Do you know whether you have a muddy forehead?”
The mother asks this question twice.
What will the children answer each time this question is asked, assuming that a child can see whether his/her sibling has a muddy forehead, but cannot see his or her own forehead? Assume that both children are honest and that the children answer each question simultaneously.

Solution:-
Let s be the statement that the son has a muddy forehead and let d be the statement that the daughter has a muddy forehead. When the mother says that at least one of the two children has a muddy forehead, she is stating that the disjunction s ∨ d is true.
Both children will answer “No” the first time the question is asked because each sees mud on the other child’s forehead. That is, the son knows that d is true, but does not know whether s is true, and the daughter knows that s is true, but does not know whether d is true.
After the son has answered “No” to the first question, the daughter can determine that d must be true. This follows because when the first question is asked, the son knows that s ∨ d is true, but cannot determine whether s is true. Using this information, the daughter can conclude that d must be true, for if d were false, the son could have reasoned that because s ∨ d is true, then s must be true, and he would have answered “Yes” to the first question. The son can reason in a similar way to determine that s must be true. It follows that both children answer “Yes” the second time the question is asked.
***This puzzle is contributed by Feroz Baig.***
==========================================================================

=========================================================================

Which are open which are closed?

Puzzle: -
You have 100 doors in a row that are all initially closed. you make 100 passes by the doors starting with the first door every time. the first time through you visit every door and toggle the door (if the door is closed, you open it, if its open, you close it). the second time you only visit every 2nd door (door #2, #4, #6). the third time, every 3rd door (door #3, #6, #9), ec, until you only visit the 100th door.
What state are the doors in after the last pass? Which are open which are closed?

Solution:-
You can figure out that for any given door, say door #38, you will visit it for every divisor it has. so  has 1 & 38, 2 & 19. so on pass 1 i will open the door, pass 2 i will close it, pass 19 open, pass 38 close. For every pair of divisors the door will just end up back in its initial state. so you might think that every door will end up closed? well what about door #9. 9 has the divisors 1 & 9, 3 & 3. but 3 is repeated because 9 is a perfect square, so you will only visit door #9, on pass 1, 3, and 9… leaving it open at the end. only perfect square doors will be open at the end.
***Puzzle asked in: Google/Adobe/Amazon/Oracle***
=====================================================================


=====================================================================

Jelly Beans problem

Puzzle:-

This problem is also called Jelly Beans problem. This is the most commonly asked interview puzzle.

You have 3 jars that are all mislabeled. One jar contains Apple, another contains Oranges and the third jar contains a mixture of both Apple and Oranges.

You are allowed to pick as many fruits as you want from each jar to fix the labels on the jars. What is the minimum number of fruits that you have to pick and from which jars to correctly label them?

Labels on jars are as follows:

3 mislabeled jars of Apple and Orange



Solution:-

Let’s take a scenario. Suppose you pick from jar labelled as Apple and Oranges and you got Apple from it. That means that jar should be Apple as it is incorrectly labelled. So it has to be Apple jar.
Now the jar labelled Oranges has to be Mixed as it cannot be the Oranges jar as they are wrongly labelled and the jar labelled Apple has to be Oranges.

Similar scenario applies if it’s a Oranges taken out from the jar labelled as Apple and Oranges. So you need to pick just one fruit from the jar labelled as Apple and Oranges to correctly label the jars.


=======================================================================



=======================================================================

You are blindfolded and 10 coins are place in front of you on table

puzzle: -
You are blindfolded and 10 coins are placed in front of you on table. You are allowed to touch the coins, but can’t tell which way up they are by feel. You are told that there are 5 coins head up, and 5 coins tails up but not which ones are which. How do you make two piles of coins each with the same number of heads up? You can flip the coins any number of times.

Solution:-
Make 2 piles with equal number of coins. Now, flip all the coins in one of the pile.
How this will work? lets take an example.
So initially there are 5 heads, so suppose you divide it in 2 piles.
Case:
P1 : H H T T T
P2 : H H H T T
Now when P1 will be flipped
P1 : T T H H H
P1(Heads) = P2(Heads)
Another case:
P1 : H T T T T
P2 : H H H H T
Now when P1 will be flipped
P1 : H H H H T
P1(Heads) = P2(Heads)
**This puzzle was asked in Yahoo Interview.**

===============================================================================

===============================================================================

find the way to heaven

Puzzle:-
You are standing before two doors. One of the path leads to heaven and the other one leads to hell. There are two guardians, one by each door. You know one of them always tells the truth and the other always lies, but you don’t know who is the honest one and who is the liar.
You can only ask one question to one of them in order to find the way to heaven. What is the question?

 Solution: -
The question you should ask is “If I ask the other guard about which side leads to heaven, what would he answer?”. It should be fairly easy to see that irrespective of whom do you ask this question, you will always get an answer which leads to hell. So you can chose the other path to continue your journey to heaven.
This idea was famously used in the 1986 film Labyrinth.
Here is the explanation if it is yet not clear.
Let us assume that the left door leads to heaven.
If you ask the guard which speaks truth about which path leads to heaven, as he speaks always the truth, he
would say “left”. Now that the liar , when he is asked what “the other guard (truth teller) ” would answer, he would definitely say “right”.
Similarly, if you ask the liar about which path leads to heaven, he would say “right”. As the truth teller speaks nothing but the truth, he would say “right” when he is asked what “the other guard( liar ) ” would answer. So in any case, you would end up having the path to hell as an answer. So you can chose the other path as a way to heaven.
**This is one of the classic puzzles asked in Infosys interview.**

=====================================================================

=====================================================================

Pay an employee using a 7 units gold rod?



Puzzle :-  


An employee works for an employer for 7 days. The employer has a gold rod of 7 units. How does the employer pays to the employee so that the employee gets 1 unit at the end of everyday. The employer can make at most 2 cuts in rod.

Solution:-
Employer can pay for seven days by making 2 cuts in a way that he has 3 rods of size 1, 2 and 4.
1st Day: Employer gives 1 unit cut.
2nd day: Takes back 1 unit cut from employee given on first day and gives 2 unit cut.


3rd Day: Gives both 1 unit and 2 unit cuts.
4th Day: Takes back cuts of 1 and 2 units. Gives the cut of 4 units.
5th Day: Gives cut of 1 unit.
6th Day: Takes back cut of 1 unit and gives cut of 2 units.
7th Day: Gives cut of 1 unit.
Please write comments if you find anything incorrect, or you want to share more information about this topic .

=====================================================================

=====================================================================

3 bulbs and 3 switches

puzzle :-
There are 3 light bulbs in a hidden room and 3 switches outside the room that correspond to those light bulbs. You do not know which switch affects which bulb and you cannot see inside of the room. You are allowed to go inside of the room only one time. How do you find out which switch corresponds to which bulb ?

Answer : -
Turn on two switches and wait for a while. Then turn off one switch and go inside the room. The bulb that is still on corresponds to the switch that is still on. Touch the remaining bulbs. The hotter bulb is the switch that you turned off, and the remaining bulb is the switch that you never turned on

=====================================================================


=====================================================================

Popular Posts

Recent Posts

Categories

Unordered List

Join Us On Facebook

Please Wait 10 Seconds...!!!Skip

Text Widget

Blog Archive

Search This Blog

Powered by Blogger.

like us on facebook

Who is the man?

Puzzle :- Brother and sisters is have none but this man's father is my father's son? Who is the man? Answer :- The man is my ...

http://go.oclaserver.com/afu.php?zoneid=1633049