C++ Flow Control

This quiz tests your knowledge of conditional statements that controls the flow of C++ programs.

Last Updated :
Discuss
Comments

Question 1

Default’ case is mandatory in a switch statement.

  • True

  • False

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 5

Can we use string inside switch statement?

  • YES

  • NO

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 8

How many types of loops are there in C++?

  • 1

  • 2

  • 3

  • 4

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

Tags:

There are 12 questions to complete.

Take a part in the ongoing discussion