103). Which of these is returned by “greater than”, “less than” and “equal to” operators?

[A]Integers
[B]Floating – point numbers
[C]Boolean
[D]None of the mentioned

Show Answer

104). Which of the following operators can operate on a boolean variable?
 1. &&
   2. ==
   3. ?:
   4. +=

[A]3 & 2
[B]1 & 4
[C]1, 2 & 4
[D]1, 2 & 3

Show Answer

105). Which of these operators can skip evaluating right hand operand?
 1. &&
   2. ==
   3. ?:
   4. +=

[A]!
[B]|
[C]&
[D] &&

Show Answer

106). Which of these statements is correct?
 1. &&
   2. ==
   3. ?:
   4. +=

[A] true and false are numeric values 1 and 0
[B] true and false are numeric values 0 and 1
[C]true is any non zero value and false is 0
[D]true and false are non numeric values

Show Answer

107). What will be the output of the following Java code?
    class Relational_operator 
    {
        public static void main(String args[])
        {
            int var1 = 5; 
            int var2 = 6;
            System.out.print(var1 > var2);
        } 
    }

[A]1
[B]0
[C]true
[D]false

Show Answer

108). What will be the output of the following Java code?
    class bool_operator 
    {
        public static void main(String args[]) 
        {    
             boolean a = true;
             boolean b = !true;
             boolean c = a | b;
 	     boolean d = a & b;
             boolean e = d ? b : c;
             System.out.println(d + " " + e);
        } 
    }

[A]false false
[B]true ture
[C]true false
[D]false true

Show Answer

109). What will be the output of the following Java code?
    class ternary_operator 
    {
        public static void main(String args[]) 
        {        
             int x = 3;
             int y = ~ x;
             int z;
             z = x > y ? x : y;
             System.out.print(z);
        } 
    }

[A]0
[B]1
[C]3
[D]-4

Show Answer

110). What will be the output of the following Java code?
    class Output 
    {
        public static void main(String args[]) 
        {    
             int x , y = 1;
             x = 10;
             if (x != 10 && x / 0 == 0)
                 System.out.println(y);
             else
                 System.out.println(++y);
        } 
    }

[A]1
[B]2
[C]Runtime error owing to division by zero in if condition
[D]Unpredictable behavior of program

Show Answer

111). What will be the output of the following Java code?
 class Output 
    {
        public static void main(String args[]) 
        {    
             boolean a = true;
             boolean b = false;
             boolean c = a ^ b;
             System.out.println(!c);
        } 
    }

[A]0
[B]1
[C]false
[D]True

Show Answer