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

- Online Exam Test Papers | - MCQs[multiple choice questions and answers ] | - Mock Test Papers | - Practice Papers | - Sample Test Papers |

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

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

2.There is no error in this switch case statement.

3.Compiler will report an error only in case Else.

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

Posted Date:-2021-02-20 14:28:12


More MCQS Questions and answers

Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!