C# Programming - Enumerations
Exercise : Enumerations - General Questions
- Enumerations - General Questions
6.
Which of the following will be the correct output for the C#.NET code snippet given below?
enum color : int
{
red = -3,
green,
blue
}
Console.Write( (int) color.red + ", ");
Console.Write( (int) color.green + ", ");
Console.Write( (int) color.blue );
7.
An enum that is declared inside a class, struct, namespace or interface is treated as public.
8.
Which of the following statements is correct about the C#.NET code snippet given below?
enum per
{
married,
unmarried,
divorced,
spinster
}
per.married = 10;
Console.WriteLine(per.unmarried);
9.
Which of the following is the correct output for the C#.NET code snippet given below?
enum color: int
{
red,
green,
blue = 5,
cyan,
magenta = 10,
yellow
}
Console.Write( (int) color.green + ", " );
Console.Write( (int) color.yellow );
10.
An enum can be declared inside a class, struct, namespace or interface.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers