1.First of all expression inside switch will be executed, i.g, switch(<expression>).
2. Now the value of this expression will be matched with 'case' blocks. If no match then 'default' block will be chosen.
3. If we will not use 'break' statement then the following 'case' blocks or 'default' block will also get executed untill it encounters first 'break' or end of the 'switch' block.
Now in this question:
Initially, i=0.
Case 0, will execute first. It will make i=5. Since there is no 'break' statement, so the following cases will also get executed, making 'i' value to 7, 12 and at the end 16(default case). So in 1st iteration 16 will get printed.
Now in 'for' loop, i= 17, only deafult case will execute , now i=21. So 21 will get printed.
It will terminate the 'for' loop.
I think this is the main concept !! correct if I am wrong.