Top

Bitwise Operators

31.

What will be the output of the program?

#include

int main()
{
    printf("%d >> %d %d >> %d\n", 4 >> 1, 8 >> 1);
    return 0;
}

 

Answer: C

No answer description available for this question.

Enter details here

32.

Which bitwise operator is suitable for turning on a particular bit in a number?

Answer: D

No answer description available for this question.
 

Enter details here

33.

Which bitwise operator is suitable for turning off a particular bit in a number?

Answer: B

No answer description available for this question.
 

Enter details here

34.

Bitwise can be used to generate a random number.

Answer: B

No answer description available for this question.
 

Enter details here

35.

What will be the output of the program ?

#include

int main()
{
    int i=4, j=8;
    printf("%d, %d, %d\n", i|j&j|i, i|j&&j|i, i^j);
    return 0;
}

 

Answer: C

No answer description available for this question.

Enter details here

36.

Which of the following statements are correct about the program?

#include

int main()
{
    unsigned int m[] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
    unsigned char n, i;
    scanf("%d", &n);
    for(i=0; i<=7; i++)
    {
        if(n & m[i])
            printf("yes");
    }
    return 0;
}

 

Answer: B

No answer description available for this question.
 

Enter details here

37.

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

Answer: B

No answer description available for this question.
 

Enter details here

38.

Which bitwise operator is suitable for turning on a particular bit in a number?

Answer: D

No answer description available for this question.

Enter details here

39.

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

Answer: A

0001 => 1
0010 => 2
0100 => 4
1000 => 8

Enter details here

40.

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

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