20 Aug 2013

Basic level c practice controlstatement set 1

1.      main()  WIPRO


            int i=3;




                case 1: printf("one");


               case 2:printf("two");


              case 3: printf("three");




Answer :


Explanation :

The default case can be placed anywhere inside the loop. It is executed only when all other cases doesn't match.

2.      Imp. main()  SAMSUNG


            static int var = 5;

            printf("%d ",var--);





5 4 3 2 1


When static storage class is given, it is initialized once. The change in the value of a static variable is retained even between the function calls. Main is also treated like any other ordinary function, which can be called recursively.