This quiz tests your knowledge of conditional statements that controls the flow of C++ programs.
Question 2
What will be the output of the following C++ code?
#include <iostream> using namespace std; int main() { if (0) { cout << "GEEKSFORGEEKS" ; } else { cout << "geeksforgeeks" ; } return 0; }
GEEKSFORGEEKS
geeksforgeeks
Compilation Error
No Output
Question 3
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main() {
int a = 10;
if (a = 15)
{
time;
cout << a;
if (n == 3)
goto time;
}
break;
return 0;
}
1010
10
infinitely print 10
compile time error
Question 4
The switch statement is also called as?
choosing structure
selective structure
certain structure
bitwise structure
Question 6
if you have to make decision based on multiple choices, which of the following is best suited?
if
if-else
if-else-if
All of the above
Question 7
The if...else statement can be replaced by which operator?
Bitwise operator
Conditional operator
Multiplicative operator
Addition operator
Question 9
Which looping process is best used when the number of iterations is known?
for
while
do-while
all looping processes require that the iterations be known
Question 10
In a nested if-else statement which statement is evaluated first ?
Inner
Outer
Nested
Closer
There are 12 questions to complete.