Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1


|Views: 48|Likes:
Published by api-3841500

More info:

Published by: api-3841500 on Oct 18, 2008
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





C# and .NET interview questions .NET

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?

lpublic static void Main()
lpublic static int Main()
lpublic static void Main( string[] args )
lpublic static int Main(string[] args )

5.How do you initialize a two-dimensional array that you don\u2019t know the dimensions of?
lint [, ] myArray; //declaration
lmyArray= new int [5, 8]; //actualinitialization
6.What\u2019s the access level of the visibility type internal? Current assembly.
7.What\u2019s the difference between struct and class in C#?

lStructscannot be inherited.
lStructsare passed by value, not by reference.
lStruct is stored on the stack, not the heap.

8.Explain encapsulation. The implementation is hidden, the interface is exposed.
9.What data type should you use if you want an 8-bit value that\u2019s signed?sb yte.
10.Speaking of Boolean data types, what\u2019s different between C# and C/C++? There\u2019s no

conversion between 0 and false, as well as any other number and true, like in C/C++.
11.Where are the value-type variables allocated in the computer RAM?Stack.
12.Where do the reference-type variables go in the RAM? The references go on the stack, while
the objects themselves go on the heap.
13.What is the difference between the value-type variables and reference-type variables in
terms of garbage collection? The value-type variables are not garbage-collected, they just fall off the
stack when they fall out of scope, the reference-type objects are picked up by GC when their
references go null.

14.How do you convert a string into an integer in .NET?Int32.Pa rse(strin g)
15.How do you box a primitive data type variable? Assign it to the object, pass an object.
16.Why do you need to box a primitive variable? To pass it by reference.
17.What\u2019s the difference between Java and .NET garbage collectors? Sun left the implementation

of a specific garbage collector up to the JRE developer, so their performance varies widely, depending
on whose JRE you\u2019re using. Microsoft standardized on their garbage collection.
18.How do you enforce garbage collection in .NET?S ystem.GC.Col le ct();
19.Can you declare a C++ type destructor in C# like ~MyClass()? Yes, but what\u2019s the point, since
it will call Finalize(), and Finalize() has no guarantees when the memory will be cleaned up, plus, it
introduces additional load on the garbage collector.
20.What\u2019s different about namespace declaration when comparing that to package declaration
in Java? No semicolon.
21.What\u2019s the difference between const and readonly? You can initialize readonly variables to
some runtime values. Let\u2019s say your program uses current date and time as one of the values that
won\u2019t change. This way you declare public readonly string DateT = new DateTime().ToString().
22.What does \a character do? On most systems, produces a rather annoying beep.
23.Can you create enumerated data types in C#?Ye s .

Activity (3)

You've already reviewed this. Edit your review.
1 hundred reads
peterangka liked this
saravanan_saptc liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->