Switch case MCQ 9 : Multiple Parameters in Case Label
Switch case MCQ 9 : Multiple Parameters in Case Label
Problem Statement 9 :
void main()
{
int choice = 2 ;
switch(choice)
{
case 1,2,1 :
printf("nAllas");
break;
case 1,3,2 :
printf("nBabo");
break;
case 4,5,3 :
printf("nHurray");
break;
}
}
Options : Guess the Output
- Babo
- Error : Multiple Parameter’s not allowed
- Hurray
- Allas
How ? Why ?
- Multiple Numbers in cases are seperated by comma
- Comma Returns Rightmost number
- case 1,2,3 will returns 3
- So two cases case 1,2,3 AND case 2,3,3 are two same cases
Select Switch Case Question :