Multiple Choice Question

Quiz Guidelines

 

QID: 
167
Question: 

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

class TestClass{
public static void main(String args[]){
boolean b = false;
int i = 1;
do{
i++ ;
} while (b = !b);
System.out.println( i );
}
}

Select 1 option

A. The code will fail to compile, 'while' has an invalid condition expression.
B. It will compile but will throw an exception at runtime.
C. It will print 3.
D. It will go in an infinite loop.
E. It will print 1.

Q&A Set: