Gate CS-2012 Question Paper With Solutions

Q. 3 What will be the output of the following C program segment?

char inChar = 'A';
    switch ( inChar ) {
       case 'A' : printf ("Choice A \n");
       case 'B' :
       case 'C' : printf ("Choice B");
       case 'D' :
       case 'E' :
       default : printf ("No Choice"); 
    }

(A) No Choice

(B) Choice A

(C) Choice A Choice B No Choice

(D) Program gives no output as it is erroneous

Answer: (C)

Explanation:

Gate CS-2012 Question Paper With Solutions

 

Learn More:   Gate CS-2016-2 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here