[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

C Programming :: Control Instructions - Discussion

Home > C Programming > Control Instructions > MCQs Questions Discussion

12 / 33

What would be the output of below program if choice = 'R'?

void main() {
switch (choice) {
case 'R': printf("RED");
 case 'W': printf("WHITE"); 
case 'B' : prinf ("BLUE"); 
default: printf("ERROR");
break;
}

ARED

BRED ERROR

CRED WHITE BLUE ERROR

DRED WHITE BLUE

Answer: Option (Login/Signup)

Show Explanation

As it prints RED then there is no break statement in the switch statment so the rest of the all cases will execute. 

so the output is REDWHITEBLUEERROR

Asked In ::

Post Your Answer Here:     

Reply    
Rate This: +0 -0
    Report


Report Error

Please Login First Click Here