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;
}

 Posted by Niladri.Biswas on 6/4/2013 | Category: C# Interview questions | Views: 5506 | Points: 40
Select from following answers:
  1. There is no error in this switch case statement
  2. Compiler will report an error in ‘case ls > 20’ and in’ case Else’
  3. Compiler will report an error as there is no default case
  4. The order of the first three cases should be ‘case 1’, ‘case 6’ and ‘case 13’; i.e. ascending
  5. All Above

Show Correct Answer


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Sanishtj on: 6/7/2013 | Points: 10
Option 2 is the correct answer !!

Login to post response