Welcome to the Delegates and Generics MCQs Page
Dive deep into the fascinating world of Delegates and Generics with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Delegates and Generics, a crucial aspect of C# Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Delegates and Generics, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C# Programming.
Check out the MCQs below to embark on an enriching journey through Delegates and Generics. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C# Programming.
Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Delegates and Generics. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!
Delegates and Generics MCQs | Page 1 of 7
Explore more Topics under C# Programming
1. Remoting
2. Serialization
3. File Input/Output
4. Multithreading
5. Event handling
delegate void del(int i);
1. On declaring the delegate a class called del will get created.
2. The signature of del need not be same as the signature of the method that we intend to call using it.
3. The del class will be derived from the MulticastDelegate class.
4. The method that can be called using del should not be a static method.
5. The del class will contain a one-argument constructor and an lnvoke() method.
class Sample
{
public int MyFun(int i)
{
Console.WriteLine("Welcome to CompSciBits.com !" );
return 0;
}
}
del d;
Sample s = new Sample();
d = new del(ref s.MyFun);
d(10);
class Sample
{
public void MyFun(int i, Single j)
{
Console.WriteLine("Welcome to CompSciBits !");
}
}
del d;
Sample s = new Sample();
d = new del(ref s.MyFun);
d(10, 1.1f);
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.
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.
class Sample
{
public int func(int i, Single j)
{
/* Add code here. */
}
}
Suggested Topics
Are you eager to expand your knowledge beyond C# Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!