11
Loading subject content…
Loading subject content…
Loading practice questions…
What is the output of the following program?
Console.WriteLine(Add(2, 3) + " " + Add("2", "3"));
static int Add(int a, int b) => a + b;
static string Add(string a, string b) => a + b;What is the output of the following program?
Shape s = new Sq(); Console.WriteLine(s.Area());
abstract class Shape { public abstract double Area(); }
class Sq : Shape { public override double Area() => 4; }What is the output of the following program?
Shape[] shapes = { new Sq(2), new Circle() };
foreach (var s in shapes) Console.Write(s.Name() + " ");
abstract class Shape { public abstract string Name(); }
class Sq : Shape { int a; public Sq(int a) { this.a = a; } public override string Name() => "square"; }
class Circle : Shape { public override string Name() => "circle"; }