Top

Bitwise Operators

21.

Assuming a integer 2-bytes, What will be the output of the program?

#include

int main()
{
    printf("%x\n", -1<<3>

 

Answer: B

No answer description available for this question.
 

Enter details here

22.

In which numbering system can the binary number 1011011111000101 be easily converted to?

Answer: B

No answer description available for this question.
 

Enter details here

23.

Which of the following statements are correct about the program?

#include
char *fun(unsigned int num, int base);

int main()
{
    char *s;
    s=fun(128, 2);
    s=fun(128, 16);
    printf("%s\n",s);
    return 0;
}
char *fun(unsigned int num, int base)
{
    static char buff[33];
    char *ptr = &buff[sizeof(buff)-1];
    *ptr = '\0';
    do
    {
        *--ptr = "0123456789abcdef"[num ?se];
        num /=base;
    }while(num!=0);
    return ptr;
}

 

Answer: A

No answer description available for this question.

Enter details here

24.

What will be the output of the following C code?

#include 
    int main()
    {
        if (7 & 8)
        printf("Honesty");
            if ((~7 & 0x000f) == 8)
                printf("is the best policy\n");
    }

 

Answer: C

No answer description available for this question.

Enter details here

25.

Bitwise can be used to perform addition and subtraction.

Answer: B

No answer description available for this question.
 

Enter details here

26.

Which statement is suitable to check 3rd (count from 0) bit is high (set) or not?

Answer: D

No answer description available for this question.

Enter details here

27.

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?

Answer: B

No answer description available for this question.
 

Enter details here

28.

What will be the output of the following C code?

#include 
    void main()
    {
        int x = 4;
        int *p = &x;
        int *k = p++;
        int r = p - k;
        printf("%d", r);
    }

 

Answer: C

No answer description available for this question.

Enter details here

29.

Predict the output of following program.

#include 

int main()
{
    int x=10;
    
    x &= ~2;
    printf("x= %d",x);
    
    return 0;
}

 

Answer: B

No answer description available for this question.

Enter details here

30.

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

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