Question: QUESTION 1 What is wrong with the following? It tries to print out the word for each number but has a bug intn2 switchin) case

QUESTION 1 What is wrong with the following? It tries to print out the word for each number but has a bug intn2 switchin) case 1: printf("onein"); case 2: printf("twoin": case 3: printf("threeln" 2 There should be a default case. O You need at least 2 statements in every case There should be a break at the end of every case, There must be cases for all the numbers from 1 to 10. QUESTION 2 double d = 6: switch(d) case 5: printf"fivein": There needs to be a case for 6 O You need a break at the end of the case. O You cannot use a double in a switch There should be a default case QUESTION 3 The following tries to handle an option and print an error if the option is not recognized. How do we fix it? int option 2 switch(option) case 1: printf("doing option 1 ") break: case 2: printf"doing option 2 " break > printf("Unrecognized option(should be 1 or 2 "); There should be an "else before the final printf. O The final print should be in a default case The final printf should be at the end of the second case There is nothing wrong, QUESTION 4 On which line is the if with which the else on line 6 is matched? 01 ifa d) printf(" "); 03 else 04 printfcin": 05 ifle sf) printf(" "); 06 else printften: O 01 O 05 O 02 O 04
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
