71. Which reference modifier is used to define reference variable?
72. What will be the output of the following C# code?
class maths
{
int i;
public maths(int x)
{
i = x;
Console.WriteLine(" hello: ");
}
}
class maths1 : maths
{
public maths1(int x) :base(x)
{
Console.WriteLine("bye");
}
}
class Program
{
static void Main(string[] args)
{
maths1 k = new maths1(12);
Console.ReadLine();
}
}
class maths
{
int i;
public maths(int x)
{
i = x;
Console.WriteLine(" hello: ");
}
}
class maths1 : maths
{
public maths1(int x) :base(x)
{
Console.WriteLine("bye");
}
}
class Program
{
static void Main(string[] args)
{
maths1 k = new maths1(12);
Console.ReadLine();
}
}73. "A mechanism that binds together code and data in manipulates, and keeps both safe from outside interference and misuse. In short it isolates a particular code and data from all other codes and data. A well-defined interface controls access to that particular code and data."
74. To override a method in the subclass, the base class method should be defined as?
75. Calculate the number of bytes a structure variable s occupies in the memory if it is defined as follows.
class abc
{
int i;
Decimal d;
}
struct sample
{
private int x;
private Single y;
private trial z;
}
sample s = new sample();
class abc
{
int i;
Decimal d;
}
struct sample
{
private int x;
private Single y;
private trial z;
}
sample s = new sample();76. What is Recursion in CSharp defined as?
77. What will be the output of the following C# code?
class maths
{
int i;
public maths(int ii)
{
ii = 12;
int j = 12;
int r = ii * j;
Console.WriteLine(r);
}
}
class maths1 : maths
{
public maths1(int u) :base(u)
{
u = 13;
int h = 13;
Console.WriteLine(u + h);
}
}
class maths2 : maths1
{
public maths2(int k) :base(k)
{
k = 24;
int o = 6 ;
Console.WriteLine(k /o);
}
}
class Program
{
static void Main(string[] args)
{
maths2 t = new maths2(10);
Console.ReadLine();
}
}
class maths
{
int i;
public maths(int ii)
{
ii = 12;
int j = 12;
int r = ii * j;
Console.WriteLine(r);
}
}
class maths1 : maths
{
public maths1(int u) :base(u)
{
u = 13;
int h = 13;
Console.WriteLine(u + h);
}
}
class maths2 : maths1
{
public maths2(int k) :base(k)
{
k = 24;
int o = 6 ;
Console.WriteLine(k /o);
}
}
class Program
{
static void Main(string[] args)
{
maths2 t = new maths2(10);
Console.ReadLine();
}
}78. Which keyword is used to refer baseclass constructor to subclass constructor?
79. What will be the output of the following C# code?
class test
{
public void print()
{
Console.WriteLine("Csharp:");
}
}
class Program
{
static void Main(string[] args)
{
test t;
t.print();
Console.ReadLine();
}
}
class test
{
public void print()
{
Console.WriteLine("Csharp:");
}
}
class Program
{
static void Main(string[] args)
{
test t;
t.print();
Console.ReadLine();
}
}80. Which return statement correctly returns the output?
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.
