Interview Tips Interview Tips, Interview Questions and Answers

2May/100

Explain the concepts of CTS and CLS(Common Language Specification).

CTS

When different languages are integrated and want to communicate, it is certain that the languages have their own data types and different declaration styles. CTS define how these different variables are declared and used in run time. E.g. VB offers an Integer data type while C++ offers long data type. Using CTS, these data types are converted to System32 which itself a data type of CLS.

CLS

Any language(s) that intend to use the Common Language Infrastructure needs to communicate with other CLS-Compliant language. This communication is based on set of rules laid by CLS. These rules define a subset of CTS.

6Jan/100

.Net Interview: Method and Property Questions

    1. What does the keyword “virtual” declare for a method or property?
      The method or property can be overridden.
    2. What’s the implicit name of the parameter that gets passed into the set method/property of a class?
      Value. The data type of the value parameter is defined by whatever data type the property is declared as.
    3. How is method overriding different from method overloading?
      When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class.
    4. What are the different ways a method can be overloaded?
      Different parameter data types, different number of parameters, different order of parameters.
    5. If a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?
      Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.
    6. Can you declare an override method to be static if the original method is not static?
      No. The signature of the virtual method must remain the same.  (Note: Only the keyword virtual is changed to keyword override)