Home - C Programming - Bitwise Operators

Bitwise Operators Online Exam Quiz

Important questions about Bitwise Operators. Bitwise Operators MCQ questions with answers. Bitwise Operators exam questions and answers for students and interviews.

1. Assuming a integer 2-bytes, What will be the output of the program? #include<stdio.h> int main() { printf("%x\n", -1<<3); return 0; }

Options

A : ffff

B : fff8

C : 0

D : -1

2. What will be the output of the program? #include<stdio.h> int main() { unsigned char i = 0x80; printf("%d\n", i<<1); return 0; }

Options

A : 0

B : 256

C : 100

D : 80

3. Bitwise & and | are unary operators

Options

A : True

B : False

C :

D :

4. Left shifting a number by 1 is always equivalent to multiplying it by 2.

Options

A : True

B : False

C :

D :

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

Options

A : True

B : False

C :

D :

6. Bitwise & can be used to check if more than one bit in a number is on.

Options

A : True

B : False

C :

D :

7. In the statement expression1 >> expression2 . if expression1 is a signed integer with its leftmost bit set to 1 then on right shifting it the result of the statement will vary from computer to computer

Options

A : True

B : False

C :

D :

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

Options

A : True

B : False

C :

D :

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

Options

A : True

B : False

C :

D :

10. 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?

Options

A : True

B : False

C :

D :

1. Bitwise can be used to perform addition and subtraction.

Options

A : Yes

B : No

C :

D :

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

Options

A : Yes

B : No

C :

D :

3. Bitwise & can be used in conjunction with ~ operator to turn off 1 or more bits in a number.

Options

A : Yes

B : No

C :

D :

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

Options

A : Yes

B : No

C :

D :

5. Bitwise can be used to reverse a sign of a number.

Options

A : Yes

B : No

C :

D :

6. Bitwise can be used to generate a random number.

Options

A : Yes

B : No

C :

D :

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

Options

A : Yes

B : No

C :

D :

1. Assuming, integer is 2 byte, What will be the output of the program? #include ; int main() { printf("%x\n", -1>>1); return 0; }

Options

A : ffff

B : 0fff

C : 0000

D : fff0

2. What will be the output of the program? #include<stdio.h> int main() { unsigned int res; res = (64 >>(2+1-2)) & (~(1<<2)); printf("%d\n", res); return 0; }

Options

A : 32

B : 64

C : 0

D : 128

3. What will be the output of the program? #include<stdio.h> int main() { char c=48; int i, mask=01; for(i=1; i<=5; i++) { printf("%c", c|mask); mask = mask<<1; } return 0; }

Options

A : 12400

B : 12480

C : 12500

D : 12556

C Programming more Online Exam Quiz

Copyright © 2021
Exam-GK-MCQ-Questions.Com | Contact Us | Privacy Policy | Terms of Use | Sitemap | 0.019134044647217