C
Programming and Technical
Programming
Output
Find the Output.
main()
{
int i=3;
switch(i)
{
default:printf("zero");
case 1: printf("one");
break;
case 2:printf("two");
break;
case 3: printf("three");
break;
}}
Options:zero,one,three,run time error
Read Solution (Total 19)
-
- The output will be three.
- 8 years agoHelpfull: Yes(4) No(0)
- three
if i=more than 3 o/p is:zero one
else
correspanding case will be printed
- 8 years agoHelpfull: Yes(1) No(0)
- there will be run time error..when we use switch statement, it is necessary to give an option..
- 8 years agoHelpfull: Yes(0) No(5)
- three is the answer
- 8 years agoHelpfull: Yes(0) No(0)
- three bcz though default is there at beg first it will check all cases then go to default if there is no case here I=3 satisfies case 3
- 8 years agoHelpfull: Yes(0) No(0)
- three
bcos switch() perfoms on case present on body of switch()
here default can be written anywhere in the body of switch() - 8 years agoHelpfull: Yes(0) No(0)
- Three. As in case of switch the value is 3 and also there is a case 3, so it will directly movie to that,there is no difference whether we use default at the top or at the last.
- 8 years agoHelpfull: Yes(0) No(0)
- three
no need to give break at last statement
- 8 years agoHelpfull: Yes(0) No(0)
- output is three as the case selected is 3
- 8 years agoHelpfull: Yes(0) No(0)
- three, order of cases may be different in switch. It always execute the matching case.
- 8 years agoHelpfull: Yes(0) No(0)
- Answer: three
int i=3 so it directly jumps to case 3 and prints three - 8 years agoHelpfull: Yes(0) No(0)
- zero.
As when first the i enter the block it wants to search for 3 but it encountered default which gets printed. - 8 years agoHelpfull: Yes(0) No(0)
- three,given i=3
hence case 3 will be occurring. - 8 years agoHelpfull: Yes(0) No(0)
- output is three because the i value is three and in switch case the choice of 3 is three
- 8 years agoHelpfull: Yes(0) No(0)
- three
as it matches 3rd condition
- 8 years agoHelpfull: Yes(0) No(0)
- three will be the answer
- 8 years agoHelpfull: Yes(0) No(0)
- The output will be three.
- 7 years agoHelpfull: Yes(0) No(0)
- answer is three.
- 6 years agoHelpfull: Yes(0) No(0)
- three.here the condition is true so it makes three
- 4 years agoHelpfull: Yes(0) No(0)
C Other Question