1. 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
  2. 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
  3. Question:What is overloading constructor? 

    Answer
    Constructor overloading in C# is a type of Static Polymorphism. Using constructor overloading, any number of constructors can be defined for the same class. But ensure each constructor must have different number and type of parameters defined.






    1. Report
  4. Question:Static vs Non static members? 

    Answer
    Static Member :The static member is callable on a class even when no instance of the class has been created. The static member is always accessed by the class name, not the instance nameNon-static Member :






    1. Report
  5. Question:Briefly describe C# access modifiers. 

    Answer
    Access modifiers are keywords used to specify the declared accessibility of a member or a type. Access modifiers are an integral part of object-oriented programming.  There are 5 different types of Access Modifiers: 
    1. Public.
    2. Internal.
    3. Private.
    4. Protected.
    5. Protected internal.






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