Top

Bitwise Operators

1.

What will be the output of the program?

#include

int main()
{
    printf("%d %d\n", 32<<1>>1, 32>>0);
    printf("%d %d\n", 32>>-1, 32>>-0);
    return 0;
}

 

Answer: B

No answer description available for this question.
 

Enter details here

2.

Bitwise | can be used to set multiple bits in number.

Answer: A

No answer description available for this question.
 

Enter details here

3.

If an unsigned int is 2 bytes wide then, What will be the output of the program ?

#include

int main()
{
    unsigned int m = 32;
    printf("%x\n", ~m);
    return 0;
}

 

Answer: C

No answer description available for this question.

Enter details here

4.

Bitwise & and | are unary operators

Answer: B

No answer description available for this question.
 

Enter details here

5.

What will be the output of the following C code?

#include 
    int main()
    {
        int a = 2;
        if (a >> 1)
           printf("%d\n", a);
    }

 

Answer: C

No answer description available for this question.

Enter details here

6.

Bitwise | can be used to set a bit in number.

Answer: A

No answer description available for this question.
 

Enter details here

7.

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

8.

Assunming, integer is 2 byte, What will be the output of the program?

#include

int main()
{
    printf("%x\n", -1>>1);
    return 0;
}

 

Answer: A

No answer description available for this question.
 

Enter details here

9.

Bitwise & can be used to divide a number by powers of 2

Answer: B

No answer description available for this question.
 

Enter details here

10.

Bitwise & can be used to check if a bit in number is set or not.

Answer: A

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