1. Question:What is the CLR? 

    Answer
    The .NET Framework provides a run-time environment called the common language run-time, which runs the code and provides services that make the development process easier.

    1. Report
  2. Question:What are value and reference types? 

    Answer
    Value type: The content of a value type variable or constant is simply a value. For example, the content of the built-in value type, int, is 32 bits of data. Its contents in memory is allocated on the stack. We can define a custom value type with the 'struct' keyword.
    public struct Point { public int X, Y; }
    Reference type: A reference type has two parts: an object and the reference to that object. The content of a reference-type variable or constant is a reference to an object that contains the value. A reference type, such as an instance of a class or an array, is allocated in a different area of memory called the heap. We use 'class' keyword to define it.
    public class Point { public int X, Y; }

    1. Report
  3. Question:Define Method Overloading? ` 

    Answer
    Method overload defines use different type of parameters with  same method name or different set of parameters is known as Method Overloading.
    void Foo (int x);
    void Foo (double x);
    void Foo (int x, float y);

    1. Report
  4. Question:Define Abstract classes and Abstract members. 

    Answer
    Abstract Class: An abstract class is to provide a common definition of a base class that multiple derived classes can share. It cannot be instantiated.Abstract Member : Abstract classes are able to define abstract members. Abstract members are like virtual  members,  except  they  don’t  provide  a  default  implementation

    1. Report
  5. Question:Define Enums? 

    Answer
    An enum (also named an enumeration)  is  a special value type that lets you specify a group of named numeric constants. 
    Example:
    public enum BorderSide { Left, Right, Top, Bottom }

    1. Report
  6. Question:Define dynamic, static, custom and language binding? 

    Answer
    Dynamic binding :Dynamic  binding defers  binding—the  process  of  resolving  types,  members,  and
    operations—from  compile  time  to  run-time.Static binding : It is defined as, when we compile our program and an object type is determined then it is known as static binding or early binding.Custom binding : Defines a binding from a list of binding elements.Language binding : Language  binding  occurs  when  a  dynamic  object  does  not  implement
    IDynamicMetaObjectProvider

    1. Report
  7. Question:Write difference between classes and structs in C#. 

    Answer
    1. Classes are Reference types and Structures are Values types. 
    2. Classes can have explicitly parameterless constructors whereas structures can’t.
    3. A variable can be null if it’s a class, but is never null if it’s a struct.
    4. Member variable initialization is possible in class whereas in Structures, it is not.

    1. Report
  8. Question:What is Lamda expressions. 

    Answer
    A lambda expression is an unnamed method written in place of a delegate instance.
    The compiler immediately converts the lambda expression to either:
    • A delegate instance.
    • An expression tree, of type  Expression<TDelegate>

    1. Report
  9. Question:Define Generics and Type Parameters? 

    Answer
    Generics type Parameter
    In a generic type or method definition, a type parameters is a placeholder for a specific type that a client specifies when they instantiate a variable of the generic type
    GenericList<float> list1 = new GenericList<float>();

    1. Report
Copyright © 2024. Powered by Intellect Software Ltd