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

1
What is an enum or enumerator ?
  1. An enumerator is a type which can store set of string constants.
  2. An enumerator is a value type which contains set of named constants.
  3. An enumerator stores series of related data which can be modified later.
  4. An enumerator is a type which can store data members as well as behaviors.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
7
Which of the below statement is correct about the following code ?
enum WeekDays
{
   Sunday = 10000000000,
   Monday 
}
  1. Monday value  becomes 1
  2. Monday underlying value  becomes 10000000001
  3. Runtime Error
  4. Compilation error
Show Answer
Share Facebook gmail Twitter
8
How to store a value larger than int in an enumeration member ?
  1. Declare the Enumerator using long as underlying type.
  2. There is no way of storing numbers out side range of int in enumeration members.
  3. We cannot change default integral type of enums.
  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
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
16
Which of the following is true about below given code?
enum WeekDays : Float
{
   Sunday = 10.0,
   Monday , 
   Tuesday = 10,
   Wednesday 
}
  1. Sunday,Mondays are float values,remaining are integers.
  2. Sunday only float,remaining are considered as integer constants.
  3. Sunday to Wednesday becomes float.
  4. An Enums underlying members cannot be declared with Floating point data types.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
20
How to get all enumerator member names present in an enum in to a string array (assume that WeekDays is the name of enum) ?
  1. WeekDays.GetMembers(typeof(WeekDays));
  2. WeekDays.GetNames(typeof(WeekDays));
  3. WeekDays.Get(typeof(WeekDays));
  4. No inbuilt option to display all the enum members.
Show Answer
Share Facebook gmail Twitter
Read more papers :