Bitwise can be used to perform addition and subtraction.
Bitwise | can be used to set a bit in number.
Bitwise & can be used in conjunction with ~ operator to turn off 1 or more bits in a number.
Bitwise can be used to reverse a sign of a number.
Bitwise can be used to generate a random number.
Bitwise | can be used to multiply a number by powers of 2.
Bitwise | can be used to set multiple bits in number.
In which numbering system can the binary number 1011011111000101 be easily converted to?
Assunming, integer is 2 byte, What will be the output of the program?
#include<stdio.h>
int main()
{
printf("%x\n", -1>>1);
return}
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=i<i++)
{
printf("%d", (num<<i & 1<<15)?1:0);
}
return}
Bitwise & can be used to divide a number by powers of 2
Left shifting a number by 1 is always equivalent to multiplying it by 2.
Which bitwise operator is suitable for turning off a particular bit in a number?
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 =
printf("%x\n", ~m);
return
}
Which of the following statements are correct about the program?
#include<stdio.h>
int main()
{
unsigned int num;
int c= scanf("%u", &num);
for(;num;num>>= {
if(num & c++;
}
printf("%d", c);
return}
Left shifting an unsigned int or char by 1 is always equivalent to multiplying it by 2.
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
What will be the output of the program?
#include<stdio.h>
int main()
{
printf("%d >> %d %d >> %d\n", 4 >>8 >> 1);
return}
Which bitwise operator is suitable for turning on a particular bit in a number?
What will be the output of the program?
#include<stdio.h>
int main()
{
unsigned int res;
res = (>>(2+1-2)) & (~(1<<2));
printf("%d\n", res);
return}