int x = 12;  
while (x < 10) {  
   x--;  
}  
System.out.print(x); 

What is the result?

  1. 0

  2. 10

  3. 12

  4. print statement never be executed


Correct Option: C

AI Explanation

To answer this question, let's go through the code step by step:

  1. The code initializes the variable x with the value 12.
  2. The while loop condition is x < 10. Since x is initially 12, the condition is false, and the code inside the while loop will not be executed.
  3. After the while loop, the code prints the value of x, which is 12.

Therefore, the result of the code is 12.

The correct answer is option C.

Find more quizzes: