Enumerations

Q1: 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);

A The program will output a value 11.

B The program will output a value 1.

C The program will output a value 2.

D The program will report an error since an enum element cannot be assigned a value outside the enum declaration.

E The enum elements must be declared private.

ANS:D - The program will report an error since an enum element cannot be assigned a value outside the enum declaration.

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.