It's not a secret anymore!*
The moose likes Programming Diversions and the fly likes Few Puzzles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "Few Puzzles" Watch "Few Puzzles" New topic
Author

Few Puzzles

Sameer Jamal
Ranch Hand

Joined: Feb 16, 2001
Posts: 1870
These are few puzzles which came at infosys written examination for developers can you solve these puzzles?
1. Five people A ,B ,C ,D ,E are related to each other.
Four of them make one true statement each as follows.
(i) B is my father's brother.
(ii) E is my mother-in-law.
(iii)C is my son-in-law's brother
(iv)A is my brother's wife.
give the names of the persons who said the above statements.
2. Conversation between two mathematcians:
First : I have three childern. The product of their ages is 36.
If you sum their ages, it is exactly same as my neighbour's door number on my left.
The second mathematician verfies the door number and says that it is not sufficient.
Then the first says " Ok one more clue is that my youngest is really the youngest". Immmediately the second mathematician answers .
Can you answer the question asked by the first mathematician?
What are the childeren ages?

3. Find the values of each of the alphabets.
N O O N
S O O N
+ M O O N
----------
J U N E
4. An escalator is descending at constant speed.
A walks down and takes 50 steps to reach the bottom.
B runs down and takes 90 steps in the same time as A takes 10 steps.
How many steps are visible when the escalator is not operating?
5. Complete the series: 5, 20, 24, 6, 2, 8, ?

6. A ship went on a voyage.
After it had travelled 180 miles a plane statrted with 10 times the speed of the ship.
Find the distance when they meet from starting point.

7. Q3)when the asctual time pass 1hr wall clock ic 10 min behind it
when 1 hr is shown by wall clock, table clock shows 10 min ahead
of ih when table clock shows 1 hr the alarm closck goes 5minbehind
it,when alarm clock goes 1 hr wrist watch is 5 min ahead of it assuming
that all clocks are correcrt with actual tinme at 12 noon what will
be time shown by wrist watch after 6 hr
8. q4)a soft. engr just returned from US has eaten too much fat &put a lot of weight everfy sunday he starts walking 4 km/hr on level
ground then up at 3 km\hr then back down hill at 6km\hr then again
on level grounggd at 4km\hr till he reaches his destination if he
returned home at 9 p.m. e what distance did he covered
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11441
    
  16

I'm going to argue that #2 is not solvable.
there are 8 ways to factor 36 with 3 factors...
1 * 1 * 36 sum is 38
1 * 2 * 18 sum is 21
1 * 3 * 12 sum is 16
1 * 4 * 9 sum is 14
1 * 6 * 6 sum is 13
2 * 2 * 9 sum is 13
2 * 3 * 6 sum is 11
3 * 3 * 4 sum is 10
the only way the second mathmatician couldn't tell their ages by looking at the address is if the address was 13. he then wouldn't know which of the two sets it could be.
now, the commonly given answer is that when he is told something about "the youngest is the youngest", we're supposed to say "well, twins are the same age, so it can't be the 2,2,9 answer. it must be the 1,6,6 answer.
The reason i don't think that holds up is that even between twins, one is younger than the other. I have twin nephews, and one is 8 minutes younger than the other. So, the youngest of them "really is the youngest", even though they are both 8 (in my case).


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Sonny Pondrom
Ranch Hand

Joined: Jun 05, 2001
Posts: 128
Originally posted by Sameer Jamal:
[QB]
3. Find the values of each of the alphabets.
N O O N
S O O N
+ M O O N
----------
J U N E
Assuming each letter is different, I think this may be one answer.
E2
J9
M0
N4
O1
S5
U3
George Harris
Ranch Hand

Joined: May 05, 2003
Posts: 84
1) I got:
i) a
ii) d
iii) e
iv) c
Mother = e
Father = Not around anymore
Uncle = b
Wife / daughter = a
Husband / son-in-law = d
Brother of husband = c
3)
2442
5442
1442
----
9326
5) 32
Sequence is about the number 4...
x, x*4, x+4, x/4, x-4
Deb Sadhukhan
Ranch Hand

