250+ TOP MCQs on Bitwise Operators and Answers

C Objective Questions on “Bitwise Operators”. One shall practice these Objective Questions to improve their C programming skills needed for various interviews (campus interviews, walkin interviews, company interviews), placements, entrance exams and other competitive exams. These questions can be attempted by anyone focusing on learning C Programming language. They can be a beginner, fresher, engineering graduate or an experienced IT professional. Our C Objective Questions come with detailed explanation of the answers which helps in better understanding of C concepts.

Here is a listing of C Objective Questions on “Bitwise Operators” along with answers, explanations and/or solutions:

1. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         int c = 2 ^ 3;
  5.         printf("%dn", c);
  6.     }

a) 1
b) 8
c) 9
d) 0
Answer: a
Clarification: None.

2. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         unsigned int a = 10;
  5.         a = ~a;
  6.         printf("%dn", a);
  7.     }

a) -9
b) -10
c) -11
d) 10
Answer: c
Clarification: None.

3. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         if (7 & 8)
  5.         printf("Honesty");
  6.             if ((~7 & 0x000f) == 8)
  7.                 printf("is the best policyn");
  8.     }

a) Honesty is the best policy
b) Honesty
c) is the best policy
d) No output
Answer: c
Clarification: None.

4. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         int a = 2;
  5.         if (a >> 1)
  6.            printf("%dn", a);
  7.     }

a) 0
b) 1
c) 2
d) No Output
Answer: c
Clarification: None.

5. Comment on the output of the following C code.

  1.     #include 
  2.     int main()
  3.     {
  4.         int i, n, a = 4;
  5.         scanf("%d", &n);
  6.         for (i = 0; i < n; i++)
  7.             a = a * 2;
  8.     }

a) Logical Shift left
b) No output
c) Arithmetic Shift right
d) Bitwise exclusive OR
Answer: b
Clarification: None.

6. What will be the output of the following C code?

  1.     #include 
  2.     void main()
  3.     {
  4.         int x = 97;
  5.         int y = sizeof(x++);
  6.         printf("x is %d", x);
  7.     }

a) x is 97
b) x is 98
c) x is 99
d) Run time error
Answer: a
Clarification: None.

7. What will be the output of the following C code?

  1.     #include 
  2.     void main()
  3.     {
  4.         int x = 4, y, z;
  5.         y = --x;
  6.         z = x--;
  7.         printf("%d%d%d", x, y, z);
  8.     }

a) 3 2 3
b) 2 2 3
c) 3 2 2
d) 2 3 3
Answer: d
Clarification: None.

8. What will be the output of the following C code?

  1.     #include 
  2.     void main()
  3.     {
  4.         int x = 4;
  5.         int *p = &x;
  6.         int *k = p++;
  7.         int r = p - k;
  8.         printf("%d", r);
  9.     }

a) 4
b) 8
c) 1
d) Run time error
Answer: c
Clarification: None.

  250+ TOP MCQs on Kinetics of Homogeneous Reactions-Comparison of Theories-2 and Answers

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top