Control Instructions

Q1: Point out the error, if any in the program.
#include<stdio.h>
int main()
{
    int i = 1;
    switch(i)
    {
        case 1:
           printf('Case1');
           break;
        case 1*2+4:
           printf('Case2');
           break;
    }
return 0;
}

A
Error: in case 1*2+4 statement

B Error: No default specified

C
Error: in switch statement

D No Error

ANS:A -

Error: in case 1*2+4 statement

Constant expression are accepted in switch It prints 'Case1'



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.