Question 1: What will be the output of the following program?
enum WeekDays
{
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday
}
Console.Write(WeekDays.Monday);
Question 2: What will be the output of the following program?
enum WeekDays
{
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday
}
Console.Write( (int)WeekDays.Monday);
Question 3: What will be the output of the following program?
enum WeekDays
{
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday
}
var holiday = WeekDays.Sunday;
Console.Write(“{0}, {1}”, holiday, (int) holiday);
Question 4: The members of the enum are always public, and no access modifiers can be applied.
Question 5: What will be the output of the following program?
public class Program
{
public static void Main()
{
WeekDays.Sunday = 12;
Console.Write(WeekDays.Sunday);
}
}
enum WeekDays
{
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday
}
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
}
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
}