What would be the output of the following program? main() {      int i=4;      switch(i)      {           default:           printf("n A mouse is an elephant built by the Japanese");           case 1:                printf(" Breeding rabbits is a hair raising experience");                break;           case 2:                printf("n Friction is a drag");                break;           case 3:                printf("n If practice make perfect, then nobody's perfect");      } }

A)

a) A mouse is an elephant built by the Japanese


B)

b) Breeding rabbits is a hare raising experience


C) c) A mouse is an elephant built by the Japanese Breeding rabbits is a hare raising experience
D) d) None of the above

Showing Answers 1 - 6 of 6 Answers

keerthi

  • Feb 8th, 2006
 

ans:c

  Was this answer useful?  Yes

satyam_un

  • Mar 13th, 2006
 

ans is c. because no match in switch.default will b printed.there is no break after default that's why case 1 wiill b print

  Was this answer useful?  Yes

sreelu

  • Mar 15th, 2006
 

ans : c because in switch i value no match.first default will b printed.no break after default that's why case1 will b printed.

  Was this answer useful?  Yes

supriya ahire

  • Mar 21st, 2006
 

ans is (c)

  Was this answer useful?  Yes

Jialun

  • Jun 27th, 2007
 

Ans should be A+B because there is no break; at the end of default section which will lead the program flow into the first case till the break;

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.