Multiple Choice Question

Quiz Guidelines

 

QID: 
352
Question: 

What will be the result of attempting to compile and run the following program?

class TestClass{
public static void main(String args[]){
int i = 0;
for (i=1 ; i<5 ; i++) continue; //(1)
for (i=0 ; ; i++) break; //(2)
for ( ; i<5?false:true ; ); //(3)
}
}

Select 1 option

A. The code will compile without error and will terminate without problems when run.
B. The code will fail to compile, since the continue can't be used this way.
C. The code will fail to compile, since the break can't be used this way
D. The code will fail to compile, since the for statement in the line 2 is invalid.
E. The code will compile without error but will never terminate.

Q&A Set: