C# Programming - Control Instructions - Discussion

Discussion Forum : Control Instructions - General Questions (Q.No. 15)
15.
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;
}
Compiler will report an error in case ls > 20 as well as in case Else.
There is no error in this switch case statement.
Compiler will report an error only in case Else.
Compiler will report an error as there is no default case.
The order of the first three cases should be case 1, case 6, case 13 (ascending).
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.