csharp Enum Questions & Answers

Question 6: An enum cannot be declared inside a method.

Question 7: Which of the following statements are TRUE?

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

public class Program
{
	public static void Main()
	{
		Console.Write((int)Color.Green);
	}
}
enum Color 
{
    Red,
    Green=0,
    Blue=0
}
ADVERTISEMENT

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

public class Program
{
	public static void Main()
	{
		Console.Write((int)Color.Blue);
	}
}
enum Color 
{
    Red,
    Green=4,
    Blue
}

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

public class Program
{
	public static void Main()
	{
		Console.Write((int)Color.Red);
	}
}
enum Color 
{
    Red = Blue,
    Blue
}