ExamVeda
Login
Home
This question belongs to C Program Control Structures
Control Structures
?

What will be the following code's output if choice = 'R'?
switch(choice)
{
   case 'R' : printf("RED");
   case 'W' : printf("WHITE");
   case 'B' : printf("BLUE");
   default  : printf("ERROR");break;
}

Answer & Solution
Correct Answer: Option B

As the first option is matching, the cases are evaluated till the break statement is encountered or end of switch statement is encountered.

Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.