C++ Control Statements

Last Updated :
Discuss
Comments

Question 1

Which of the following is a conditional control statement in C++?

  • if

  • for

  • break

  • continue

Question 2

What keyword is used to exit from a switch statement?

  • exit

  • break

  • continue

  • stop

Question 3

Which statement allows jumping to another part of the program?

  • goto

  • break

  • return

  • continue

Question 4

What happens if a switch case does not contain a break?

  • Only that case executes

  • Compiler error

  • Fall-through to next case

  • Program terminates

Question 5

Which statement is used to terminate a function early?

  • return

  • break

  • continue

  • exit

Question 6

Can switch be used with floating point variables in C++?

  • Yes

  • No

  • Only with Float

  • Only with Double

Question 7

Which of these is a valid syntax for an if-else ladder in C++?

  • if (con1) {.....}else if (con2) {.....} else {...}

  • if (con1) {.....} elseif (con2) {.....} else {...}

  • if (con) {.....} else {...}

  • if (con) {.....} elif (con2) {...}

Question 8

What is the output if the condition in if is false and no else is present?

  • Error

  • Execute the next line

  • Skips the if block and continues with the rest.

  • Crash

Question 9

What will be the output of the following?

C++
int x = 10;
if (x == 10)
    cout << "Ten";
else
    cout << "Not Ten";


  • Ten

  • Not Ten

  • Compile Error

  • None

Question 10

Output of the code?

C++
int x = 5;
if (x > 10)
    cout << "Big";
else
    cout << "Small";


  • Big

  • Small

  • Nothing

  • Compile Error

Tags:

There are 17 questions to complete.

Take a part in the ongoing discussion