Bitwise Operators

Q1:
Which of the following statements are correct about the program?
#include<stdio.h>

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;
}

A It will put OFF all bits that are ON in the number n

B It will test whether the individual bits of n are ON or OFF

C It will put ON all bits that are OFF in the number n

D It will report compilation errors in the if statement.

ANS:A - It will put OFF all bits that are ON in the number n

No answer description is available. Let's discuss.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.