My Report

C# OOP Test – 3


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. Which among the following differentiates enum in C#.NET from enum in C language?

2. Choose the correct statements about enum used in C#.NET?

3. Choose the correct statement about enum used in C#.NET?

4. Which among the following cannot be used as a datatype for an enum in C#.NET?

5. What will be the output of the following C# code?

enum days:int
{
    sunday = -3,
    monday,
    tuesday
}
Console.WriteLine((int)days.sunday);
Console.WriteLine((int)days.monday);
Console.WriteLine((int)days.tuesday);

6. Wrong statement about enum used in C#.NET is?

7. What will be the output of the following C# code?

  enum per
 {
     a, 
     b, 
     c, 
     d, 
 }
 per.a = 10;
 Console.writeline(per.b);

8. What will be the output of the following C# code?

enum color:int
{
    red,
    green,
    blue = 5,
    cyan,
    pink = 10,
    brown
}
console.writeline((int)color.green);
console.writeline((int)color.brown);

9. What will be the correct statement of the following C# code?

enum color:byte
{
    yellow = 500,
    green = 1000,
    pink = 1300
}

10. What will be the output of the following C# code?

enum letters
{
    a,
    b,
    c
} 
letters l;
l = letters.a;
Console.writeline(l);

11. What will be the output of the following C# code?

 enum colors
 {
     red,
     black,
     pink
 }
 colors s = colors.black;
 type t;
 t = c.GetType();
 string[] str;
 str = Enum.GetNames(t);
 Console.WriteLine(str[0]);

 

Start practicing “1000 MCQs on C#”, and once you are ready, you can take tests on all topics by attempting our “C# Test Series”.

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.