Interviews Questions, Algorithms, Aptitude, C Interview Program, C Theory Question, Aptitude Tricks, Test Series,

Monday, 19 July 2021

Interview Hack#51 Answer

What would be the output of the code? 

Captionless Image

Correct answer
Explanation:
Initially i = 0. Since case 0 is true i becomes 5, and since there is no break statement till the last statement of the switch block, i becomes 16. Now in the next iteration, no case is true, so execution goes to default and i becomes 21. 

0 comments:

Post a Comment