Given:
What is the result?
Given:
What is the result?
First, the variable x is initialized to 2, and y is set to x. The program enters a while loop that runs while y is less than 3. Inside the loop, there is a switch statement on the value of y. For y=2, the switch case 0+x is executed, which is case 2. The value of y is incremented (y++) to become 3. Because there is no break statement, the next case (case 1) is also executed, incrementing y again to 4. Now y is no longer less than 3, so the loop terminates. The final value of y, which is 4, is printed.
Tested & the code will print 4. Reason is that, both the cases (0+x and 1) will get executed since there's no break statement.
the code will print 4