C# and .NET interview questions



1. How big is the datatype int in .NET? 32 bits.

2. How big is the char?
16 bits (Unicode).

3. How do you initiate a string without escaping each backslash? Put an @ sign in front of the double-quoted string.

4. What are valid signatures for the Main function?
* public static void Main()
* public static int Main()
* public static void Main( string[] args )
* public static int Main(string[] args )

5. Does Main() always have to be public? No.

6. How do you initialize a two-dimensional array that you don’t know the dimensions of?
* int [, ] myArray; //declaration
* myArray= new int [5, 8]; //actual initialization

7. What’s the access level of the visibility type internal? Current assembly.

8. What’s the difference between struct and class in C#?
* Structs cannot be inherited.
* Structs are passed by value, not by reference.
* Struct is stored on the stack, not the heap.

9. Explain encapsulation. The implementation is hidden, the interface is exposed.

10. What data type should you use if you want an 8-bit value that’s signed? sbyte.



Leave a comment

Name: (Required)

eMail: (Required)

Website:

Comment:

del.icio.usDiggFurlBlinklistRedditTechnoratiYahoo My WebNewsvine
SocializerMa.gnoliaStumble UponGoogle BookmarksRawSugarSquidooSpurlBlinkBits
NetvouzRojoBlogmarksCo.mmentsScuttleFeed Me LinksYiggMr.Wong