Friday, 18 September 2015

Most recent asked C#.Net Interview Questions and Answers

61. What is the top .NET class that everything is derived from? 

62. Can you allow class to be inherited, but prevent the method from being over-ridden? 
Yes, just leave the class public and make the method sealed

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

64. Are private class-level variables inherited? 
Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited. But they are.

65. Can you inherit multiple interfaces? 
Yes. .NET does support multiple interfaces.

66. From a versioning perspective, what are the drawbacks of extending an interface as opposed to extending a class?
With regard to versioning, interfaces are less flexible than classes. With a class, you can ship version 1 and then, in version 2, decide to add another method. As long as the method is not abstract (i.e., as long as you provide a default implementation of the method), any existing derived classes continue to function with no changes. Because interfaces do not support implementation inheritance, this same pattern does not hold for interfaces. Adding a method to an interface is like adding an abstract method to a base class--any class that implements the interface will break, because the class doesn't implement the new interface method.

67. Which one is trusted and which one is untrusted? 
Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction

68. What namespaces are necessary to create a localized application? 
System.Globalization, System.Resources.

69. Does Console.WriteLine() stop printing when it reaches a NULL character within a string? 
Strings are not null terminated in the runtime, so embedded nulls are allowed. Console.WriteLine() and all similar methods continue until the end of the string.

70. What is 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 is being operated on, a new instance is created.

More Questions & Answers:-

No comments:

Post a Comment