control-flow
1).Which of the following is the correct syntax for an `if` statement in C++?
2).Which of the following is the correct syntax to declare a `while` loop in C++?
3).What is the output of the following C++ code?
#include <iostream>
using namespace std;
int main() {
for (int i = 0; i < 3; i++) {
cout << i << " ";
}
return 0;
}
4).What is the purpose of the `break` statement in C++?
5).Which loop is guaranteed to execute at least once in C++?
6).What is the correct syntax for a `switch` statement in C++?
7).In which scenario would you use a `continue` statement in C++?
8) What is the output of the following C++ code?
#include <iostream>
using namespace std;
int main() {
for (int i = 0; i < 3; i++) {
if (i == 0) {
cout << i << " ";
} else if (i == 1) {
cout << i << " ";
} else {
cout << i << " ";
}
}
return 0;
}