Joined: Nov 05, 2003
Posts: 67
#6. 200 miles
Let's say the ship is travelling v mi/hr
and plane took t hours to meet the ship
Than, vt is the distance ship travelled after plane started
(10v)t = 10vt is the distance plane travelled.
So we have, vt + 180 = 10vt
or 9vt = 180
or vt = 20
Hence distance ==> 180 + 20 = 200 miles
[ March 31, 2004: Message edited by: Deb Sadhukhan ]

_ __ _ __ _ __ _<br />SCJP 1.4 (95%) | SCWCD 1.4 (79%)<br />Artificial intelligence is no match for natural stupidity.
Sameer Jamal
Ranch Hand

Joined: Feb 16, 2001
Posts: 1870
Few More
An orange glass has orange juice and white glass has apple juice both of equal volumes. 50ml of the orange juice is taken and poured into the apple juice. 50ml from the white glass is poured into the orange glass. Of the two quantities, the amount of apple juice in the orange glass and the amount of orange juice in the white glass, which one is greater and by how much?

There is a safe with a 5 digit number as the key. The 4th digit is 4 greater than second digit, while 3rd digit is 3 less than 2nd digit. The 1st digit is thrice the last digit. There are 3 pairs whose sum is 11. Find the number.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11441
    
  16

the amounts of liquid are equal.
============
let the combination be the digits
vwxyz.
we know that
y = w + 4 ==> y - 4 = w
x = w - 3 ==> x + 3 = w
y - 4 = x + 3 ==> y = x + 7
from this, we can figure out that the three digits wxy are one of three things:
307
418
529
anything else would require negative numbers or two digits.
we also know that the outer two digits are one of four sets:
0 0
3 1
6 2
9 3
from here, it's not too hard to look at all 12 combination, and find only one where we can get 3 pairs that toal 11.
Frank Shoemaker
Greenhorn

Joined: Mar 31, 2004
Posts: 1
Originally posted by Sameer Jamal:

5. Complete the series: 5, 20, 24, 6, 2, 8, ?


12


catch me if you can
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
#6.
By the time the plane flies 180 miles the ship would have travelled 18 miles.
180 + 18 = 198 miles

By the time the plane flies 18 miles the ship would have travelled 1.8 miles.
198 + 1.8 = 199.8 miles
By the time the plane flies 1.8 miles the ship would have travelled .18 miles.
199.8 + .18 = 199.98 miles
By the time the plane flies .18 miles the ship would have travelled .018 miles.
199.98 + .018 = 199.998 miles
By the time the plane flies .018 miles the ship would have travelled .0018 miles.
199.998 + .0018 = 199.9988
And so on, assuming the plane never tries to overtake the ship
Deb Sadhukhan
Ranch Hand

Joined: Nov 05, 2003
Posts: 67
HS Thomas,
Are you trying to say plane will naver be able to overtake ship, even though it's speed is 10 times the speed of the ship?
Deb Sadhukhan
Ranch Hand

Joined: Nov 05, 2003
Posts: 67
There is a safe with a 5 digit number as the key. The 4th digit is 4 greater than second digit, while 3rd digit is 3 less than 2nd digit. The 1st digit is thrice the last digit. There are 3 pairs whose sum is 11. Find the number.

6 5 2 9 2
[ March 31, 2004: Message edited by: Deb Sadhukhan ]
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Originally posted by Deb Sadhukhan:
HS Thomas,
Are you trying to say plane will naver be able to overtake ship, even though it's speed is 10 times the speed of the ship?

IF it's aim is to catch up with the ship (exactly) say to drop a needle on the ships front tip will they ever ever meet ?
Jignesh Malavia
Author
Ranch Hand

