• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

CSharp Interview Questions Answers

Question - 1 : - What’s the .NET datatype that allows the retrieval of data by a unique key?

Answer - 1 : - Normal 0 false false false MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} HashTable.

Question - 2 : -   How can you sort the elements of the array in descending order?

Answer - 2 : -   By calling Sort() and then Reverse() methods. 

Question - 3 : - How would you implement inheritance using VB.NET/C#?

Answer - 3 : - When we set out to implement a class using inheritance, we must first start with an existing class from which we will derive our new subclass. This existing class, or base class, may be part of the .NET system class library framework, it may be part of some other application or .NET assembly, or we may create it as part of our existing application. Once we have a base class, we can then implement one or more subclasses based on that base class. Each of our subclasses will automatically have all of the methods, properties, and events of that base class ? including the implementation behind each method, property, and event. Our subclass can add new methods, properties, and events of its own - extending the original interface with new functionality. Additionally, a subclass can replace the methods and properties of the base class with its own new implementation - effectively overriding the original behavior and replacing it with new behaviors. Essentially inheritance is a way of merging functionality from an existing class into our new subclass. Inheritance also defines rules for how these methods, properties, and events can be merged. In VB.NET we can use implements keyword for inheritance, while in C# we can use the sign ( :: ) between subclass and baseclass

Question - 4 : -   What does the term immutable mean?

Answer - 4 : - The data value may not be changed.  Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.

Question - 5 : - Can multiple catch blocks be executed?

Answer - 5 : -   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.

Question - 6 : -   Can multiple catch blocks be executed for a single try statement?

Answer - 6 : -   No.  Once the proper catch block processed, control is transferred to the finally block (if there are any). 

Question - 7 : -   What’s the .NET collection class that allows an element to be accessed using a unique key?

Answer - 7 : - HashTable.

Question - 8 : -  Can you store multiple data types in System.Array?

Answer - 8 : - No

Question - 9 : -   Explain the three services model commonly know as a three-tier application.

Answer - 9 : - Presentation (UI), Business (logic and underlying code) and Data (from storage or other sources). 

Question - 10 : - What's the C# equivalent of C++ catch (…), which was a catch-all statement for any possible exception?

Answer - 10 : -   A 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 {}.

Computer Contributors

Rajeev Katiyar
Yes Baroda

Share your email for latest updates


Our partners