93). Which operator is used to invert all the digits in a binary representation of a number?

[A]~
[B]<<<
[C]>>>
[D]^

Show Answer

94). On applying Left shift operator, <<, on integer bits are lost one they are shifted past which position bit?

[A]1
[B]32
[C]33
[D]31

Show Answer

96). Which of these statements are incorrect?

[A]The left shift operator, <<, shifts all of the bits in a value to the left specified number of times
[B]The right shift operator, >>, shifts all of the bits in a value to the right specified number of times
[C]The left shift operator can be used as an alternative to multiplying by 2
[D]The right shift operator automatically fills the higher order bits with 0

Show Answer

97). What will be the output of the following Java program?
   class bitwise_operator 
    {
        public static void main(String args[])
        {
            int var1 = 42;
            int var2 = ~var1;
            System.out.print(var1 + " " + var2);     	
        } 
    }

[A]42 42
[B]43 43
[C]42 -43
[D]42 43

Show Answer

98). What will be the output of the following Java program?
    class bitwise_operator 
    {
        public static void main(String args[]) 
        {    
             int a = 3;
             int b = 6;
 	     int c = a | b;
             int d = a & b;             
             System.out.println(c + " "  + d);
        } 
    }

[A]7 2
[B]7 7
[C]7 5
[D]5 2

Show Answer

99). What will be the output of the following Java program?
    class leftshift_operator 
    {
        public static void main(String args[]) 
        {        
             byte x = 64;
             int i;
             byte y; 
             i = x << 2;
             y = (byte) (x << 2)
             System.out.print(i + " " + y);
        } 
    }

[A] 0 64
[B]64 0
[C]0 256
[D]256 0

Show Answer

100). What will be the output of the following Java program?
    class rightshift_operator 
    {
        public static void main(String args[]) 
        {    
             int x; 
             x = 10;
             x = x >> 1;
             System.out.println(x);
        } 
    }

[A]10
[B]5
[C]2
[D]20

Show Answer

101). What will be the output of the following Java program?
    class Output 
    {
        public static void main(String args[]) 
        {    
             int a = 1;
             int b = 2;
             int c = 3;
             a |= 4;
             b >>= 1;
             c <<= 1;
             a ^= c;
             System.out.println(a + " " + b + " " + c);
        } 
    }

[A] 3 1 6
[B]2 2 3
[C] 2 3 4
[D] 3 3 6

Show Answer