C# .NET events & callbacks quiz

An event can be used to provide notifcations. You can subscribe to an event if you are interested in those notifcations. You can also create your own events and raise them to provide notifcations when something interesting happens

This quiz is in C# .NET quiz collection.

Start quiz
  • 1.

    Delegates are a type that defnes a method signature and can contain a reference to a method.

  • 2.

    Delegates can be instantiated, passed around, and invoked.

  • 3.

    Lambda expressions, also known as anonymous methods, use the = operator and form a compact way of creating inline methods.

  • 4.

    Events are a layer of syntactic sugar on top of delegates to easily implement the publish-subscribe pattern.

  • 5.

    Events can be raised only from the declaring class. Users of events can only remove and add methods the invocation list.

  • 6.

    You can customize events by adding a custom event accessor and by directly using the underlying delegate type.

  • 7.

    You have a private method in your class and you want to make invocation of the method possible by certain callers. What do you do?

  • 8.

    You have declared an event on your class, and you want outside users of your class to raise this event. What do you do?

  • 9.

    You are using a multicast delegate with multiple subscribers. You want to make sure that all subscribers are notifed, even if an exception is thrown. What do you do?

© 2017 QuizBucket.org