Q.17:#include int main() { int x; for(x=-1; x<=10; x++) { if(x < 5) continue; else break;
printf("IndiaBIX"); } return 0; }
a) O O times
b) O 11 times
c) O 10 times
d) Infinite times
Answers
Answer:
a) 0 times
Explanation:
The condition x<5 is true until x=5, so the true block executed. The code after the continue statement(including printf("IndiaBIX");) will not executed and go to increment step(x++). Again the loop is continued.
When x=5, then else block executed, it has break statement, So loop is terminated.
Here the control never go to printf("IndiaBIX"); statement.
Answer:
Answer to this question will be a) O O times
Explanation:
Up to x=5, the condition x5 is true, hence the true block was performed. The code that follows the continue clause, including printf("IndiaBIX");, is not run and instead moves to the step(x++) increment. The loop is repeated once more. When x equals 5, the else block is executed. It contains a break statement, which ends the loop. The control in this case never makes the printf("IndiaBIX"); statement.
Hence , the answer will be a) O O times
#SPJ2