Correct Answer - Option 4 : Goodbye1Goodybye2
A switch statement tests the value of a variable and compares it with multiple cases.
Once the case match is found, a block of statements associated with that particular case is executed.
A switch-case statement can accept int, char, long datatypes.
int ch = 1;
1. In the given program ch = 1;
The expression used in a switch statement must have an integral or enumerated type, or be of a class type in which the class has a single conversion function to an integral or enumerated type.
2. When the variable being switched on is equal to a case, the statements following that case will execute until a break statement is reached.
As there is no break statement after case 1, case 2 will also be executed.
3. Hence in the output, we will get:
Hence option (4) is the correct answer.