Joined: May 18, 2001
Posts: 81
#4 (Probably not the best approach. Too long..)
Let D = number of steps
Let S = constant speed of escalator (that is, it goes down at the rate of S steps/second)
Let sa = speed of A (sa steps/second) when escalator is stationary.
Let sb = speed of B (sb steps/second) when escalator is stationary.
If the escalator is moving at speed S, and A is walking at speed sa, then the effective speed of A is S+sa
If the escalator is moving at speed S, and B is running at speed sb, then the effective speed of B is S+sb
Let T = time required by escalator to cover D steps.
Let ta = time required by A to cover D steps when escalator is stationary.
Let ta50 = time required by A to cover 50 steps when escalator is stationary.
Let taeff = effective time required by A to cover 50 steps when escalator is moving.
Let tb = time required by B to cover D steps when escalator is stationary.
Let tb90 = time required by B to cover 90 steps when escalator is stationary.
Let tbeff = effective time required by B to cover 90 steps when escalator is moving.
Therefore,
D = S*T
D = sa*ta
D = sb*tb
50 = sa*ta50 (for A walking on stationary escalator) --- 1
90 = sb*tb90 (for B running on stationary escalator) --- 2
D = (S+sa)*taeff (for A walking on moving escalator) --- 3
D = (S+sb)*tbeff (for B running on moving escalator) --- 4
For A, the time required to reach the bottom while escalator is moving is same as the time required to walk 50 steps.
Thus, ta50 == taeff.
or 50/sa = D/(S+sa) --- [from 1 and 3]
or D = ((S+sa)*50)/sa --- 5

For B, the time required to reach the bottom while escalator is moving is same as the time required to run 90 steps.
Thus, tb90 == tbeff.
90/sa = D/(S+sb) --- [from 2 and 4]
or D = ((S+sb)*90)/sb --- 6
Also, B coveres all 90 steps when A has covered only 10 steps == 1/5th the total steps for A. Thus, effective speed of B is five times effective speed of A
(S+sb) = 5*(S+sa)
Replacing S+sb with 5*(S+sa) in 6 gives
D = 5*(S+sb)*90/sb --- 7
Combine 5 and 7
(S+sa)*50/sa == 450(S+sa)/sb
thus sb/sa = 9
B goes 9 times faster then A
Solving for eq 5 and 6 using sb=9*sa gives S = sa.
Using S = sa in 5 gives D = 100.
Answer: 100 steps are visible when the escalator is not operating.
A walks at the same speed as the escalator and thus reaches in half the normal time = A covers 50 steps + escalator covers 50 steps.
B runs at the 9 times the speed of escalator and thus reaches in 1/10th the normal time = B covers 90 stpes + escalator covers 10 steps.
Sameer Jamal
Ranch Hand

Joined: Feb 16, 2001
Posts: 1870
Originally posted by Jignesh Malavia:
#4 (Probably not the best approach. Too long..)
Let D = number of steps
Let S = constant speed of escalator (that is, it goes down at the rate of S steps/second)
Let sa = speed of A (sa steps/second) when escalator is stationary.
Let sb = speed of B (sb steps/second) when escalator is stationary.
If the escalator is moving at speed S, and A is walking at speed sa, then the effective speed of A is S+sa
If the escalator is moving at speed S, and B is running at speed sb, then the effective speed of B is S+sb
Let T = time required by escalator to cover D steps.
Let ta = time required by A to cover D steps when escalator is stationary.
Let ta50 = time required by A to cover 50 steps when escalator is stationary.
Let taeff = effective time required by A to cover 50 steps when escalator is moving.
Let tb = time required by B to cover D steps when escalator is stationary.
Let tb90 = time required by B to cover 90 steps when escalator is stationary.
Let tbeff = effective time required by B to cover 90 steps when escalator is moving.
Therefore,
D = S*T
D = sa*ta
D = sb*tb
50 = sa*ta50 (for A walking on stationary escalator) --- 1
90 = sb*tb90 (for B running on stationary escalator) --- 2
D = (S+sa)*taeff (for A walking on moving escalator) --- 3
D = (S+sb)*tbeff (for B running on moving escalator) --- 4
For A, the time required to reach the bottom while escalator is moving is same as the time required to walk 50 steps.
Thus, ta50 == taeff.
or 50/sa = D/(S+sa) --- [from 1 and 3]
or D = ((S+sa)*50)/sa --- 5

