DotNet FrameWork– Dot Net Basics – Day 6 of 30

How big is the datatype int in .NET?
32 bits.
How big is the char?
16 bits (Unicode).
How do you initiate a string without escaping each backslash?
Put an @ sign in front of the double-quoted string.
What’s the access level of the visibility type internal?
Current application.
Explain encapsulation ?
The implementation is hidden, the interface is exposed.
What data type should you use if you want an 8-bit value that’s signed?
Speaking of Boolean data types, what’s different between C# and C/C++?
There’s no conversion between 0 and false, as well as any other number and true, like in C/C++.
Where are the value-type variables allocated in the computer RAM?
Where do the reference-type variables go in the RAM?
The references go on the stack, while the objects themselves go on the heap.

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.
How do you convert a string into an integer in .NET?
How do you box a primitive data type variable?
Assign it to the object, pass an object.
Why do you need to box a primitive variable?
To pass it by reference.
What’s 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’re using. Microsoft standardized on their garbage collection.
How do you enforce garbage collection in .NET?
What’s different about namespace declaration when comparing that to package declaration in Java?
No semicolon.
What’s the difference between const and readonly?
You can initialize readonly variables to some runtime values. Let’s say your program uses current date and time as one of the values that won’t change. This way you declare public readonly string DateT = new DateTime().ToString().
What happens when you encounter a continue statement inside the for loop?
The code for the rest of the loop is ignored, the control is transferred back to the beginning of the loop.
What’s the advantage of using System.Text.StringBuilder over System.String?
StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it’s being operated on, a new instance is created.
Can you store multiple data types in System.Array?
What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
The first one performs a deep copy of the array, the second one is shallow.
How can you sort the elements of the array in descending order?
By calling Sort() and then Reverse() methods.
What’s the .NET datatype that allows the retrieval of data by a unique key?
What’s class SortedList underneath?
A sorted HashTable.
Will finally block get executed if the exception had not occurred?
Can multiple catch blocks be executed?
No, once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block.
Why is it a bad idea to throw your own exceptions?
Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block? Throwing your own exceptions signifies some design flaws in the project.
What’s a delegate?
A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.
What’s a multicast delegate?
It’s a delegate that points to and eventually fires off several methods.

Please read all the post in the Dotnet Framework series.

Reference : Dilip Kumar Jena ( )


One thought on “DotNet FrameWork– Dot Net Basics – Day 6 of 30

  1. Pingback: DotNet FrameWork – Dot Net Basics Complete Series Reference – Day 0 of 30 « Exploring Dot Net with Dilip Kumar Jena

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s