1. Choose the correct way to call subroutine fun() of the sample class?
a) delegate void del(int i);
x s = new x();
del d = new del(ref s.x);
d(8, 2.2f);
b) delegate void del(int p, double k);
del d;
x s = new x();
d = new del(ref s.x);
d(8, 2.2f);
c) x s = new x();
delegate void d = new del(ref x);
d(8, 2.2f);
d) all of the mentioned
2. Which is the correct way to call the function abc() of the given class csharp given below?
a) delegate void del(int a);
csharp s = new csharp();
del d = new del(ref s.abc);
d(10);
b) csharp s = new csharp();
delegate void d = new del(ref abc);
d(10);
c) delegate int del(int a);
del d;
csharp s = new csharp();
d = new del(ref s.fun);
d(10);
d) none of the mentioned
3. Which is the correct way to call the subroutine function abc() of the given class csharp given below?
a) csharp c = new csharp();
delegate void d = new del(ref abc);
d();
b) delegate void del();
del d;
csharp s = new csharp();
d = new del(ref s.abc);
d();
c) delegate void del();
abc s = new abc();
del d = new del(ref s.abc);
d();
d) csharp s = new csharp();
delegate void del = new delegate(ref abc);
del();
e) both b and c
4. What will be the output of the given code snippet below?
a) Test Your
b) ur C#.NET
c) ur C#.NET Skills
d) None of the mentioned
5. What will be the output of the given code snippet below?
a) Test Your
b) Test-Your-C#.NET-Skills
c) ur C#.NET Skills
d) None of the mentioned
6. Choose the statements which makes delegate in C#.NET different than a normal class?
a) Delegates in C#.NET is a base class for all delegates type
b) From Delegates created in C#.NET further not allowed to derive from the delegate types that are created
c) Only system and compilers can derive explicitly from the Delegate or MulticasteDelegate class
d) All of the mentioned
7. Which are the correct statement about delegates?
a) Delegates can be used to implement callback notification
b) Delegates permit execution of a method on a secondary thread in an asynchronous manner
c) Delegate is a user defined type
d) both a and b
e) None of the mentioned
8. What will be the output of given set of code?
a) Test Ykur C#.NET Skills
b) Test Ykour C#.NET Skills
c) Test Your C#.NET Skills
d) Test ur C#.NET Skills
9. Incorrect statement about delegates are?
a) Delegates are reference types
b) Delegates are object oriented
c) Delegates are type safe
d) Only one method can be called using a delegate
10. Select the modifiers which controls the accessibility of the delegate:
a) new
b) protected
c) public
d) internal
e) all of the above
class a
{
public void x(int p, double k)
{
Console.WriteLine("k : csharp!");
}
}
x s = new x();
del d = new del(ref s.x);
d(8, 2.2f);
b) delegate void del(int p, double k);
del d;
x s = new x();
d = new del(ref s.x);
d(8, 2.2f);
c) x s = new x();
delegate void d = new del(ref x);
d(8, 2.2f);
d) all of the mentioned
2. Which is the correct way to call the function abc() of the given class csharp given below?
class csharp
{
public int abc(int a)
{
Console.WriteLine("A:Just do it!");
return 0;
}
}
csharp s = new csharp();
del d = new del(ref s.abc);
d(10);
b) csharp s = new csharp();
delegate void d = new del(ref abc);
d(10);
c) delegate int del(int a);
del d;
csharp s = new csharp();
d = new del(ref s.fun);
d(10);
d) none of the mentioned
3. Which is the correct way to call the subroutine function abc() of the given class csharp given below?
class csharp
{
void abc()
{
console.writeline("A:Just do it!");
}
}
delegate void d = new del(ref abc);
d();
b) delegate void del();
del d;
csharp s = new csharp();
d = new del(ref s.abc);
d();
c) delegate void del();
abc s = new abc();
del d = new del(ref s.abc);
d();
d) csharp s = new csharp();
delegate void del = new delegate(ref abc);
del();
e) both b and c
4. What will be the output of the given code snippet below?
{
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);
}
}
}
b) ur C#.NET
c) ur C#.NET Skills
d) None of the mentioned
5. What will be the output of the given code snippet below?
{
delegate string F(string str);
class sample
{
public static string fun(string a)
{
return a.Replace(',''-');
}
}
class Program
{
static void Main(string[] args)
{
F str1 = new F(sample.fun);
string str = str1("Test Your c#.NET skills");
Console.WriteLine(str);
}
}
}
b) Test-Your-C#.NET-Skills
c) ur C#.NET Skills
d) None of the mentioned
6. Choose the statements which makes delegate in C#.NET different than a normal class?
a) Delegates in C#.NET is a base class for all delegates type
b) From Delegates created in C#.NET further not allowed to derive from the delegate types that are created
c) Only system and compilers can derive explicitly from the Delegate or MulticasteDelegate class
d) All of the mentioned
7. Which are the correct statement about delegates?
a) Delegates can be used to implement callback notification
b) Delegates permit execution of a method on a secondary thread in an asynchronous manner
c) Delegate is a user defined type
d) both a and b
e) None of the mentioned
8. What will be the output of given set of code?
{
delegate string f(string str);
class sample
{
public static string fun(string a)
{
return a.Replace('k', 'o');
}
}
class Program
{
static void Main(string[] args)
{
f str1 = new f(sample.fun);
string str = str1("Test Ykur C#.NET Skills");
Console.WriteLine(str);
Console.ReadLine();
}
}
}
b) Test Ykour C#.NET Skills
c) Test Your C#.NET Skills
d) Test ur C#.NET Skills
9. Incorrect statement about delegates are?
a) Delegates are reference types
b) Delegates are object oriented
c) Delegates are type safe
d) Only one method can be called using a delegate
10. Select the modifiers which controls the accessibility of the delegate:
a) new
b) protected
c) public
d) internal
e) all of the above