Q.1.

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

#include<stdio.h>

int main()
{
    printf("%x\n", -1<<3);
    return}
Q.2.

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(2);
    s=fun(16);
    printf("%s\n",s);
    return}
char *fun(unsigned int num, int base)
{
    static char buff[33];
    char *ptr = &buff[sizeof(buff)-1];
    *ptr = '\0';
    do
    {
        *--ptr = "0123456789abcdef"[num %base];
        num /=base;
    }while(num!=0);
    return ptr;
}
Q.3.

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?

Q.4.

Bitwise & and | are unary operators

Q.5.

What will be the output of the program?

#include<stdio.h>

int main()
{
    char c=    int i, mask=    for(i=i<=i++)
    {
        printf("%c", c|mask);
        mask = mask<<    }
    return}
Q.6.

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

Q.7.

What will be the output of the program ?

#include<stdio.h>

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

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\n", a);
    return}
Q.9.

Which of the following statements are correct about the program?

#include<stdio.h>

int main()
{
    unsigned int m[] = {0x0x0x0x0x0x0x0x80};
    unsigned char n, i;
    scanf("%d", &n);
    for(i=i<=i++)
    {
        if(n & m[i])
            printf("yes");
    }
    return
}
Q.10.

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

Q.11.

What will be the output of the program?

#define P printf("%d\n", -1^~0);
#define M(P) int main()\
             {\
                P\
                return 0;\
             }
M(P)
Q.12.

What will be the output of the program?

#include<stdio.h>

int main()
{
    unsigned char i = 0x    printf("%d\n", i<<1);
    return}
Q.13.

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

Q.14.

What will be the output of the program ?

#include<stdio.h>

int main()
{
    int i=j=0xk, l, m;
    k=i|j;
    l=i&j;
    m=k^l;
    printf("%d, %d, %d, %d, %d\n", i, j, k, l, m);
    return
}
Q.15.

What will be the output of the program?

#include<stdio.h>

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