From where break statement causes an exit?
Only from innermost loop
Terminates a program
Only from innermost switch
From innermost loops or switches
SHOW ANSWERWhich of the following loops will execute the body of loop even when condition controlling the loop is initially false?
do-while
while
for
none of the mentioned
SHOW ANSWERWhat is the output of this program?
class Sample{
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);
}
}
5
6
14
compilation error
SHOW ANSWERWhat is the output of this program?
class Sample{
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 + " ");
}
}
}
1 3 5 7
2 4 6 8
1 3 5 7 9
1 2 3 4 5 6 7 8 9
SHOW ANSWERWhat is the output of this program?
class Output{
public static void main(String args[]) {
final int a=10,b=20;
while(a<b)
{
System.out.println("Hello");
a++;
}
}
}
Hello
run time error
Hello world
compile time error
SHOW ANSWERWhat is true about a break?
Break stops the execution of entire program
Break halts the execution and forces the control out of the loop
Break forces the control out of the loop and starts the execution of next iteration
Break halts the execution of the loop for certain time frame
SHOW ANSWERWhich of the following is not OOPS concept in Java?
Inheritance
Encapsulation
Polymorphism
Compilation
SHOW ANSWERWhich of the following is a type of polymorphism in Java?
Compile time polymorphism
Execution time polymorphism
Multiple polymorphism
Multilevel polymorphism
SHOW ANSWERWhen method overloading does is determined?
At run time
At compile time
At coding time
At execution time
SHOW ANSWERWhich concept of Java is a way of converting real world objects in terms of class?
Polymorphism
Encapsulation
Abstraction
Inheritance
SHOW ANSWERWhich concept of Java is achieved by combining methods and attribute into a class?
Encapsulation
Inheritance
Polymorphism
Abstraction
SHOW ANSWERMethod overriding is combination of inheritance and polymorphism?
True
false
SHOW ANSWERWhich component is used to compile, debug and execute java program?
JVM
JDK
JIT
JRE
SHOW ANSWER