logo

CuriousTab

CuriousTab

Delegates problems


  • 1. Suppose on pushing a button an object is to be notified, but it is not known until runtime which object should be notified. Which of the following programming constructs should be used to implement this idea?

  • Options
  • A. Attribute
  • B. Delegate
  • C. Namespace
  • D. Interface
  • E. Encapsulation
  • Discuss
  • 2. Which of the following statements are correct about delegates?

  • Options
  • A. Delegates cannot be used to call a static method of a class.
  • B. Delegates cannot be used to call procedures that receive variable number of arguments.
  • C. If signatures of two methods are same they can be called through the same delegate object.
  • D. Delegates cannot be used to call an instance function. Delegates cannot be used to call an instance subroutine.
  • Discuss
  • 3. Suppose a Generic class called SortObjects is to be made capable of sorting objects of any type (Integer, Single, Byte etc.). Which of the following programming constructs should be used to implement the comparision function?

  • Options
  • A. Namespace
  • B. Interface
  • C. Encapsulation
  • D. Delegate
  • E. Attribute
  • Discuss
  • 4. Which of the following statements is incorrect about a delegate?

  • Options
  • A. A single delegate can invoke more than one method.
  • B. Delegates can be shared.
  • C. Delegate is a value type.
  • D. Delegates are type-safe wrappers for function pointers.
  • E. The signature of a delegate must match the signature of the method that is to be called using it.
  • Discuss

First 2