| 21. |
What is the output of relational operators?
|
||||||||
|
Answer:
Option (b) |
| 22. |
Which of these is returned by “greater than”, “less than” and “equal to” operators?
|
||||||||
|
Answer:
Option (c) |
| 23. |
Which of the following operators can operate on a boolean variable?
1. && 2. == 3. ?: 4. +=
|
||||||||
|
Answer:
Option (d) |
| 24. |
Which of these operators can skip evaluating right hand operand?
|
||||||||
|
Answer:
Option (d) |
| 25. |
Which of these statements is correct?
|
||||||||
|
Answer:
Option (d) |
| 26. |
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);
}
}
|
||||||||
|
Answer:
Option (d) |
| 27. |
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);
}
}
|
||||||||
|
Answer:
Option (d) |
| 28. |
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);
}
}
|
||||||||
|
Answer:
Option (c) |
| 29. |
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);
}
}
|
||||||||
|
Answer:
Option (b) |
| 30. |
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);
}
}
|
||||||||
|
Answer:
Option (c) |