1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

C Interview questions

Discussion in 'C' started by Me@earth, Jun 9, 2008.

  1. Me@earth

    Me@earth New Member

    Joined:
    May 22, 2008
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    Can anyone giv me answers for this questions...

    1)Which bit wise operator is suitable for turning off a particular bit in a number?

    2)what will be printed out when the following code is executed:

    main()
    {
    printf("%x",-1<<4);
    }

    3)Which one is equivalent to multiplying by 2?

    * Left shifting a number by 1
    * Left shifting an unsigned int or char by 1?

    4)Write a function which gets the n bits from an unsigned integer x, starting from position p .(the right most digit is at position 0)

    5)Write a function using bitwise opetators to check whether an integer is a power of 2 or not?

    6)Write a Program that swaps the contents of two variables without
    using any other variable,using bitwise operators?

    7) Which bit wise operator is suitable for checking whether a particular bit is on or off?

    8) Which bit wise operator is suitable for putting on a particular bit in a number?

    9) Which bit wise operator is suitable for checking whether a particular bit is on or off?

    10)Write a function setbits(x,p,n,y) that returns x with the n bits that begin at position p set to the rightmost n bits of y,leaving the other bits changed.

    11)Write a function invert(x,p,n) that returns x with the n bits that begin at position p inverted leaving other unchanged.

    Waiting for ur reply..
    Thanxxx...
     

Share This Page