Examveda

In C++, what is the purpose of the 'if-else' statement?

A. Allows execution of different blocks of code based on a condition

B. Terminates the program

C. Executes the same block of code repeatedly

D. Skips the current iteration in a loop

Answer: Option A


Join The Discussion

Related Questions on Control Flow Statements in C plus plus

What is the correct syntax for the 'switch' statement in C++?

A. switch (expression) { case constant1: statement1; case constant2: statement2; }

B. switch (expression) { case constant1: statement1; break; case constant2: statement2; break; default: defaultStatement; }

C. switch (expression) { case constant1: statement1; default: defaultStatement; }

D. None of the above