Home / C Programming / Bitwise Operators :: Discussion

Discussion :: Bitwise Operators

  1. Which of the following statements are correct about the program?

    #include 
     int main() 
     {  
         unsigned int num;   
         int i;    
         scanf("%u", #);    
         for(i=0; i16; i++)  
         {       
            printf("%d", (num115)?1:0);   
         }    
         return 0;
      } 
    

     

  2. A.

    It prints all even bits from num

    B.

    It prints all odd bits from num

    C.

    It prints binary equivalent num

    D.

    Error

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    If we give input 4, it will print 00000000 00000100 ;

    If we give input 3, it will print 00000000 00000011 ;

    If we give input 511, it will print 00000001 11111111 ;


Be The First To Comment