What will be the output of the following C# code?
class maths
{
int i;
public maths(int ii)
{
ii = -25;
int g;
g = ii > 0 ? ii : ii * -1;
Console.WriteLine(g);
}
}
class maths1 :maths
{
public maths1(int ll) :base(ll)
{
ll = -1000;
Console.WriteLine((ll > 0 ? ll : ll * -1));
}
}
class Program
{
static void Main(string[] args)
{
maths1 p = new maths1(6);
Console.ReadLine();
}
}
class maths
{
int i;
public maths(int ii)
{
ii = -25;
int g;
g = ii > 0 ? ii : ii * -1;
Console.WriteLine(g);
}
}
class maths1 :maths
{
public maths1(int ll) :base(ll)
{
ll = -1000;
Console.WriteLine((ll > 0 ? ll : ll * -1));
}
}
class Program
{
static void Main(string[] args)
{
maths1 p = new maths1(6);
Console.ReadLine();
}
}A. -25
-1000
B. -1000
-25
C. 25
1000
D. None of the mentioned
Answer: Option C
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