Interview at IBM

A reader interviewed with IBM and sent the following questions in:

  1. I have a scale and 7 balls. 1 ball is heavier than all the rest. How do I determine the heaviest ball with only 3 possible weighing attempts?
  2. What is a linked list?
  3. Name an advantage of linked list over array?
  4. Name an advantage of array over linked list?
  5. Have you ever used threads?
  6. Should you protect the global data in threads? Why or why not?
  7. Have you ever interfaced with a database?
  8. Tell us about yourself.
  9. Questions about specific resume entries.
  10. Given two strings like x=”hello” and y=”open”, remove any character from string x which is also used in string y, thus making the result x=”hll”.

Did you interview at IBM recently? Or want to find out who the recruiters are there? Discuss it in the interview at IBM section.

This entry was posted in C++, General, Java. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

102 Comments on Interview at IBM

  1. Swaraj Goud
    Posted 5/15/2008 at 7:00 am | Permalink

    answer for 7 ball puzzle

    first devide the 7 balls into 1 3 3 balls

    now there r 2 cases
    case 1:put the 3 3 balls on the two side of the scale, if the r equal then the left out will be the required ball

    case 2:
    step 1: put the 3 3 on two sides of the scale if one side is heavy then take the heavy side 3 balls and the 1 which is kept aside

    step 2: now keep these 4 balls 2 2 on two sides again one side will be heavy take those 2 of heavy side

    step 3: keep these 2 on two sides of scale again one side will be heavy that is the ball required

  2. alan
    Posted 6/13/2008 at 7:14 pm | Permalink

    Simple way for q10:

    public class RemoveString {

    public static String removeCharFromString(String a, char b){
    return a.replaceAll(String.valueOf(b), “”);

    public static void main(String[] args) {
    String a = “hello”;
    String b = “open”;

    char[] barr= b.toCharArray();

    for(int i=0; i<barr.length;i++){
    a = removeCharFromString(a,barr[i]);



Post a Comment

Your email is never published nor shared. Required fields are marked *