C# Multiple Choice Questions – Delegates

This section of our 1000+ C# MCQs focuses in detail on delegates in C# Programming Language.

1. The ‘ref’ keyword can be used with which among the following?
a) Static function/subroutine
b) Static data
c) Instance function/subroutine
d) All of the mentioned
View Answer

Answer: a
Explanation: None.

2. To implement delegates, the necessary condition is?
a) class declaration
b) inheritance
c) runtime polymorphism
d) exceptions
View Answer

Answer: a
Explanation: None.

3. Suppose a Generic class called as SortObjects is to be made capable of sorting objects of any type(integer, single, byte etc). Then, which of the following programming constructs is able to implement the comparison function?
a) interface
b) encapsulation
c) delegate
d) attribute
View Answer

Answer: c
Explanation: None.
advertisement
advertisement

4. To generate a simple notification for an object in runtime, the programming construct to be used for implementing this idea?
a) namespace
b) interface
c) delegate
d) attribute
View Answer

Answer: c
Explanation: None.

5. Choose the incorrect statement among the following about the delegate?
a) delegates are of reference types
b) delegates are object oriented
c) delegates are type safe
d) none of the mentioned
View Answer

Answer: d
Explanation: None.

6. Which among the following is the correct statement about delegate declaration?

delegate void del(int i);

a) on declaring the delegate, a class called del is created
b) the del class is derived from the MulticastDelegate class
c) the del class will contain a one argument constructor and an invoke() method
d) all of the mentioned
View Answer

Answer: d
Explanation: None.
advertisement

7. Which of the following is an incorrect statement about delegate?
a) a single delegate can invoke more than one method
b) delegates could be shared
c) delegates are type safe wrappers for function pointers
d) delegate is a value type
View Answer

Answer: d
Explanation: In C#, a delegate is a reference type instead of a value type as it stores a reference to a data/method.

8. Which among the following differentiates a delegate in C#.NET from a conventional function pointer in other languages?
a) delegates in C#.NET represent a new type in the Common Type System
b) delegates allows static as well as instance methods to be invoked
c) delegates are type safe and secure
d) none of the mentioned
View Answer

Answer: d
Explanation: None.
advertisement

9. Choose the incorrect statement about delegates?
a) delegates are not type safe
b) delegates can be used to implement callback notification
c) delegate is a user defined type
d) delegates permits execution of a method in an asynchronous manner
View Answer

Answer: a
Explanation: None.

10. Which of the following statements is correct about a delegate?
a) inheritance is a prerequisite for using delegates
b) delegates are not type safe
c) delegates provides wrappers for function pointers
d) none of the mentioned
View Answer

Answer: c
Explanation: None.

More MCQs on Delegates in C#:

Sanfoundry Global Education & Learning Series – C# Programming Language.

To practice all areas of C# language, here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.