adplus-dvertising
frame-decoration

Question

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.

Posted under C Programming

Answer: (b).It will test whether the individual bits of n are ON or OFF

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which of the following statements are correct about the program?

Similar Questions

Discover Related MCQs

Q. What are the different types of real data type in C ?

Q. What will you do to treat the constant 3.14 as a long double?

Q. Which of the following range is a valid long double (Turbo C in 16 bit DOS OS) ?

Q. We want to round off x, a float, to an int value, The correct way to do is

Q. The binary equivalent of 5.375 is

Q. A float occupies 4 bytes. If the hexadecimal equivalent of these 4 bytes are A, B, C and D, then when this float is stored in memory in which of the following order do these bytes gets stored?

Q. What will you do to treat the constant 3.14 as a float?

Q. Which of the following statement obtains the remainder on dividing 5.5 by 1.3 ?

Q. Declare the following statement?
"An array of three pointers to chars".

Q. What do the following declaration signify?
int *ptr[30];

Q. Declare the following statement?
"A pointer to an array of three chars".

Q. What do the following declaration signify?
char *arr[10];

Q. What do the following declaration signify?
int (*pf)();

Q. Declare the following statement?
"A pointer to a function which receives an int pointer and returns float pointer".

Q. What do the following declaration signify?
void *cmp();

Q. Declare the following statement?
"A pointer to a function which receives nothing and returns nothing".

Q. What do the following declaration signify?
int *f();

Q. What do the following declaration signify?
void (*cmp)();

Q. What do the following declaration signify?
char **argv;

Q. What do the following declaration signify?
char *scr;