Examveda

What will be the output of the following C# code?
class maths
{
    public int fun1(int k)
    {
        k = 20;
        return k;
    }
    public Single fun1(float t)
    {
        t = 3.4f;
        return t;
    }
}  
class Program
{
    static void Main(string[] args)
    {
        maths obj = new maths();
        int i;
        i = obj.fun1(30);
        Console.WriteLine(i);
        Single j;
        j = obj.fun1(2.5f);
        Console.WriteLine(j);
        Console.ReadLine();
    }
}

A. 30
2.5f

B. 2.5f
30

C. 20
2.5f

D. 20
3.4f

Answer: Option D


Join The Discussion

Related Questions on Classes and Objects in C Sharp