Java Programming MCQ Questions - Operators & Assignments
31. What should be expression1 evaluate to in using ternary operator as in this line?
expression1 ? expression2 : expression3
View Answer
32. What is the value stored in x in following lines of code?
int x, y, z;
x = 0;
y = 1;
x = y = z = 8;
View Answer
33. What is the order of precedence (highest to lowest) of following operators?
1. &
2. ^
3. ?:
View Answer
34. What is the output of this program?
class operators
{
public static void main(String args[])
{
int var1 = 5;
int var2 = 6;
int var3;
var3 = ++ var2 * var1 / var2 + var2;
System.out.print(var3);
}
}
View Answer
35. What is the output of this program?
class Main
{
public static void main(String args[])
{
int x = 8;
System.out.println(++x * 3 + " " + x);
}
}
View Answer
Also check :