1.    int x = 10;
2.    do {
3.        x--;
4.    } while(x < 10);
How many times will the line 3 be executed?
Explanation
In this example, a new value of 9 gets into the condition, then there will be 8, 7, etc. to -2147483648. Then,when possessing the decrement x passes the limit of the range and becomes equal to 2147483647, the cycle stops.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes