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# data types interview questions and answers

1
Which is the best way to copy data from integer type to short type ?
  1. Use explicit conversion.
    Ex: int i=900;
    short s=(short) i;
  2. Use implicit conversion.
    Ex: int i=10;
    short s=i;
  3. Use Boxing conversion .
  4. Use methods present Convert class.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
5
What is a value type?
  1. A value type is a data type whose variable name and data, both are stored in the same memory location or a variable can able to store actual data not the reference to actual data.
Show Answer
Share Facebook gmail Twitter
6
What is a reference type ?
  1. A reference type is a data type, where variable is present in one memory location and the actual data is stored in a different memory location.
Show Answer
Share Facebook gmail Twitter
7
What is the difference between a value type and a reference type?
  1. A value type variable always holds the actual data but a reference type variable always holds address of actual data.
Show Answer
Share Facebook gmail Twitter
8
How to return an array from a c# method?
  1. public int GetSalaries()
    {
              int[] salary=new int[] {56000,8900,66000};
              return salary ;
    }
  2. public int[]  GetSalaries()
    {
         int[] salary=new int[] {56000,8900,66000};
         return salary ;
    }
  3. It is not possible to return array from c# methods.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
10
Which of the following method never gives exception while converting string to integer?
  1. Convert.ToInt32(string s);
  2. Int32.Parse(string s);
  3. Int32.TryParse(string s,out x);
  4. None of the above
Show Answer
Share Facebook gmail Twitter
11
What is a Primitive type ?
  1. A primitive type is short hand type for MSIL type.
  2. Primitive type is a data type just like other normal data types in c#.
  3. Primitive type is a type which is directly understandable to the JIT Compiler.
  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
Read more papers :