Thursday, January 17, 2013

Operating System Interview Questions

9 comments:

  1. For the first question to find if the number is a power of 2 or not, an ! is missing in the if statement.
    Reason: If a number is a power of 2, then the bit wise and of the number with number - 1 would result in all zeros.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. For the question "Write a function to swap even bits with consecutive odd bits in a "number.
    following should be the answer.

    return (num<<1 & 0x55555555) | (num>>1 & 0xAAAAAAAA);

    ReplyDelete
  4. int power_of_two(unsigned int number){
    if((number)&(number-1))
    printf("%d Not Power of two\n",number);
    else
    printf("%d Power of two\n",number);

    return 0;
    }

    ReplyDelete
  5. Good
    Here is blog for basic C and C++ programs
    List of C and C++ Programs
    blog link
    C and C++ based programs

    ReplyDelete
  6. The links are not not working anymore !!

    ReplyDelete