

Flow Control - Programming
Q1: What will be the output of the program?
int x = l, y = 6;
while (y--)
{
x++;
}
System.out.println('x = ' + x +' y = ' + y);
A x = 6 y = 0
B x = 7 y = 0
C x = 6 y = -1
D Compilation fails.
ANS:A - x = 6 y = 0 Compilation fails because the while loop demands a boolean argument for it's looping condition, but in the code, it's given an int argument. while(true) { //insert code here } |


For help Students Orientation
Mcqs Questions
One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.