Delegates

Q1:
Which of the following is the correct way to call subroutine MyFun() of the Sample class given below?
class Sample
{
    public void MyFun(int i, Single j)
    {
        Console.WriteLine('Welcome to AptitudeCrack !');
    }
}

A
delegate void del(int i);
Sample s = new Sample();
del d = new del(ref s.MyFun);
d(10, 1.1f);

B
delegate void del(int i, Single j);
del d;
Sample s = new Sample();
d = new del(ref s.MyFun);
d(10, 1.1f);

C
Sample s = new Sample();
delegate void d = new del(ref MyFun);
d(10, 1.1f);

D
delegate void del(int i, Single]);
Sample s = new Sample();
del = new delegate(ref MyFun);
del(10, 1.1f);

ANS:A -

delegate void del(int i);
Sample s = new Sample();
del d = new del(ref s.MyFun);
d(10, 1.1f);

No answer description is available. Let's discuss.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.