Enumerations

Q1: Which of the following statements is correct about the C#.NET code snippet given below?
enum color : byte
{
    red = 500,
    green = 1000,
    blue = 1500
}

A byte values cannot be assigned to enum elements.

B enum elements should always take successive values.

C
Since 500, 1000, 1500 exceed the valid range of byte compiler will report an error.

D
Since 500, 1000, 1500 exceed the valid range of byte compiler will report an error.

E enum elements should be declared as private.

ANS:C -

Since 500, 1000, 1500 exceed the valid range of byte compiler will report an error.

No answer description is available. Let's discuss.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.