Delegates And Events In C Sharp - Study Mode
[#51] What is the main advantage of using events over direct method calls in C#?
Correct Answer
(A) Encapsulation and decoupling
[#52] Which delegate type is used to represent methods that take no parameters and return a value in C#?
Correct Answer
(D) Func
[#53] What does the += operator do when used with events in C#?
Correct Answer
(C) Adds an event handler to the event
[#54] What does the following C# code set defines? public Gen(T o)
{
ob = o
}
Correct Answer
(C) Generic constructor declaration
[#55] What will be the output of the following C# code snippet? {
delegate void A(ref string str)
class sample
{
public static void fun( ref string a)
{
a = a.Substring( 7, a.Length - 7)
}
}
class Program
{
static void Main(string[] args)
{
A str1
string str = "Test Your C#.net skills"
str1 = sample.fun
str1(ref str)
Console.WriteLine(str)
}
}
}
Correct Answer
(C) ur C#.NET Skills