Control Instructions

Q1:
Which of the following statements is correct about the C#.NET code snippet given below?
switch (id)
{
    case 6: 
        grp = 'Grp B'; 
        break;
    
    case 13:
        grp = 'Grp D';
        break;
    
    case 1:
        grp = 'Grp A';
        break;
    
    case ls > 20:
        grp = 'Grp E';
        break ;
    
    case Else:
        grp = 'Grp F';
        break;
}

A
Compiler will report an error in case ls > 20 as well as in case Else.

B There is no error in this switch case statement.

C
Compiler will report an error only in case Else.

D
Compiler will report an error as there is no default case.

E
The order of the first three cases should be case 1, case 6, case 13 (ascending).

ANS:A -

Compiler will report an error in case ls > 20 as well as in case Else.

No answer description is available. Let's discuss.



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.