Select the correct option to test your answer:
Computer
Miscellaneous In C Sharp
Difficulty: Medium
What will be the output of the following C# code snippet? class MyClass { int[] a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; public IEnumerator GetEnumerator() { for (int i = 0; i < 20; i++) { if (a[i] % 2 == 0) yield return (int)(a[i]); } } } class Program { static void Main(string[] args) { MyClass mc = new MyClass(); foreach (int i in mc) Console.Write(i + " "); Console.WriteLine(); Console.ReadLine(); } }
More Computer Questions
What data structure is used to efficiently implement a priority queue where elements are ordered based on their priority?
If there are multiple recycle bin for a hard disk
How do you create a kernel density plot in R for a numeric variable values?
Which of the below are common network protocols?
Which of the following property is used to control the scrolling of an image in the background?