Top

Bitwise Operators

11.

What will be the output of the program?

#define P printf("%d\n", -1^~0);
#define M(P) int main()\
             {\
                P\
                return 0;\
             }
M(P)

 

Answer:

Enter details here

12.

What will be the output of the following C code?

#include 
    int main()
    {
        int c = 2 ^ 3;
        printf("%d\n", c);
    }

 

Answer: A

No answer description available for this question.

Enter details here

13.

Consider the given statement:

int x = 10 ^ 2

What will be the value of x?

Answer: D

No answer description available for this question.

Enter details here

14.

Predict the output of following program.

#include 

int main()
{
 char flag=0x0f;

 flag &= ~0x02;
 printf("%d",flag);

 return 0;
}

 

Answer: A

No answer description available for this question.

Enter details here

15.

Left shifting an unsigned int or char by 1 is always equivalent to multiplying it by 2.

Answer: A

No answer description available for this question.
 

Enter details here

16.

Left shift (<<) and Right shift (>>) operators are equivalent to _____________ by 2.

Choose the correct words...

Answer: A

No answer description available for this question.
 

Enter details here

17.

Which is not a bitwise operator?

Answer: D

No answer description available for this question.

Enter details here

18.

Bitwise | can be used to multiply a number by powers of 2.

Answer: B

No answer description available for this question.
 

Enter details here

19.

Predict the output of following program.

#include 

#define MOBILE  0x01
#define LAPPY   0x02

int main()
{
 unsigned char  item=0x00;

 item |=MOBILE;
 item |=LAPPY;

 printf("I have purchased ...:");
 if(item & MOBILE){
  printf("Mobile, ");
 }
 if(item & LAPPY){
  printf("Lappy");
 }

 return 1;
}

 

Answer: B

No answer description available for this question.

Enter details here

20.

On left shifting, the bits from the left are rotated and brought to the right and accommodated where there is empty space on the right?

Answer: B

No answer description available for this question.
 

Enter details here

Loading…
Tags: Bitwise Operators Questions and Answers || Bitwise Operators MCQ Questions and Answers || Bitwise Operators GK Questions and Answers || Bitwise Operators GK MCQ Questions || Bitwise Operators Multiple Choice Questions and Answers || Bitwise Operators GK || GK on Bitwise Operators || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming