C Programming :: Control Instructions - Discussion
Home > C Programming > Control Instructions > MCQs Questions Discussion
12 / 33
What would be the output of below program if choice = 'R'?
void main() {
switch (choice) {
case 'R': printf("RED");
case 'W': printf("WHITE");
case 'B' : prinf ("BLUE");
default: printf("ERROR");
break;
}
void main() {
switch (choice) {
case 'R': printf("RED");
case 'W': printf("WHITE");
case 'B' : prinf ("BLUE");
default: printf("ERROR");
break;
}
ARED
BRED ERROR
CRED WHITE BLUE ERROR
DRED WHITE BLUE
Answer: Option (Login/Signup)
Show Explanation
As it prints RED then there is no break statement in the switch statment so the rest of the all cases will execute.
so the output is REDWHITEBLUEERROR
Asked In ::
The answer is C
As it prints RED then there is no break statement in the switch statment so the rest of the all cases will execute.
so the output is REDWHITEBLUEERROR
Read Full Answer
Report Error
Please Login First Click Here