81. What will be the output of the following Java program?
class Modulus
{
public static void main(String args[])
{
double a = 25.64;
int b = 25;
a = a % 10;
b = b % 10;
System.out.println(a + " " + b);
}
}
class Modulus
{
public static void main(String args[])
{
double a = 25.64;
int b = 25;
a = a % 10;
b = b % 10;
System.out.println(a + " " + b);
}
}
82. What should be expression1 evaluate to in using ternary operator as in this line?
expression1 ? expression2 : expression3
expression1 ? expression2 : expression3
83. Modulus operator, %, can be applied to which of these?
84. Which of these is returned by "greater than", "less than" and "equal to" operators?
85. Which of the following is not a decision making statement?
86. Which of the following is not a valid jump statement?
87. What would be the output of the following code snippet if variable a=10?
if(a<=0)
{
if(a==0)
{
System.out.println("1 ");
}
else
{
System.out.println("2 ");
}
}
System.out.println("3 ");
if(a<=0)
{
if(a==0)
{
System.out.println("1 ");
}
else
{
System.out.println("2 ");
}
}
System.out.println("3 ");
88. Decrement operator, - -, decreases the value of variable by what number?
89. What will be the output of the following Java program?
class selection_statements
{
public static void main(String args[])
{
int var1 = 5;
int var2 = 6;
if ((var2 = 1) == var1)
System.out.print(var2);
else
System.out.print(++var2);
}
}
class selection_statements
{
public static void main(String args[])
{
int var1 = 5;
int var2 = 6;
if ((var2 = 1) == var1)
System.out.print(var2);
else
System.out.print(++var2);
}
}
90. What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
int a,b,c,d;
a=b=c=d=20;
a+=b-=c*=d/=20;
System.out.println(a+" "+b+" "+c+" "+d);
}
}
class Output
{
public static void main(String args[])
{
int a,b,c,d;
a=b=c=d=20;
a+=b-=c*=d/=20;
System.out.println(a+" "+b+" "+c+" "+d);
}
}
Read More Section(Operators)
Each Section contains maximum 100 MCQs question on Operators. To get more questions visit other sections.