| 31. |
What will be the output of the following Java program?
class jump_statments
{
public static void main(String args[])
{
int x = 2;
int y = 0;
for ( ; y < 10; ++y)
{
if (y % x == 0)
continue;
else if (y == 8)
break;
else
System.out.print(y + " ");
}
}
}
|
||||||||
|
Answer:
Option (c) |
| 32. |
What will be the output of the following Java program?
class comma_operator
{
public static void main(String args[])
{
int sum = 0;
for (int i = 0, j = 0; i < 5 & j < 5; ++i, j = i + 1)
sum += i;
System.out.println(sum);
}
}
|
||||||||
|
Answer:
Option (b) |
| 33. |
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);
}
}
|
||||||||
|
Answer:
Option (b) |
| 34. |
Which of this statement is incorrect?
|
||||||||
|
Answer:
Option (b) |
| 35. |
Which of these jump statements can skip processing the remainder of the code in its body for a particular iteration?
|
||||||||
|
Answer:
Option (d) |
| 36. |
Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?
|
||||||||
|
Answer:
Option (a) |
| 37. |
Which of these are selection statements in Java?
|
||||||||
|
Answer:
Option (a) |
| 38. |
Which of these selection statements test only for equality?
|
||||||||
|
Answer:
Option (b) |