logo

CuriousTab

CuriousTab

Discussion


Home C# Programming Delegates See What Others Are Saying!
  • Question
  • Which of the following statements are correct about a delegate?

    1. Inheritance is a prerequisite for using delegates.
    2. Delegates are type-safe.
    3. Delegates provide wrappers for function pointers.
    4. The declaration of a delegate must match the signature of the method that we intend to call using it.
    5. Functions called using delegates are always late-bound.


  • Options
  • A. 1 and 2 only
  • B. 1, 2 and 3 only
  • C. 2, 3 and 4 only
  • D. All of the above
  • E. None of the above

  • Correct Answer
  • 2, 3 and 4 only 


  • More questions

    • 1. Which of the following is the correct way to call the function MyFun() of the Sample class given below?

      class Sample
      {
          public int MyFun(int i)
          {
              Console.WriteLine("Welcome to CuriousTab.com !" );
              return 0;
          }
      }

    • Options
    • A.
      delegate void del(int i);
      Sample s = new Sample();
      deld = new del(ref s.MyFun);
      d(10);
    • B.
      delegate int del(int i);
      Sample s = new Sample(.);
      del = new delegate(ref MyFun);
      del(10);
    • C.
      Sample s = new Sample();
      delegate void del = new delegate(ref MyFun);
      del(10);
    • D.
      delegate int del(int i);
      del d;
      Sample s = new Sample();
      d = new del(ref s.MyFun);
      d(10);
    • Discuss
    • 2. Which of the following statements is correct about the C#.NET code snippet given below?

      interface IPerson
      { 
          String FirstName
          { 
              get; 
              set;
          }
          String LastName
          {
              get; 
              set;
          }
          void Print(); 
          void Stock(); 
          int Fun(); 
      }

    • Options
    • A. Properties cannot be declared inside an interface.
    • B. This is a perfectly workable interface.
    • C. The properties in the interface must have a body.
    • D. Subroutine in the interface must have a body.
    • E. Functions cannot be declared inside an interface.
    • Discuss
    • 3. Which of the following statements is correct about an interface used in C#.NET?

    • Options
    • A. If a class implements an interface partially, then it should be an abstract class.
    • B. A class cannot implement an interface partially.
    • C. An interface can contain static methods.
    • D. An interface can contain static data.
    • E. Multiple interface inheritance is not allowed.
    • Discuss
    • 4. Which of the following statements are correct about delegates?

      1. Delegates are not type-safe.
      2. Delegate is a user-defined type.
      3. Only one method can be bound with one delegate object.
      4. Delegates can be used to implement callback notification.
      5. Delegates permit execution of a method on a secondary thread in an asynchronous manner.

    • Options
    • A. 1 and 2 only
    • B. 1, 2 and 3 only
    • C. 2, 4 and 5 only
    • D. 4 and 5 only
    • E. All of the above
    • Discuss
    • 5. If a Student class has an indexed property which is used to store or retrieve values to/from an array of 5 integers, then which of the following are the correct ways to use this indexed property?

      1. Student[3] = 34;
      2. Student s = new Student(); 
        s[3] = 34;
      3. Student s = new Student(); 
        Console.WriteLine(s[3]);
      4. Console.WriteLine(Student[3]);
      5. Student.this s = new Student.this(); 
        s[3] = 34;

    • Options
    • A. 1, 2
    • B. 2, 3
    • C. 3, 4
    • D. 3, 5
    • Discuss
    • 6. Which of the following CANNOT belong to a C#.NET Namespace?

    • Options
    • A. class
    • B. struct
    • C. enum
    • D. Data
    • E. interface
    • Discuss
    • 7. A class implements two interfaces each containing three methods. The class contains no instance data. Which of the following correctly indicate the size of the object created from this class?

    • Options
    • A. 12 bytes
    • B. 24 bytes
    • C. 0 byte
    • D. 8 bytes
    • E. 16 bytes
    • Discuss
    • 8. Which of the following keyword is used to change the data and behavior of a base class by replacing a member of a base class with a new derived member?

    • Options
    • A. new
    • B. base
    • C. overloads
    • D. override
    • E. overridable
    • Discuss
    • 9. Which of the following statements are correct about an interface in C#.NET?

      1. A class can implement multiple interfaces.
      2. Structures cannot inherit a class but can implement an interface.
      3. In C#.NET, : is used to signify that a class member implements a specific interface.
      4. An interface can implement multiple classes.
      5. The static attribute can be used with a method that implements an interface declaration.

    • Options
    • A. 1, 2, 3
    • B. 2, 4
    • C. 3, 5
    • D. None of the above.
    • Discuss
    • 10. Which of the following should be used to implement a 'Like a' or a 'Kind of' relationship between two entities?

    • Options
    • A. Polymorphism
    • B. Containership
    • C. Templates
    • D. Encapsulation
    • E. Inheritance
    • Discuss


    Comments

    There are no comments.

Enter a new Comment