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

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

Decimal system
Hexadecimal system
Octal system
No need to convert
Assunming, integer is 2 byte, What will be the output of the program?
#include<stdio.h>

int main()
{
    printf("%x", -1>>1);
    return 0;
}

ffff
0fff
0000
fff0
Which of the following statements are correct about the program?
#include<stdio.h>

int main()
{
    unsigned int num;
    int i;
    scanf("%u", &num);
    for(i=0; i<16; i++)
    {
        printf("%d", (num<<i & 1<<15)?1:0);
    }
    return 0;
}

It prints all even bits from num
It prints all odd bits from num
It prints binary equivalent num
Error
Left shifting a number by 1 is always equivalent to multiplying it by 2.

True
False
Bitwise can be used to reverse a sign of a number.

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

&& operator
& operator
|| operator
! operator
If an unsigned int is 2 bytes wide then, What will be the output of the program ?
#include<stdio.h>

int main()
{
    unsigned int m = 32;
    printf("%x", ~m);
    return 0;
}

ffff
0000
ffdf
ddfd
Which of the following statements are correct about the program?
#include<stdio.h>

int main()
{
    unsigned int num;
    int c=0;
    scanf("%u", &num);
    for(;num;num>>=1)
    {
        if(num & 1)
            c++;
    }
    printf("%d", c);
    return 0;
}

It counts the number of bits that are ON (1) in the number num.
It counts the number of bits that are OFF (0) in the number num.
It sets all bits in the number num to 1
Error
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

True
False
Bitwise can be used to generate a random number.

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

&& operator
& operator
|| operator
| operator
Assuming a integer 2-bytes, What will be the output of the program?
#include<stdio.h>

int main()
{
    printf("%x", -1<<3);
    return 0;
}

ffff
fff8
-1
Which of the following statements are correct about the program?
#include<stdio.h>
char *fun(unsigned int num, int base);

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

It converts a number to a given base.
It converts a number to its equivalent binary.
It converts a number to its equivalent hexadecimal.
It converts a number to its equivalent octal.
Bitwise & and | are unary operators

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

Yes
No
Which bitwise operator is suitable for checking whether a particular bit is on or off?

&& operator
& operator
|| operator
! operator
If an unsigned int is 2 bytes wide then, What will be the output of the program ?
#include<stdio.h>

int main()
{
    unsigned int a=0xffff;
    ~a;
    printf("%x", a);
    return 0;
}

ffff
0000
00ff
ddfd
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;
}

It will put OFF all bits that are ON in the number n
It will test whether the individual bits of n are ON or OFF
It will put ON all bits that are OFF in the number n
It will report compilation errors in the if statement.
Bitwise & can be used to check if more than one bit in a number is on.

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

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

Yes
No
What will be the output of the program?
#include<stdio.h>

int main()
{
    unsigned char i = 0x80;
    printf("%d", i<<1);
    return 0;
}

0
256
100
80
Bitwise & can be used to divide a number by powers of 2

True
False
Bitwise can be used to perform addition and subtraction.

Yes
No
What will be the output of the program?
#include<stdio.h>

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

4 1 8 1
4 >> 1 8 >> 1
2 >> 4 Garbage value >> Garbage value
2 4
Left shifting an unsigned int or char by 1 is always equivalent to multiplying it by 2.

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

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

12400
12480
12500
12556
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?

True
False
What will be the output of the program?
#define P printf("%d", -1^~0);
#define M(P) int main()
             {
                P
                return 0;
             }
M(P)

1
0
-1
2
What will be the output of the program ?
#include<stdio.h>

int main()
{
    int i=32, j=0x20, k, l, m;
    k=i|j;
    l=i&j;
    m=k^l;
    printf("%d, %d, %d, %d, %d", i, j, k, l, m);
    return 0;
}

0, 0, 0, 0, 0
0, 32, 32, 32, 32
32, 32, 32, 32, 0
32, 32, 32, 32, 32
What will be the output of the program?
#include<stdio.h>

int main()
{
    printf("%d %d", 32<<1, 32<<0);
    printf("%d %d", 32<<-1, 32<<-0);
    printf("%d %d", 32>>1, 32>>0);
    printf("%d %d", 32>>-1, 32>>-0);
    return 0;
}

Garbage values
64 32
0 32
16 32
0 32
All zeros
8 0
0 0
32 0
0 16
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", res);
    return 0;
}

32
64
0
128
What will be the output of the program ?
#include<stdio.h>

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

4, 8, 0
1, 2, 1
12, 1, 12
0, 0, 0