Select chapter



Basics (2.papers)
Data Types (2.papers)
enums (2.papers)
OOPS (4.papers)
Arrays (1.papers)
Structs (2.papers)
Properties (2.papers)
Strings (2.papers)
Interfaces (1.papers)
Constructors (2.papers)
Ref-Out-Keywords (1.papers)
Collections (2.papers)
Generics (1.papers)
Hide

Sponsored Links


  

c# interview questions and answers

Show Answer
Share Facebook gmail Twitter
2
Which of the following options are correct about the below given statement ?
Statement: The default type of enum is integer and has a default value 1 for first enumerator member.
  1. Single Statement is not enough to judge correctness of the statement.
  2. True
  3. False, since underlying members first value always starts with 0.
  4. False, since underlying members type is by default short.
Show Answer
Share Facebook gmail Twitter
3
Which of the following types can be used as underlying types for enumerator members?
  1. int,uint,long,ulong,short,ushort,byte,sbyte,string,bool,float
  2. only floating point types (float ,double,decimal).
  3. All integral types including char type.
  4. only integral types except char type.
Show Answer
Share Facebook gmail Twitter
4
Which of the following statement is correct about enumerators ?
  1. enums cannot participate in inheritance
  2. enums are value types
  3. enumeration members are treated as constants
  4. All the above options are correct
Show Answer
Share Facebook gmail Twitter
5
Which of the following statement is not true about following code?
  public class A
{ 
  private enum WeekDays : int
    {
     Sunday,Monday,Tuesday
    }   
}
class Demo
{ 
    static void Main(string[ ] args)
    { 
        // Use enum WeekDays here
    } 
}
  1. To define a variable of type enum Weekdays in Main(),We must declare enum WeekDays as public and should use the statement, A.WeekDays c;
  2. We must declare enum WeekDays as public to be able to use it outside the class A.
  3. enum WeekDays being private it cannot be used in Main().
  4. None of the above
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
9
Which of the below given statement is correct about enums?
  1. During compilation time an Enum will be converted into a class 
  2. During compilation time an Enum will inherit from System.Enum base class
  3. First and Second statements are correct 
  4. An Enum will be converted into a struct during compilation time
Show Answer
Share Facebook gmail Twitter
10
Which of the below given options are correct about the following code ?
public enum WeekDays
{
   Sunday
}
public class Test
{
    public static void Main(string[] args)
    {
        WeekDays wd = WeekDays.Sunday;
        Console.WriteLine(wd);
    }
}
  1. Compilation error since we cannot declare a variable of type enum.
  2. Compilation error since we cannot declare only one member inside an enum .
  3. Sunday
  4. Runtime error
Show Answer
Share Facebook gmail Twitter
11
Which of the below given statement are correct about enumerators ?
1. Enums improves the code readability.
2. Enums can store set of named constants.
3. Enums can be used with switch case.
  1. First statement alone is correct
  2. Second statement alone is correct
  3. Third statement alone is correct
  4. All the statements are correct
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Read more papers :