1. What will be the output of the following C# expression?
int a+= (float) b/= (long)c.
int a+= (float) b/= (long)c.2. Which of the following statements is correct?
3. Which statements are correct?
4. How many values does a function return?
5. What will be the output of the following C# code?
namespace ConsoleApplication4
{
public abstract class A
{
public int i = 7;
public abstract void display();
}
class B: A
{
public int j;
public override void display()
{
Console.WriteLine(i);
Console.WriteLine(j);
}
}
class Program
{
static void Main(string[] args)
{
B obj = new B();
A obj1 = new B();
obj.j = 1;
obj1.i = 8;
obj.display();
Console.ReadLine();
}
}
}
namespace ConsoleApplication4
{
public abstract class A
{
public int i = 7;
public abstract void display();
}
class B: A
{
public int j;
public override void display()
{
Console.WriteLine(i);
Console.WriteLine(j);
}
}
class Program
{
static void Main(string[] args)
{
B obj = new B();
A obj1 = new B();
obj.j = 1;
obj1.i = 8;
obj.display();
Console.ReadLine();
}
}
}6. What does the following C# code imply?
csharp abc;
abc = new charp();
csharp abc;
abc = new charp();7. Choose the correct statements about enum used in C#.NET?
8. What will be the output of the following C# code?
class A
{
public virtual void display()
{
Console.WriteLine("A");
}
}
class B: A
{
public override void display()
{
Console.WriteLine(" B ");
}
}
class Program
{
static void Main(string[] args)
{
A obj1 = new A();
B obj2 = new B();
A r;
r = obj1;
r.display();
r = obj2;
r.display();
Console.ReadLine();
}
}
class A
{
public virtual void display()
{
Console.WriteLine("A");
}
}
class B: A
{
public override void display()
{
Console.WriteLine(" B ");
}
}
class Program
{
static void Main(string[] args)
{
A obj1 = new A();
B obj2 = new B();
A r;
r = obj1;
r.display();
r = obj2;
r.display();
Console.ReadLine();
}
}9. Which is the correct way to create an object of the given class abc?
10. Which of these is not a correct statement?
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.
