126. 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.
127. How can you sort the elements of the array in descending order?
By calling Sort() and then Reverse() methods.
128. What's the .NET datatype that allows the retrieval of data by a unique key?
HashTable.
129. What's class SortedList underneath?
A sorted HashTable.
130. Will finally block get executed if the exception had not occurred?
Yes.
131. 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.
132. 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.
133. What's a delegate?
A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.
134. What's a multicast delegate?
It's a delegate that points to and eventually fires off several methods.
135. How's the DLL Hell problem solved in .NET?
Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.
136. What are the ways to deploy an assembly?
An MSI installer, a CAB archive, and XCOPY command.
137. What's a satellite assembly? When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.
138. What namespaces are necessary to create a localized application?
System.Globalization, System.Resources.
140. What does assert() do? In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.
141. What's the difference between the Debug class and Trace class?
Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.
142. Why are there five tracing levels in System.Diagnostics.TraceSwitcher? The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.
143. Where is the output of TextWriterTraceListener redirected?
To the Console or a text file depending on the parameter passed to the constructor.
144. What namespaces are necessary to create a localized application?
System.Globalization, System.Resources.
145. What are three test cases you should go through in unit testing?
Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly).
146. Can you change the value of a variable while debugging a C# application?
Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.
147. What's the implicit name of the parameter that gets passed into the class' set method?
Value, and it's datatype depends on whatever variable we're changing.
148. How do you inherit from a class in C#?
Place a colon and then the name of the base class. Notice that it's double colon in C++.
149. Does C# support multiple inheritance?
No, use interfaces instead.
150. When you inherit a protected class-level variable, who is it available to?
Derived Classes.
151. What's the top .NET class that everything is derived from?
System.Object.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment