Vidyalelo
C++ Programming · Q33

Control Flow Statements in C++

Programming · C++ Programming · question 33

Q33

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

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

Answer: Option D

Solution

Answer: Option D
No explanation is given for this question Let's Discuss on Board