Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Enumerations Questions
C#.NET enums — analyze the following declaration: enum color : byte { red = 500, green = 1000, blue = 1500 } Which statement about this code is correct?
C#.NET enums — given: enum per { married, unmarried, divorced, spinster } per.married = 10; Console.WriteLine(per.unmarried); Which statement describes the program's behavior?
C#.NET enums — what is printed by: enum color { red, green, blue } color c; c = color.red; Console.WriteLine(c);
C#.NET Enums and reflection: what will this program print for the first enum name? enum color { red, green, blue } color c = color.red; Type t; t = c.GetType(); string[] str; str = Enum.GetNames(t); Console.WriteLine(str[0]);
C#.NET enums with explicit and implicit values: what integers are printed? enum color : int { red, green, blue = 5, cyan, magenta = 10, yellow } Console.Write((int)color.green + ", "); Console.Write((int)color.yellow);
C#.NET enum fundamentals: identify the correct facts about the enum keyword and the System.Enum class.
C#.NET enum with negative starting value: what integers are printed? enum color : int { red = -3, green, blue } Console.Write((int)color.red + ", "); Console.Write((int)color.green + ", "); Console.Write((int)color.blue);
C#.NET enums: choose all correct placement and typing rules.
C#.NET enum category: is an enum a value type or a reference type?
C#.NET accessibility of enums: is an enum declared inside a class, struct, namespace, or interface automatically public?
C#.NET enum placement and accessibility: choose the true statement.
C#.NET enums: select all correct statements about their nature and printing behavior.
C#.NET enums: which underlying datatype is
not
permitted for an enum?
C#.NET Enums — identify the correct statement about default values and member rules. Consider general behavior of enum members in C#.NET (underlying integral types, default starting value, naming rules, and assignment constraints). Choose the single correct statement from the options below.
C#.NET Enums — determine what happens when enum members are initialized with variables. Given: int a = 10; int b = 20; int c = 30; enum color : byte { red = a, green = b, blue = c }
C#.NET — working with private enums in classes. Given a private enum declared inside class Sample, determine how it can be accessed in Main() of another class.
C#.NET — Can an enum be declared inside class, struct, namespace, or interface?