For B, the time required to reach the bottom while escalator is moving is same as the time required to run 90 steps.
Thus, tb90 == tbeff.
90/sa = D/(S+sb) --- [from 2 and 4]
or D = ((S+sb)*90)/sb --- 6
Also, B coveres all 90 steps when A has covered only 10 steps == 1/5th the total steps for A. Thus, effective speed of B is five times effective speed of A
(S+sb) = 5*(S+sa)
Replacing S+sb with 5*(S+sa) in 6 gives
D = 5*(S+sb)*90/sb --- 7
Combine 5 and 7
(S+sa)*50/sa == 450(S+sa)/sb
thus sb/sa = 9
B goes 9 times faster then A
Solving for eq 5 and 6 using sb=9*sa gives S = sa.
Using S = sa in 5 gives D = 100.
Answer: 100 steps are visible when the escalator is not operating.
A walks at the same speed as the escalator and thus reaches in half the normal time = A covers 50 steps + escalator covers 50 steps.
B runs at the 9 times the speed of escalator and thus reaches in 1/10th the normal time = B covers 90 stpes + escalator covers 10 steps.


Thats a good job
other short approach can be
Suppose A takes T time to reach bottom (or 50 steps) when escalater is moving
For B to take 90 steps it will require T/5 time

total no of steps in escalater= (90T-50T/5)/T-T/5
=80T/4T/5=100 STEPS
Sameer Jamal
Ranch Hand

Joined: Feb 16, 2001
Posts: 1870
Still unsolved
7. Q3)when the asctual time pass 1hr wall clock ic 10 min behind it
when 1 hr is shown by wall clock, table clock shows 10 min ahead
of ih when table clock shows 1 hr the alarm closck goes 5minbehind
it,when alarm clock goes 1 hr wrist watch is 5 min ahead of it assuming
that all clocks are correcrt with actual tinme at 12 noon what will
be time shown by wrist watch after 6 hr
8. q4)a soft. engr just returned from US has eaten too much fat &put a lot of weight everfy sunday he starts walking 4 km/hr on level
ground then up at 3 km\hr then back down hill at 6km\hr then again
on level grounggd at 4km\hr till he reaches his destination if he
returned home at 9 p.m. e what distance did he covered

another one
Two trains starting at same time, one from Bangalore to Mysore and other in opposite direction arrive at their destination 1 hr and 4 hours respectively after passing each other. How nuch faster is one train from other?
Arjun Shastry
Ranch Hand

Joined: Mar 13, 2003
Posts: 1874
Train problem:both have same speed?


MH
Sameer Jamal
Ranch Hand

Joined: Feb 16, 2001
Posts: 1870
Originally posted by Capablanca Kepler:
Train problem:both have same speed?

No
Jignesh Malavia
Author
Ranch Hand

Joined: May 18, 2001
Posts: 81
Originally posted by Sameer Jamal:

other short approach can be
Suppose A takes T time to reach bottom (or 50 steps) when escalater is moving
For B to take 90 steps it will require T/5 time
total no of steps in escalater= (90T-50T/5)/T-T/5
=80T/4T/5=100 STEPS

Wow
Arjun Shastry
Ranch Hand

Joined: Mar 13, 2003
Posts: 1874
Let v1 be velocity of train from Bangalore to Mysore.
Let v2 be the velocity of train from Mysore to Bangalore.
Let two trains meet at distance x from Bangalore and y from Mysore.
x/v1 = y/v2---(1)
also v1 = y and v2= x/4--(2)
Substituting x and y in (1),
v1 = 2v2.
Velocity of one train is twice than another.
[ April 06, 2004: Message edited by: Capablanca Kepler ]
Sameer Jamal
Ranch Hand

Joined: Feb 16, 2001
Posts: 1870
for q no 8 ans is 24
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

Originally posted by Capablanca Kepler:
Let v1 be velocity of train from Bangalore to Mysore.
Let v2 be the velocity of train from Mysore to Bangalore.
Let two trains meet at distance x from Bangalore and y from Mysore.
x/v1 = y/v2---(1)
also v1 = y and v2= x/4--(2)
Substituting x and y in (1),
v1 = 2v2.
Velocity of one train is twice than another.
[ April 06, 2004: Message edited by: Capablanca Kepler ]
Wow, I haven't see any train in India, so made this trip on Taxi. Where is train station in Bangalore.


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Few Puzzles