Select an option to see the answer and solution.
Delegates and Events in C Sharp
practice.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
72
Questions
3/4
Page
Pick an option on a question to see the right answer and solution.
Select an option to see the answer and solution.
class Gen<T>
{
T ob;
}Select an option to see the answer and solution.
class csharp
{
void abc()
{
console.writeline("A:Just do it!");
}
}Select an option to see the answer and solution.
delegate void del(int i);Select an option to see the answer and solution.
Select an option to see the answer and solution.
public class Generic<T>
{
Stack<T> stk = new Stack<T>();
public void push(T obj)
{
stk.Push(obj);
}
public T pop()
{
T obj = stk.Pop();
return obj;
}
}
class Program
{
static void Main(string[] args)
{
Generic<string> g = new Generic<string>();
g.push(30);
Console.WriteLine(g.pop());
Console.ReadLine();
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
public class Generic<T>
{
public T Field;
public void testSub()
{
T i = Field + 1;
}
}
class Program
{
static void Main(string[] args)
{
Genericlt;int>g = new Genericlt;int>();
g.testSub();
}
}Select an option to see the answer and solution.
class a
{
public void x(int p, double k)
{
Console.WriteLine("k : csharp!");
}
}Select an option to see the answer and solution.
{
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();
}
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
public class Generic<T>
{
Stack<T> stk = new Stack<T>();
public void push(T obj)
{
stk.Push(obj);
}
public T pop()
{
T obj = stk.Pop();
return obj;
}
}
class Program
{
static void Main(string[] args)
{
Generic<int> g = new Generic<int>();
g.push("Csharp");
Console.WriteLine(g.pop());
Console.ReadLine();
}
}Select an option to see the answer and solution.
public class MyContainer<T> where T: IComparable
{
/* insert code here */
}Select an option to see the answer and solution.
class a
{
public void x(int p, double k)
{
Console.WriteLine("k : csharp!");
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
public class Generic<T>
{
Stack<T> stk = new Stack<T>();
public void push(T obj)
{
stk.Push(obj);
}
public T pop()
{
T obj = stk.Pop();
return obj;
}
}
class Program
{
static void Main(string[] args)
{
Generic<int> g = new Generic<int>();
g.push("Csharp");
Console.WriteLine(g.pop());
Console.ReadLine();
}
}Select an option to see the answer and solution.
public class Csharp
{
public void subject<S>(S arg)
{
Console.WriteLine(arg);
}
}
class Program
{
static Void Main(string[] args)
{
Csharp c = new Csharp();
c.subject("hi");
c.subject(20);
}
}Select an option to see the answer and solution.
public class Generic<T>
{
Stack<T> stk = new Stack<T>();
public void push(T obj)
{
stk.Push(obj);
}
public T pop()
{
T obj = stk.Pop();
return obj;
}
}
class Program
{
static void Main(string[] args)
{
Generic<string> g = new Generic<string>();
g.push("C++");
Console.WriteLine(g.pop() + " ");
Generic<int> g1 = new Generic<int>();
g1.push(20);
Console.WriteLine(g1.pop());
Console.ReadLine();
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.