{"id":48203,"date":"2018-02-02T08:52:38","date_gmt":"2018-02-02T03:22:38","guid":{"rendered":"http:\/\/blog.odango.com\/?p=48203"},"modified":"2023-02-03T18:00:49","modified_gmt":"2023-02-03T12:30:49","slug":"c-sharp-interview-questions","status":"publish","type":"post","link":"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/","title":{"rendered":"C# Interview Questions and Answers"},"content":{"rendered":"\n[et_pb_section bb_built=&#8221;1&#8243; next_background_color=&#8221;#000000&#8243;][et_pb_row][et_pb_column type=&#8221;4_4&#8243;][et_pb_post_title _builder_version=&#8221;3.0.106&#8243; title=&#8221;on&#8221; meta=&#8221;off&#8221; author=&#8221;on&#8221; date=&#8221;on&#8221; categories=&#8221;on&#8221; comments=&#8221;on&#8221; featured_image=&#8221;off&#8221; featured_placement=&#8221;below&#8221; text_color=&#8221;dark&#8221; text_background=&#8221;off&#8221; title_font=&#8221;Titillium Web||||||||&#8221; title_font_size=&#8221;47&#8243; title_font_size_tablet=&#8221;40&#8243; title_font_size_phone=&#8221;35&#8243; title_font_size_last_edited=&#8221;on|desktop&#8221; title_text_color=&#8221;rgba(0,0,0,0.8)&#8221; title_text_align=&#8221;left&#8221; text_shadow_horizontal_length=&#8221;0.08em&#8221; text_shadow_vertical_length=&#8221;0.08em&#8221; text_shadow_blur_strength=&#8221;0.08em&#8221; title_text_shadow_horizontal_length=&#8221;0.08em&#8221; title_text_shadow_vertical_length=&#8221;0.08em&#8221; custom_margin=&#8221;|||10%&#8221; \/][\/et_pb_column][\/et_pb_row][et_pb_row][et_pb_column type=&#8221;4_4&#8243;][et_pb_text _builder_version=&#8221;3.0.106&#8243; background_layout=&#8221;light&#8221; text_font=&#8221;Titillium Web|300|||||||&#8221; text_font_size=&#8221;20&#8243; text_font_size_last_edited=&#8221;on|phone&#8221; text_text_color=&#8221;rgba(0,0,0,0.8)&#8221; text_line_height=&#8221;1.6em&#8221; max_width=&#8221;800px&#8221; custom_margin=&#8221;|||10%&#8221; text_line_height_last_edited=&#8221;off|phone&#8221; max_width_last_edited=&#8221;off|phone&#8221; custom_margin_last_edited=&#8221;off|desktop&#8221;]\r\n\r\n<strong>1) What\u2019s the implicit name of the parameter that gets passed into the class\u2019 set method?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0Value, and its datatype depends on whatever variable we\u2019re changing.\r\n\r\n<hr \/>\r\n\r\n<strong>2) How do you inherit from a class in C#?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0Place a colon and then the name of the base class. Notice that it\u2019s double colon in C++.\r\n\r\n<hr \/>\r\n\r\n<strong>3) Does C# support multiple inheritance?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0No, use interfaces instead.\r\n\r\n<hr \/>\r\n\r\n<strong>4) When you inherit a protected class-level variable, who is it available to?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>Classes in the same namespace.\r\n\r\n<hr \/>\r\n\r\n<strong>5) Are private class-level variables inherited?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited. But they are.\r\n\r\n<hr \/>\r\n\r\n<strong>6) Describe the accessibility modifier protected internal.<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0It\u2019s available to derived classes and classes within the same Assembly (and naturally from the base class it\u2019s declared in).\r\n\r\n<hr \/>\r\n\r\n<strong>7) C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there\u2019s no implementation in it.\r\n\r\n<hr \/>\r\n\r\n<strong>8) What\u2019s the top .NET class that everything is derived from?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>System.Object.\r\n\r\n<hr \/>\r\n\r\n<strong>9) How\u2019s method overriding different from overloading?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class.\r\n\r\n<hr \/>\r\n\r\n<strong>10) What does the keyword virtual mean in the method definition?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>The method can be over-ridden.\r\n\r\n<hr \/>\r\n\r\n<strong>11) Can you declare the override method static while the original method is non-static?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>No, you can\u2019t, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.\r\n\r\n<hr \/>\r\n\r\n<strong>12) Can you override private virtual methods?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access.\r\n\r\n<hr \/>\r\n\r\n<strong>13) Can you prevent your class from being inherited and becoming a base class for some other classes?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>Yes, that\u2019s what keyword sealed in the class definition is for. The developer trying to derive from your class will get a message: cannot inherit from Sealed class WhateverBaseClassName. It\u2019s the same concept as final class in Java.\r\n\r\n<hr \/>\r\n\r\n<strong>14) Can you allow class to be inherited, but prevent the method from being over-ridden?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>Yes, just leave the class public and make the method sealed.\r\n\r\n<hr \/>\r\n\r\n<strong>15) What\u2019s an abstract class?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>A class that cannot be instantiated. A concept in C++ known as pure virtual method. A class that must be inherited and have the methods over-ridden. Essentially, it\u2019s a blueprint for a class without any implementation\r\n\r\n<hr \/>\r\n\r\n<strong>16) When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram)?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0When at least one of the methods in the class is abstract. When the class itself is inherited from an abstract class, but not all base abstract methods have been over-ridden.\r\n\r\n<hr \/>\r\n\r\n<strong>17) What\u2019s an interface class?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>It\u2019s an abstract class with public abstract methods all of which must be implemented in the inherited classes.\r\n\r\n<hr \/>\r\n\r\n<strong>18) Why can\u2019t you specify the accessibility modifier for methods inside the interface?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it\u2019s public by default.\r\n\r\n<hr \/>\r\n\r\n<strong>19) Can you inherit multiple interfaces?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>Yes, why not.\r\n\r\n<hr \/>\r\n\r\n<strong>20) And if they have conflicting method names?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0It\u2019s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you\u2019re okay.\r\n\r\n<hr \/>\r\n\r\n<strong>21) What\u2019s the difference between an interface and abstract class?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0In the interface all methods must be abstract; in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classes.\r\n\r\n<hr \/>\r\n\r\n<strong>22) How can you overload a method?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0Different parameter data types, different number of parameters, different order of parameters.\r\n\r\n<hr \/>\r\n\r\n<strong>23) If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.\r\n\r\n<hr \/>\r\n\r\n<strong>24) What\u2019s the difference between System.String and System.StringBuilder classes?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>System.String is immutable; System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.\r\n\r\n<hr \/>\r\n\r\n<strong>25) What\u2019s the advantage of using System.Text.StringBuilder over System.String?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it\u2019s being operated on, a new instance is created.\r\n\r\n<hr \/>\r\n\r\n<strong>26) Can you store multiple data types in System.Array?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>No.\r\n\r\n<hr \/>\r\n\r\n<strong>27) What\u2019s the difference between the System.Array.CopyTo() and System.Array.Clone()?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0The first one performs a deep copy of the array, the second one is shallow.\r\n\r\n<hr \/>\r\n\r\n<strong>28) How can you sort the elements of the array in descending order?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0By calling Sort() and then Reverse() methods.\r\n\r\n<hr \/>\r\n\r\n<strong>29) What\u2019s the .NET datatype that allows the retrieval of data by a unique key?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0HashTable.\r\n\r\n<hr \/>\r\n\r\n<strong>30) What\u2019s class SortedList underneath?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>A sorted HashTable.\r\n\r\n<hr \/>\r\n\r\n<strong>31) Will finally block get executed if the exception had not occurred?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0Yes.\r\n\r\n<hr \/>\r\n\r\n<strong>32) What\u2019s the C# equivalent of C++ catch (\u2026), which was a catch-all statement for any possible exception?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.\r\n\r\n<hr \/>\r\n\r\n<strong>33) Can multiple catch blocks be executed?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0No, 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.\r\n\r\n<hr \/>\r\n\r\n<strong>34) Why is it a bad idea to throw your own exceptions?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0Well, 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.\r\n\r\n<hr \/>\r\n\r\n<strong>35) What\u2019s a delegate?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.\r\n\r\n<hr \/>\r\n\r\n<strong>36) What\u2019s a multicast delegate?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0It\u2019s a delegate that points to and eventually fires off several methods.\r\n\r\n<hr \/>\r\n\r\n<strong>37) How\u2019s the DLL Hell problem solved in .NET?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0Assembly 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.\r\n\r\n<hr \/>\r\n\r\n<strong>38) What are the ways to deploy an assembly?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0An MSI installer, a CAB archive, and XCOPY command.\r\n\r\n<hr \/>\r\n\r\n<strong>39) What\u2019s a satellite assembly?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0When 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.\r\n\r\n<hr \/>\r\n\r\n<strong>40) What namespaces are necessary to create a localized application?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>System.Globalization, System.Resources.\r\n\r\n<hr \/>\r\n\r\n<strong>41) What\u2019s the difference between \/\/ comments, \/* *\/ comments and \/\/\/ comments?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0Single-line, multi-line and XML documentation comments.\r\n\r\n<hr \/>\r\n\r\n<strong>42) How do you generate documentation from the C# file commented properly with a command-line compiler?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>Compile it with a \/doc switch.\r\n\r\n<hr \/>\r\n\r\n<strong>43) What\u2019s the difference between and\u00a0<code>X<\/code>ML documentation tag?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>Single line code example and multiple-line code example.\r\n\r\n<hr \/>\r\n\r\n<strong>44) Is XML case-sensitive?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0Yes, so and are different elements.\r\n\r\n<hr \/>\r\n\r\n<strong>45) What debugging tools come with the .NET SDK?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0CorDBG \u2013 command-line debugger, and DbgCLR \u2013 graphic debugger. Visual Studio .NET uses the DbgCLR. To use CorDbg, you must compile the original C# file using the \/debug switch.\r\n\r\n<hr \/>\r\n\r\n<strong>46) What does the This window show in the debugger?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0It points to the object that\u2019s pointed to by this reference. Object\u2019s instance data is shown.\r\n\r\n<hr \/>\r\n\r\n<strong>47) What does assert() do?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0In 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.\r\n\r\n<hr \/>\r\n\r\n<strong>48) What\u2019s the difference between the Debug class and Trace class?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.\r\n\r\n<hr \/>\r\n\r\n<strong>49) Why are there five tracing levels in System.Diagnostics.TraceSwitcher?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0The 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.\r\n\r\n<hr \/>\r\n\r\n<strong>50) Where is the output of TextWriterTraceListener redirected?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>To the Console or a text file depending on the parameter passed to the constructor.\r\n\r\n<hr \/>\r\n\r\n<strong>51) How do you debug an ASP.NET Web application?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0Attach the aspnet_wp.exe process to the DbgClr debugger.\r\n\r\n<hr \/>\r\n\r\n<strong>52) What are three test cases you should go through in unit testing?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>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).\r\n\r\n<hr \/>\r\n\r\n<strong>53) Can you change the value of a variable while debugging a C# application?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.\r\n\r\n<hr \/>\r\n\r\n<strong>54) Explain the three services model (three-tier application).<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>Presentation (UI), business (logic and underlying code) and data (from storage or other sources).\r\n\r\n<hr \/>\r\n\r\n<strong>55) What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it\u2019s a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.\r\n\r\n<hr \/>\r\n\r\n<strong>56) What\u2019s the role of the DataReader class in ADO.NET connections?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0It returns a read-only dataset from the data source when the command is executed.\r\n\r\n<hr \/>\r\n\r\n<strong>57) What is the wildcard character in SQL?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>Let\u2019s say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve \u2018La%\u2019.\r\n\r\n<hr \/>\r\n\r\n<strong>58) Explain ACID rule of thumb for transactions.<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>Transaction must be Atomic (it is one unit of work and does not dependent on previous and following transactions), Consistent (data is either committed or roll back, no \u201cin-between\u201d case where something has been updated and something hasn\u2019t), Isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the data had been committed even if the system crashes right after).\r\n\r\n<hr \/>\r\n\r\n<strong>59) What connections does Microsoft SQL Server support?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and passwords).\r\n\r\n<hr \/>\r\n\r\n<strong>60) Which one is trusted and which one is untrusted?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0Windows 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.\r\n\r\n<hr \/>\r\n\r\n<strong>61) Why would you use untrusted verificaion?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>Web Services might use it, as well as non-Windows applications.\r\n\r\n<hr \/>\r\n\r\n<strong>62) What does the parameter Initial Catalog define inside Connection String?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>The database name to connect to.\r\n\r\n<hr \/>\r\n\r\n<strong>63) What\u2019s the data provider name to connect to Access database?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>Microsoft.Access.\r\n\r\n<hr \/>\r\n\r\n<strong>64) What does Dispose method do with the connection object?<\/strong>\r\n\r\n<strong>Ans:\u00a0<\/strong>Deletes it from the memory.\r\n\r\n<hr \/>\r\n\r\n<strong>65) What is a pre-requisite for connection pooling?<\/strong>\r\n\r\n<strong>Ans:<\/strong>\u00a0Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings.\r\n\r\n<hr \/>\r\n\r\n<strong>66)\u00a0What is\u00a0 the C# syntax to catch any possible exception?\r\nAns:\u00a0<\/strong>\u00a0A catch block is that the catches the exception of type System .Exception. You can also omit the parameter data type in this case and just write catch {}.\r\n\r\n<hr \/>\r\n\r\n<strong>\u00a067) What is the difference between System.String and System.Text.StringBuilder classes?\r\nAns:\u00a0<\/strong>System.String is a immutable. System.StringBuilder was designed with the purpose of having a mutable the string where as a variety of operations can be performed.\r\n\r\n<hr \/>\r\n\r\n<strong>68)\u00a0 What\u2019s the syntax to inherit from a class in C#?\r\nAns:<\/strong>\u00a0A Place is\u00a0 a colon and then the name of the base class.\r\nExample: class MyNewClass : MyBaseClass\r\n\r\n<hr \/>\r\n\r\n<strong>69)\u00a0 When do you correctly have to declare a class as abstract?\r\nAns:<\/strong>\u00a0When the class itself is the inherited from an abstract class, but not all base abstract\u00a0\u00a0 methods have been overridden.\r\nWhen at least one of the methods in the class is abstract class.\r\n\r\n<hr \/>\r\n\r\n<strong>70)\u00a0 What\u2019s the difference between a Struct and a Class?\r\nAns:\u00a0<\/strong>Structs are the value-type variables and are thus saved on the stack, additional overhead but faster retrieval.\u00a0 Another difference is struct can not inherit.\r\n\r\n<hr \/>\r\n\r\n<strong>71) What are the different ways of method can be overloaded?\r\nAns:<\/strong>\u00a0There are three types of ways can be overloaded,\r\nDifferent\u00a0 parameter data types,\r\nDifferent number of parameters,\r\nDifferent order of parameters.\r\n\r\n<hr \/>\r\n\r\n<strong>72)\u00a0 Which is\u00a0 the following is used to denote comments in C#?\r\nAns:<\/strong>\u00a0All are correct, all are supported forms of commenting. It is\u00a0 just that \/\/\/ is specifically for functionality in XML documentation.\r\n\r\n<hr \/>\r\n\r\n<strong>73) What is true about readonly variable in C# code?\r\nAns:<\/strong>\u00a0 B is the right choice. Since readonly field can only be initialized at the time of\r\nconstruction of the object. Read only means if you want to\u00a0 initialize the readonly property that intialize it inside the constructor.\r\n\r\n<hr \/>\r\n\r\n<strong>74) What\u2019s an interface class?\r\nAns:\u00a0<\/strong>\u00a0It is an abstract class with the public abstract methods all of which is must be implemented in the inherited classes.\r\n\r\n<hr \/>\r\n\r\n<strong>75)\u00a0 What is\u00a0 a delegate?\r\nAns:<\/strong>\u00a0 A delegate is a\u00a0 object encapsulates a reference to a method. In C++ they were referred to as function pointers.\r\n\r\n<hr \/>\r\n\r\n<strong>76)\u00a0 What is a multicast delegate?\r\nAns:<\/strong>\u00a0Multicast delegate\u00a0 is\u00a0 that points to and eventually fires off several methods.\r\n\r\n<hr \/>\r\n\r\n<strong>77) What is\u00a0 the difference between the Trace class\u00a0 and\u00a0 Debug class?\r\nAns:<\/strong>\u00a0Documentation looks the same. Use Debug class for debug builds, use the Trace class for both debug and release builds.\r\n\r\n<hr \/>\r\n\r\n<strong>78)\u00a0 What is Inheritance?\r\nAns:\u00a0<\/strong>Inheritance\u00a0 is a process of acquiring attributes and behaviors from the another object (normally a class or interface). Gives you ability to provide is-a relationship. Acquires attributes and behaviors from another. When a class acquires attributes and behaviors from another class.\r\n\r\n<hr \/>\r\n\r\n<strong>79)\u00a0 What is a Destructor?\r\nAns:\u00a0<\/strong>A destructor is a deallocating the memory.\r\n\r\n<hr \/>\r\n\r\n<strong>80) How a base class method is hidden?\r\nAns:<\/strong>\u00a0Hiding a base class method by declaring a method in the derived class with keyword new. This will override the base class method and old method will be suppressed.)\r\n\r\n[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section][et_pb_section bb_built=&#8221;1&#8243; prev_background_color=&#8221;#000000&#8243;][et_pb_row][et_pb_column type=&#8221;4_4&#8243;][et_pb_team_member _builder_version=&#8221;3.0.106&#8243; name=&#8221;Arun Gandham&#8221; position=&#8221;Author&#8221; facebook_url=&#8221;&#8221; twitter_url=&#8221;&#8221; google_url=&#8221;&#8221; linkedin_url=&#8221;&#8221; image_url=&#8221;https:\/\/asha24.net\/blog\/\/wp-content\/uploads\/2018\/03\/123456.gif&#8221; background_layout=&#8221;light&#8221; header_font=&#8221;Titillium Web|700|||||||&#8221; body_font=&#8221;Titillium Web||||||||&#8221; body_font_size=&#8221;16&#8243;]\r\n\r\nHola peeps! A fitness freak, a lover of games, I catch a flick on the weekends and write for you about current trends.\r\n\r\n[\/et_pb_team_member][\/et_pb_column][\/et_pb_row][\/et_pb_section]\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":4,"featured_media":48204,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[57],"tags":[58],"class_list":["post-48203","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-interview-questions","tag-interview-questions"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v17.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C# Interview Questions and Answers - Asha24 Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C# Interview Questions and Answers - Asha24 Blog\" \/>\n<meta property=\"og:url\" content=\"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/\" \/>\n<meta property=\"og:site_name\" content=\"Asha24 Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-02T03:22:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-03T12:30:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/asha24.net\/blog\/wp-content\/uploads\/2018\/03\/c-interview-questions-and-answers2.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"688\" \/>\n\t<meta property=\"og:image:height\" content=\"459\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mahesh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/asha24.net\/blog\/#website\",\"url\":\"https:\/\/asha24.net\/blog\/\",\"name\":\"Asha24 Blog\",\"description\":\"Dedication Towards Learning\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/asha24.net\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/asha24.net\/blog\/wp-content\/uploads\/2018\/03\/c-interview-questions-and-answers2.jpg\",\"contentUrl\":\"https:\/\/asha24.net\/blog\/wp-content\/uploads\/2018\/03\/c-interview-questions-and-answers2.jpg\",\"width\":688,\"height\":459},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/#webpage\",\"url\":\"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/\",\"name\":\"C# Interview Questions and Answers - Asha24 Blog\",\"isPartOf\":{\"@id\":\"https:\/\/asha24.net\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/#primaryimage\"},\"datePublished\":\"2018-02-02T03:22:38+00:00\",\"dateModified\":\"2023-02-03T12:30:49+00:00\",\"author\":{\"@id\":\"https:\/\/asha24.net\/blog\/#\/schema\/person\/f6167b78bbaddfc399ae1154cd5b6759\"},\"breadcrumb\":{\"@id\":\"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/asha24.net\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C# Interview Questions and Answers\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/asha24.net\/blog\/#\/schema\/person\/f6167b78bbaddfc399ae1154cd5b6759\",\"name\":\"Mahesh\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/asha24.net\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/085c03e75ffb51af2509c1cfad9c7d78b30236d43a008db2e46f96e2f40c67fc?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/085c03e75ffb51af2509c1cfad9c7d78b30236d43a008db2e46f96e2f40c67fc?s=96&d=wavatar&r=g\",\"caption\":\"Mahesh\"},\"url\":\"https:\/\/asha24.net\/blog\/author\/mahesh\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C# Interview Questions and Answers - Asha24 Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/","og_locale":"en_US","og_type":"article","og_title":"C# Interview Questions and Answers - Asha24 Blog","og_url":"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/","og_site_name":"Asha24 Blog","article_published_time":"2018-02-02T03:22:38+00:00","article_modified_time":"2023-02-03T12:30:49+00:00","og_image":[{"width":688,"height":459,"url":"https:\/\/asha24.net\/blog\/wp-content\/uploads\/2018\/03\/c-interview-questions-and-answers2.jpg","path":"\/home\/reviews981\/public_html\/asha24.net\/blog\/wp-content\/uploads\/2018\/03\/c-interview-questions-and-answers2.jpg","size":"full","id":48204,"alt":"","pixels":315792,"type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Written by":"Mahesh","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/asha24.net\/blog\/#website","url":"https:\/\/asha24.net\/blog\/","name":"Asha24 Blog","description":"Dedication Towards Learning","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/asha24.net\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/#primaryimage","inLanguage":"en-US","url":"https:\/\/asha24.net\/blog\/wp-content\/uploads\/2018\/03\/c-interview-questions-and-answers2.jpg","contentUrl":"https:\/\/asha24.net\/blog\/wp-content\/uploads\/2018\/03\/c-interview-questions-and-answers2.jpg","width":688,"height":459},{"@type":"WebPage","@id":"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/#webpage","url":"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/","name":"C# Interview Questions and Answers - Asha24 Blog","isPartOf":{"@id":"https:\/\/asha24.net\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/#primaryimage"},"datePublished":"2018-02-02T03:22:38+00:00","dateModified":"2023-02-03T12:30:49+00:00","author":{"@id":"https:\/\/asha24.net\/blog\/#\/schema\/person\/f6167b78bbaddfc399ae1154cd5b6759"},"breadcrumb":{"@id":"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/asha24.net\/blog\/c-sharp-interview-questions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/asha24.net\/blog\/"},{"@type":"ListItem","position":2,"name":"C# Interview Questions and Answers"}]},{"@type":"Person","@id":"https:\/\/asha24.net\/blog\/#\/schema\/person\/f6167b78bbaddfc399ae1154cd5b6759","name":"Mahesh","image":{"@type":"ImageObject","@id":"https:\/\/asha24.net\/blog\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/085c03e75ffb51af2509c1cfad9c7d78b30236d43a008db2e46f96e2f40c67fc?s=96&d=wavatar&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/085c03e75ffb51af2509c1cfad9c7d78b30236d43a008db2e46f96e2f40c67fc?s=96&d=wavatar&r=g","caption":"Mahesh"},"url":"https:\/\/asha24.net\/blog\/author\/mahesh\/"}]}},"_links":{"self":[{"href":"https:\/\/asha24.net\/blog\/wp-json\/wp\/v2\/posts\/48203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/asha24.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/asha24.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/asha24.net\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/asha24.net\/blog\/wp-json\/wp\/v2\/comments?post=48203"}],"version-history":[{"count":4,"href":"https:\/\/asha24.net\/blog\/wp-json\/wp\/v2\/posts\/48203\/revisions"}],"predecessor-version":[{"id":52169,"href":"https:\/\/asha24.net\/blog\/wp-json\/wp\/v2\/posts\/48203\/revisions\/52169"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/asha24.net\/blog\/wp-json\/wp\/v2\/media\/48204"}],"wp:attachment":[{"href":"https:\/\/asha24.net\/blog\/wp-json\/wp\/v2\/media?parent=48203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/asha24.net\/blog\/wp-json\/wp\/v2\/categories?post=48203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/asha24.net\/blog\/wp-json\/wp\/v2\/tags?post=48203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}