MCQs > IT & Programming > C# > What will be the output of the following Main program in a C# console application (Assume required namespaces are included)? private static void TestSwitch(int iValue) { switch (iValue) { case 1: case 2: case 3: case 4: Console.WriteLine(I am less than 5.); break; case 6: case 7: case 8: Console.WriteLine('I am greater than 5.'); break; default: Console.WriteLine('I handle rest.'); break; } } static void Main(string[] args) { TestSwitch(2); TestSwitch(8); TestSwitch(5); Console.ReadLine(); }

C# MCQs

What will be the output of the following Main program in a C# console application (Assume required namespaces are included)? private static void TestSwitch(int iValue) { switch (iValue) { case 1: case 2: case 3: case 4: Console.WriteLine("I am less than 5."); break; case 6: case 7: case 8: Console.WriteLine("I am greater than 5."); break; default: Console.WriteLine("I handle rest."); break; } } static void Main(string[] args) { TestSwitch(2); TestSwitch(8); TestSwitch(5); Console.ReadLine(); }

Answer

Correct Answer: I am less than 5. I am greater than 5. I handle rest.

Explanation:

Note: This Question is unanswered, help us to find answer for this one

C# Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

C# Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it