11. In C++, what is the difference between the 'while' loop and the 'do-while' loop? A. 'while' loop always executes at least once, 'do-while' loop may not B. 'while' loop always executes at least once, 'do-while' loop always does C. 'while' loop checks condition before execution, 'do-while' loop checks after execution D. None of the above Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
12. What is the purpose of the 'if-else if-else' statement in C++? A. Provides multiple conditions to be tested B. Executes multiple statements C. Executes only one statement D. Terminates the program Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
13. What will be the output of the following code: for (int i = 0; i < 3; ++i) { for (int j = 0; j < 2; ++j) { cout << i << j << " "; } }? A. Compilation error B. 00 10 20 01 11 C. 00 11 22 33 44 D. 00 01 10 11 20 21 Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
14. What is the syntax for the 'if-else' statement in C++? A. if (condition) then { statement; } else { statement; } B. if { condition } { statement; } else { statement; } C. if (condition) { statement; } else { statement; } D. if (condition) { statement; } else statement; Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
15. What does the 'else if' statement allow in C++? A. Skips to the next iteration B. Additional condition checks C. Terminate the program D. None of the above Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
16. What is the output of the following code: int x = 10; if (x == 10) { cout << "x is 10"; } else { cout << "x is not 10"; } in C++? A. No output B. Compilation error C. x is 10 D. x is not 10 Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
17. What is the purpose of the 'continue' statement in a loop in C++? A. Terminates the loop B. Skips the remaining code in the loop C. Restarts the loop D. Skips the current iteration Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
18. What will be the output of the following code: int i = 0; while (i < 3) { cout << i << " "; i++; } in C++? A. Compilation error B. 1 2 3 C. 0 1 2 3 D. 0 1 2 Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
19. What is the purpose of the 'break' statement in a loop in C++? A. Skips the next iteration B. Skips to the next condition C. Terminates the loop D. Restarts the loop Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
20. What will be the output of the following code: for (int i = 0; i < 5; ++i) { if (i == 2) continue; cout << i << " "; } in C++? A. 0 1 2 3 4 B. 0 1 3 4 C. Compilation error D. 1 2 3 4 5 Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board