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();
}
}
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
Related Questions on Classes and Objects in C Sharp
A. A blueprint for creating objects
B. A method in C#
C. A variable in C#
D. A data type in C#
A. A method in C#
B. A variable in C#
C. An instance of a class
D. A data type in C#
A. public
B. private
C. protected
D. internal

Join The Discussion