Log In Register

Units


Bitwise Operators - Questions and Answers

 

Practice these Bitwise Operators  under C Programming walk-in interview Questions/ examination questions with best tricks and short cuts with solution. Student (candidate) who want to crack the walk in interview, competitive exams and want to find short cuts and tricks to solve questions on Bitwise Operators for following purpose.


– Anyone who is wishing to increase their perfect knowledge of Bitwise Operators of C Programming.
– Anyone who is preparing for aptitude test and increase his in depth aptitude knowledge C Programming specifically Bitwise Operators .
– Anyone who is preparing for interviews (competitive examinations, govt examinations and bank examinations, off-campus or on campus interviews, walk-in interview and company interviews) having questions on Bitwise Operators under C Programming.

– Anyone who is preparing for aptitude test or competitive exam or entrance exam.
– Anyone who is preparing for entrance examinations and other competitive examinations.
– All Experienced, Freshers and Students.

Here is list of Questions and Answers covering all key area of  Bitwise Operators topic of C Programming:

 

1.

What is the output of this C code?

  1.     #include <stdio.h>
  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.     }

Answer: Option A

Explanation:

2.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int y = 0;
  5.         if (1 |(y = 1))
  6.             printf("y is %d\n", y);
  7.         else
  8.             printf("%d\n", y);
  9. 
     
  10.     }

Answer: Option D

Explanation:

3.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int y = 1;
  5.         if (y & (y = 2))
  6.             printf("true %d\n", y);
  7.         else
  8.             printf("false %d\n", y);
  9. 
     
  10.     }

Answer: Option B

Explanation:

4.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         int a = -5;
  5.         int k = (a++, ++a);
  6.         printf("%d\n", k);
  7.     }

Answer: Option D

Explanation:

5.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         int a = 5, b = -7, c = 0, d;
  5.         d = ++a && ++b || ++c;
  6.         printf("\n%d%d%d%d", a, b, c, d);
  7.     }

Answer: Option A

Explanation:

6.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int c = 2 ^ 3;
  5.         printf("%d\n", c);
  6.     }

Answer: Option D

Explanation:

7.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int x = 2;
  5.         x = x << 1;
  6.         printf("%d\n", x);
  7.     }

Answer: Option C

Explanation:

8.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         if (7 & 8)
  5.         printf("Honesty");
  6.             if ((~7 & 0x000f) == 8)
  7.                 printf("is the best policy\n");
  8.     }

Answer: Option B

Explanation:

9.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int a = 2;
  5.         if (a >> 1)
  6.            printf("%d\n", a);
  7.     }

Answer: Option A

Explanation:

10.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int x = -2;
  5.         if (!0 == 1)
  6.             printf("yes\n");
  7.         else
  8.             printf("no\n");
  9.     }

Answer: Option C

Explanation:

11.

Comment on the output of this C code?

  1.     #include <stdio.h>
  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.     }

Answer: Option C

Explanation:

12.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         unsigned int a = 10;
  5.         a = ~a;
  6.         printf("%d\n", a);
  7.     }

Answer: Option B

Explanation:

13.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         if (~0 == 1)
  5.             printf("yes\n");
  6.         else
  7.             printf("no\n");
  8.     }

Answer: Option D

Explanation:

14.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int x = -2;
  5.         x = x >> 1;
  6.         printf("%d\n", x);
  7.     }

Answer: Option C

Explanation: