InterviewSolution
Saved Bookmarks
| 1. |
Choose the best statement with respect to following three program snippets./*Program Snippet 1 with for loop*/for (i = 0; i < 10; i++){/*statement1*/continue;/*statement2*/}/*Program Snippet 2 with while loop*/i = 0;while (i < 10){/*statement1*/continue;/*statement2*/i++;}/*Program Snippet 3 with do-while loop*/i = 0;do{/*statement1*/continue;/*statement2*/i++;}while (i < 10);(A) All the loops are equivalent i.e. any of the three can be chosen and they all will perform exactly same.(B) continue can’t be used with all the three loops in C.(C) After hitting the continue; statement in all the loops, the next expression to be executed would be controlling expression (i.e. i < 10) in all the 3 loops.(D) None of the above is correct. |
| Answer» | |