AceTheInterview
Jobs in Pune | Work better in teams | Socialize with friends | Submit Q&A | Tell a friend
Search site for 

Top 100 Interview Questions & Answers in a convenient and easy to read book!

“I bought this guide a few days ago to prepare for my interview with Oracle. Many of the questions they asked me were from this guide. I found this book absolutely great!”

– Ravi, California

Read more comments...

Interview Questions And Answers RSS Feed

Answers »

  1. Submitted By: sprihak — October 6, 2006
    -2 votes
      + -

    1. Let’s mark the corners of the triangle as A,B,C.
    2. There are only two cases under which the ants won’t collide : A->B, B->C, C->A and A->C, C->B and B->A
    3. Therefore, probability of ants not colliding : 2/8 = 1/4

  2. Submitted By: hckyplr — October 6, 2006
    +0 votes
      + -

    Another solution:
    The probability of a group of situations is the same as the product of the individual posibilities. (Im sure there is a better way to word that)
    Ant #1….none of the other ants have claimed a corner so he cant colide with anyone so probability he wont colide is 1/1.
    Ant #2….he has only two corners to go to one will be occupied by ant#1 so the probability that he will run into someone is 1/2.
    Ant #3….there has to be one corner that is empty if there isnt that would mean that Ant #1 and Ant #2 colided so the probability that he will find the empty corner is 1/2.
    Therefore the probability that the wont colide is 1/1*1/2*1/2=1/4.

  3. Submitted By: rons2112 — October 6, 2006
    -4 votes
      + -

    This assumes that ants move in a straight line, as we know they don’t. They move all over the place, in random directions, eventually ending up in their final destinations.

    Although Microsoft asked me this question and was looking for the answer mentioned by other posters, they gave extra credit for what I explained.

  4. Submitted By: haha — October 6, 2006
    -1 votes
      + -

    rons2112, you are wrong. The ants may never end up in the destination since they are “stupid” according to your assumption. And I could make them moving in certain clock-wise by putting honey along th estrait line (not completely connected–you know what I mean). So they will definitely don’t collide (100%).
    Smile!

  5. Submitted By: likhon — October 6, 2006
    -2 votes
      + -

    All of you are wrong on a point. There are 6 paths between three points. two of them have possibility of collision. So the total possibility of collision is : 2/6 = 1/3

    All of you told it to be 1/4.

    Am I wrong?

  6. Submitted By: likhon — October 6, 2006
    -2 votes
      + -

    1 of 1 people found this post useful.
    All of you are wrong on a point. There are 6 paths between three points. two of them have no possibility of collision. So the total possibility of no collision is : 2/6 = 1/3

    All of you told it to be 1/4.

    Am I wrong?

  7. Submitted By: ucjason — October 6, 2006
    +3 votes
      + -

    likhon, I believe the answer is 1/4. It is true that there are only 6 paths but if you view this problem as a binary representation, (three places with two options each) You clan clearly see that there are 8 different combinations.
    LLL-> 000
    LLR->
    LRL
    LRR
    RLL
    RLR
    RRL
    RRR

  8. Submitted By: likhon — October 6, 2006
    -1 votes
      + -

    ucjason,
    if you read the question carefully you will find that the ants started moving randomly towards OTHER corners. There are total 9 paths if you include the corners from where they start moving. So you have to exclude three paths.

    Do you agree?

  9. Submitted By: littlerufe — October 6, 2006
    +2 votes
      + -

    likhon, think about it like this. Each ant has two choices (assuming they travel on the border of the triangle): go left or go right.

    There are three ants with two choices each. This means the total number of possible ant paths is 2^3 = 2*2*2 = 8.

    The only possibile choices where the ants won’t collide is if they all go left or they all go right. Since there are 2 possible correct answers out of 8, the probability is 1/4.

    Here are the eight possibilities. If you can prove me wrong, post a possibility I’m missing!

    Ant 1 Ant 2 Ant 3
    Left Left Left
    Left Left Right
    Left Right Left
    Left Right Right
    Right Left Left
    Right Left Right
    Right Right Left
    Right Right Right

  10. Submitted By: gbuntin — October 6, 2006
    -1 votes
      + -

    You are all wrong! You have made not one but three obvious assumptions!
    1) They move in straight lines.
    2) They start within the confines of the triange
    3) They stay within the confines of the triangle.

    Moral: Think out of the triangle!!

  11. Submitted By: baboon — October 6, 2006
    -1 votes
      + -

    There are 3 ants at 3 corners of a triangle, they randomly start moving towards another corner. What is the probability that they don’t collide?

    for 25%, they would only collide if they move in a straight line

    i believe that this is an entropy question.

    delta G = delta H - T * delta S

  12. Submitted By: baboon — October 6, 2006
    -1 votes
      + -

    ants dont necessarily move in a straight line…

    random movement could be any zig zag directions.

  13. Submitted By: wazzup — October 6, 2006
    -2 votes
      + -

    Well, I think the answer to this question also depends on how many hops the ant takes. Assumming the ants take only one hop i.e. Each ant moves only once from a corner to another. The answer changes as follows:

    Possibility 1:

    Ants area at a, b, and c co-ordinates of the triangle. To avoid collision the move as:
    a->b,b->c,c->d and therefore the probability is 1/3

    Possibility 2:
    They move as: a->c, c->b, b->a and therefore the probability is 1/3 again.

    Total prob: 1/3 + 1/3 = 2/3

    Is this right?

    Total pro

  14. Submitted By: wazzup — October 6, 2006
    not yet rated
      + -

    sorry..that was a typo.
    In possibility 1:

    it’s actually a->b, b->c, c->a

    there’s no d

  15. Submitted By: szhkb — October 6, 2006
    not yet rated
      + -

    What if these ants are not moving at the same speed?

  16. Submitted By: olivov — October 6, 2006
    not yet rated
      + -

    how about this.

    (i)since we all assume things like:
    1) ants remain within the triangle
    2) ants travel in STRAIGHT lines along tehe sides of the triangle
    Assuming the above case, we see that the possibility of them colliding is 1/4 (25%)

    (ii)Now remove the above assumptions and you have the ants starting from their positions randomly and not keeping within the triangle nor moving in straight paths along the sides of the triangle. But one thing to note is that they WILL reach one of the other corners of the triangle regardless of time or rather withing “x” amount of time. they will and they have to unless they collide. So in this case since they move randomly, its almost impossible to calculate a probability for collision, since they can travel in one of many paths and and those r innumerous. lets say the probability is very low.

    (iii) Finally, lets say that they behave as ALL ants do when they r travelling in a small space. come what may they always tend to meet if they r moving in opposoite directions (albeit for a second or so). So my argument is that if they are moving within a small triangle and happen to cross one another they will come what may collide and then move along their respective paths. so in this casr the possibility / probability of colliding is very high…almost to to 1 (100%)

    what say….and anything in between cases (ii) and (iii) above….

    any more bizare answers?

  17. Submitted By: rehumbus — October 6, 2006
    not yet rated
      + -

    all three should go in the same direction to avoid collisions. therefore the second’s and the third’s directions should be the same as the first’s, probability of two directions match is 1/2, therefore result is
    1/2 * 1/2 = 1/4

  18. Submitted By: Marex — October 6, 2006
    not yet rated
      + -

    Ants are not blind, they wouldn`t collide at all…

  19. Submitted By: Madhup — October 6, 2006
    +2 votes
      + -

    I did it mathematically:

    Notation:
    P(E) is the probabilty that event E occurs.
    U stands for Union

    Now,
    P(ants not colliding)
    = P(all ants go clockwise OR all ants go anti-clockwise)

    (OR of events means union of sets means addition of probabilities)

    = P(all ants go clockwise U all go anti-clockwise)

    = P(all go clockwise) + P(all go anti-clk)

    = P(ant 1 goes frm A to B AND ant 2 goes from B to C AND 3 goes frm C to A)

    + P(ant 1 goes frm A to C AND ant 2 goes from B to A AND 3 goes frm C to B)

    = P(ant 1 goes frm A to B) * P(ant 2 goes from B to C) * P(ant 3 goes frm C to A)

    + P(ant 1 goes frm A to C) * P(ant 2 goes from B to A) * P (3 goes frm C to B)

    Since every ant has a 50% chance that it selects one of the two directions. Each of the above probabilities is 1/2

    = 1/2 * 1/2 * 1/2 + 1/2 * 1/2 * 1/2
    = 1/8 + 1/8
    = 1/4

  20. Submitted By: Jyothsna — October 6, 2006
    +7 votes
      + -

    There are four JDBC driver types.

    Type 1: JDBC-ODBC Bridge plus ODBC Driver:
    The first type of JDBC driver is the JDBC-ODBC Bridge. It is a driver that provides JDBC access to databases through ODBC drivers. The ODBC driver must be configured on the client for the bridge to work. This driver type is commonly used for prototyping or when there is no JDBC driver available for a particular DBMS.

    Type 2: Native-API partly-Java Driver:
    The Native to API driver converts JDBC commands to DBMS-specific native calls. This is much like the restriction of Type 1 drivers. The client must have some binary code loaded on its machine. These drivers do have an advantage over Type 1 drivers because they interface directly with the database.

    Type 3: JDBC-Net Pure Java Driver:
    The JDBC-Net drivers are a three-tier solution. This type of driver translates JDBC calls into a database-independent network protocol that is sent to a middleware server. This server then translates this DBMS-independent protocol into a DBMS-specific protocol, which is sent
    to a particular database. The results are then routed back through the middleware server and sent back to the client. This type of solution makes it possible to implement a pure Java client. It also makes it possible to swap databases without affecting the client.

    Type 4: Native-Protocol Pur Java Driver
    These are pure Java drivers that communicate directly with the vendor’s database. They do this by converting JDBC commands directly into the database engine’s native protocol. This driver has no additional translation or middleware layer, which improves performance tremendously.

  21. Submitted By: hari — November 27, 2007
    not yet rated
      + -

    no need to decide which way does the ants go..but one thing is certain and that is the ants move away from you as you taste bitter..

  22. Leave an Answer/Comment

    To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
    Click to hear an audio file of the anti-spam word

Our Sponsors
Our Sponsors
Contact Us | FAQ | Sitemap | Terms of Use | Privacy Policy | Tell a Friend

Copyright © 1999-2006 Jeeve Technologies LLC. All rights reserved.