91. What will be the output of the following C# code?
static void Main(string[] args)
{
m();
Console.ReadLine();
}
static void m()
{
Console.WriteLine("HI");
m();
}
static void Main(string[] args)
{
m();
Console.ReadLine();
}
static void m()
{
Console.WriteLine("HI");
m();
}92. When does a structure variable get destroyed?
93. Select wrong statement about destructor in C#?
94. What will be the Correct statement of the following C# code?
public class maths
{
public int x;
public virtual void a()
{
}
}
public class subject : maths
{
new public void a()
{
}
}
public class maths
{
public int x;
public virtual void a()
{
}
}
public class subject : maths
{
new public void a()
{
}
}95. Which of the following statements correctly define about the implementation of interface?
96. What will be the output of the following C# code?
{
struct abc
{
public int i;
}
class Program
{
static void Main(string[] args)
{
sample a = new sample();
a.i = 10;
fun(ref a);
Console.WriteLine(a.i);
}
public static voidn fun(ref sample x)
{
x.i = 20;
Console.WriteLine(x.i);
}
}
}
{
struct abc
{
public int i;
}
class Program
{
static void Main(string[] args)
{
sample a = new sample();
a.i = 10;
fun(ref a);
Console.WriteLine(a.i);
}
public static voidn fun(ref sample x)
{
x.i = 20;
Console.WriteLine(x.i);
}
}
}97. What will be the output of the following C# code?
class maths
{
int fact(int n)
{
int result;
if (n == 1)
return 1;
result = fact(n - 1) * n;
return result;
}
}
class Output
{
static void main(String args[])
{
maths obj = new maths() ;
Console.WriteLine(obj.fact(1));
}
}
class maths
{
int fact(int n)
{
int result;
if (n == 1)
return 1;
result = fact(n - 1) * n;
return result;
}
}
class Output
{
static void main(String args[])
{
maths obj = new maths() ;
Console.WriteLine(obj.fact(1));
}
}98. Choose the correct statement among the following which supports the fact that C# does not allow the creation of empty structures?
99. Correct method to define + operator is?
100. What will be the Correct statement in the following C# code?
interface a1
{
void f1();
void f2();
}
class a :a1
{
private int i;
void a1.f1()
{
}
}
interface a1
{
void f1();
void f2();
}
class a :a1
{
private int i;
void a1.f1()
{
}
}Read More Section(Classes and Objects in C Sharp)
Each Section contains maximum 100 MCQs question on Classes and Objects in C Sharp. To get more questions visit other sections.
