C# Loop MCQs

Question 6: What will be the output of the following program?

static void Main()
{
    foreach (int number in GetNumbers())
    {
        Console.Write(number.ToString() + " ");
    }
}

public static System.Collections.IEnumerable GetNumbers()
{
    yield return 10;
    yield return 20;
    yield return 30;
} 

Question 7: What will be the output of the following program?

static void Main()
{
    foreach (int number in GetNumbers())
    {
        // do nothing
    }
}

public static System.Collections.IEnumerable GetNumbers()
{
    Console.Write("yield-1 ");
    yield return 10;

    Console.Write("yield-2 ");
    yield return 20;

    Console.Write("yield-3");
    yield return 30;
}