InterviewSolution
Saved Bookmarks
| 1. |
What values will be assigned to the variables ua, ub, uc and fail after the execution of the following program segment:void main() {int i = 0,ua = 0,ub = 0,uc = 0,fai l= 0;while(i<=5){switch(i++){ case 1:case 2: ++ua;case 3:case 4: ++ub;case 5: ++uc;default: ++fai;} //switch} //whilecout<<ua<<end1;cout<<ub<<end1;cout<<uc<<end1;cout<<fail<<end1;} |
|
Answer» Values assigned to the variables ua, ub, uc and fail after the execution are as following: ua = 2 ub = 4 uc = 5 fail = 6 |
|