61. Which of these lines of Java code will give better performance?
1. a | 4 + c >> b & 7;
2. (a | ((( 4 * c ) >> b ) & 7 ))
1. a | 4 + c >> b & 7;
2. (a | ((( 4 * c ) >> b ) & 7 ))
62. What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
int a = 5;
int b = 10;
first:
{
second:
{
third:
{
if (a == b >> 1)
break second;
}
System.out.println(a);
}
System.out.println(b);
}
}
}
class Output
{
public static void main(String args[])
{
int a = 5;
int b = 10;
first:
{
second:
{
third:
{
if (a == b >> 1)
break second;
}
System.out.println(a);
}
System.out.println(b);
}
}
}
63. What will be the output of the following Java code?
class operators
{
public static void main(String args[])
{
int x = 8;
System.out.println(++x * 3 + " " + x);
}
}
class operators
{
public static void main(String args[])
{
int x = 8;
System.out.println(++x * 3 + " " + x);
}
}
64. Which right shift operator preserves the sign of the value?
65. What is true about do statement?
66. 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);
}
}
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);
}
}
67. Which of these is not a bitwise operator?
68. What will be the output of the following Java program?
class increment
{
public static void main(String args[])
{
int g = 3;
System.out.print(++g * 8);
}
}
class increment
{
public static void main(String args[])
{
int g = 3;
System.out.print(++g * 8);
}
}
69. What will be the output of the following Java code?
class Output
{
public static void main(String args[])
{
int x=y=z=20;
}
}
class Output
{
public static void main(String args[])
{
int x=y=z=20;
}
}
70. What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
final int a=10,b=20;
while(a<b)
{
System.out.println("Hello");
}
System.out.println("World");
}
}
class Output
{
public static void main(String args[])
{
final int a=10,b=20;
while(a<b)
{
System.out.println("Hello");
}
System.out.println("World");
}
}
Read More Section(Operators)
Each Section contains maximum 100 MCQs question on Operators. To get more questions visit other sections.