Question 1 of 25
Hints left: 3
Q1
What will be the output of the following code: int i = 0; while (i < 3) { cout << ++i << " "; } in C++?
Q2
How many times will the following 'for' loop iterate: for (int i = 0; i < 5; ++i) in C++?
Q3
In C++, what is the syntax for the 'while' loop?
Q4
What is the purpose of the 'if' statement in C++?
Q5
What does the 'default' case represent in a 'switch' statement in C++?
Q6
What is the correct syntax for the 'do-while' loop in C++?
Q7
What is the output of the following code: for (int i = 0; i < 5; ++i) { if (i == 3) continue; cout << i << " "; } in C++?
Q8
In C++, what is the purpose of the 'if-else' statement?
Q9
What will be the output of the following code: int i = 5; if (i != 5) cout << "Not equal"; else cout << "Equal"; in C++?
Q10
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 << " "; } } in C++?
Q11
What is the correct way to call a function named "add" that takes two parameters in C++?
Q12
What will be the output of the following code: int i = 5; if (i != 5) cout << "Not equal"; else cout << "Equal"; in C++?
Q13
What does the 'return' statement do in a function in C++?
Q14
What is the output of the following code: int i = 0; do { cout << i << " "; i++; } while (i < 3); in C++?
Q15
What will be the output of the following code: int i = 0; while (i < 5) { cout << i << " "; ++i; } in C++?
Q16
In C++, what is the purpose of the 'continue' statement in a loop?
Q17
What is the correct syntax for defining a function in C++?
Q18
What is the output of the following code: int i = 0; while (i < 5) { cout << i << " "; ++i; } in C++?
Q19
What is the purpose of a function prototype in C++?
Q20
What does the 'continue' statement do in a loop in C++?
Q21
What is the syntax for the 'switch' statement in C++?
Q22
What is the syntax for the 'else if' statement in C++?
Q23
What is the output of the following code: int sum(int a, int b) { return a + b; } cout << sum(3, 5); in C++?
Q24
Which keyword is used to define a function in C++ that does not return any value?
Q25
What will be the output of the following code: int x = 10; if (x < 5) cout << "Less"; else if (x == 5) cout << "Equal"; else cout << "More"; in C++?