1. Question:what is optional parameters and named arguments? 

    Answer
    Parameters are optional when a default value is specified as part of a declaration.
    Example: public List<Product> GetProductByCategory(string category, int pageIndex=0){}
    Here pageIndex is an optional parameter.
    Named arguments allow us to explicitly name an argument we are passing to a method – instead of just identifying it by argument position. 
    Example: var products= GetProductByCategory(“beverages”, pageIndex=2){} here pageIndex is a named argument.






    1. Report
  2. Question:What is Upcasting and Downcasting. 

    Answer
    Upcasting: An upcast operation creates a base class reference from a subclass reference.
    Example:
    Stock msft = new Stock();
           Asset a = msft;
    Downcasting: A downcast operation creates a subclass reference from a base class reference. Example:
    Stock msft = new Stock();
           Asset a = msft;
           Stock s = (Stock)a;






    1. Report
  3. Question:Define Sealing function and classes. 

    Answer
    When an instance method declaration includes a sealed modifier, that method is said to be a sealed method. If an instance method declaration includes the sealed modifier, it must also include the override modifier. Use of the sealed modifier prevents a derived class from further overriding the method.






    1. Report
  4. 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
  5. Question:Define Boxing and Unboxing. 

    Answer
    Boxing:Boxing is the process of converting a value type to the object type or to any interface type implemented by this value type. When the CLR boxes a value type, it wraps the value inside a System.Object and stores it on the managed heap. Unboxing: Unboxing extracts the value type from the object. Boxing is implicit; unboxing is explicit. The concept of boxing and unboxing underlies the C# unified view of the type system in which a value of any type can be treated as an object.






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