Vidyalelo
C# Programming · Q41

Control Flow Statements in C Sharp

Programming · C# Programming · question 41

Q41

What will be the output of the following C# code? static void Main(string[] args) int i = 2, j = 4; switch (i + j * 2) case 1 : case 2 : Console.WriteLine("1 and 2"); break; case 3 to 10: Console.WriteLine("3 to 10"); break; Console.ReadLine();

A.
3 to 10 will be printed
B.
1 and 2 will be printed
C.
The code reports an error as missing ; before :
Answer
D.
The code gives output as 3 to 10

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board