Wednesday, June 20, 2007

interview questions

hello there...yesterdy i went 4 2nd interview at Jobstreet. 3 hours u know! with 3 interviewers..so terrible...
let me give u some of e questions ;
  1. given 3 liter bucket,5 liter bucket and a lot of water. how can u measure exactly 4 liter?(no rulers or any measurement material given..)
  2. u have 8 balls.one is defective n less weigh than others.balance is given.how can u find which one is defective. only 2 trials allowed.
haha..know e answer?if u wanna know da rite answer, juz contact me yeah...
adios...softskill class is waiting...

2 comments:

Joey aka Rizal said...

1) I believe that this question was in a movie once, die hard or something. The solutions goes, fill up the 5 liters bucket, and pour it into the 3 liters bucket. You will have 2 liters remaining in the 5 liters bucket. Throw the water in the 3 liter bucket and take the water from the 5 liters bucket (which contains 2 liters now) and pour it into the 3 liters bucket. Fill up the 5 liters bucket again and pour the water into the 3 liters bucket until it is full. So exactly one liter will go into the 3 liters bucket until full. This would give 4 liters in the 5 liters bucket.

2) This is a classic problem. Basically, it can be solved if you apply the concept of tree structures. Similar to what you have learned in Data Structures, which uses binary trees, you can use tertiary trees. A tree with three branches. If you separate the balls into 3 groups, 2 groups of 3 balls and one group of 2 balls you can solve the problem in less than 2 tries. Balance the weight of the two groups of 3 balls. Which ever is lighter contains the defective one. Then take the 2 out of 3 balls and balance it on a scale again. if equal, the the third ball not measured is the defective one. otherwise....well, which ever is lighter. But what if the groups of 3 balls balances on the scale, well, you try the 2 balls. Each on either side. The lighter one is the defective one.

nhusna said...

so glad when my lecturer visit my blog..of course ur answer r correct.
lecturer la katakn...:)