ExamVeda
Login
Home
61
What will be the output of the following C# code snippet?
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(40);
        Console.WriteLine(g.pop());
        Console.ReadLine();
    }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
62
Choose the statements which makes delegate in C#.NET different from a normal class?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
63
Which of the following is an incorrect statement about delegate?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
64
Which of the following is the correct way to call the function abc() of the given class in the following C# code?
class csharp
{
    public int abc(int a)
    {
        Console.WriteLine("A:Just do it!");
        return 0;
    }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
65
Suppose a Generic class called as SortObjects is to be made capable of sorting objects of any type(integer, single, byte etc). Then, which of the following programming constructs is able to implement the comparison function?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
66
What will be the output of the following C# code?
public class Generic<T>
{
    public T Field;
}
class Program
{
    static void Main(string[] args)
    {
        Generic<int> g2 = new Generic<int>();
        Generic<int> g3 = new Generic<int>();
        g2.Field = 8;
        g3.Field = 4;
        if (g2.Field % g3.Field == 0)
        {
            Console.WriteLine("A");
        }
        else
        Console.WriteLine("Prints nothing:");
        Console.ReadLine();
    }
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
67
Which statement is valid for the following C# code snippet?
public class Generic<T>
{
    public T Field;
}
class Program
{
    static void Main(string[] args)
    {
        Generic<String> g = new Generic<String>();
        g.Field = "Hi";
        Console.WriteLine(g.Field);
    }
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
68
Which of the following are the correct statements about delegates?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
69
What will be the output of the following C# code snippet?
{
    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);
        }
    }
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
70
Which among the given classes represents System.Collections.Generic namespace?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board