Thursday, April 2, 2009

C# Interview Questions Part V

41. What’s the difference between // comments, /* */ comments and /// comments?

Ans. Single-line, multi-line and XML documentation comments.

42. How do you generate documentation from the C# file commented properly with a command-line compiler?

Ans. Compile it with a /doc switch.

43. What’s the difference between and XML documentation tag?

Ans. Single line code example and multiple-line code example.

44. Is XML case-sensitive?

Ans. Yes, so and are different elements.

45. What debugging tools come with the .NET SDK?

Ans. CorDBG – command-line debugger, and DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR. To use CorDbg, you must compile the original C# file using the /debug switch.

46. What does the This window show in the debugger?

Ans. It points to the object that’s pointed to by this reference. Object’s instance data is shown.

47. What does assert() do?

Ans. 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.

48. What’s the difference between the Debug class and Trace class?

Ans. Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.

49. Why are there five tracing levels in System.Diagnostics.TraceSwitcher?

Ans. 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.

50. Where is the output of TextWriterTraceListener redirected?

Ans. To the Console or a text file depending on the parameter passed to the constructor.

No comments: